# @tinyjs/tinyjs-plugin-extract

> Tiny.js renderer-specific plugins for exporting content from a renderer

Latest version **1.0.4** (published 2017-05-30) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @tinyjs/tinyjs-plugin-extract
pnpm add @tinyjs/tinyjs-plugin-extract
yarn add @tinyjs/tinyjs-plugin-extract
bun add @tinyjs/tinyjs-plugin-extract
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2017-05-30 |
| First published | 2017-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | yiqi |
| Maintainers | yiqi |
| Keywords | tinyjs, plugin |

## Links

- npm: https://www.npmjs.com/package/@tinyjs/tinyjs-plugin-extract
- Repository: https://github.com/ant-tinyjs/tinyjs-plugin-extract
- Homepage: https://github.com/ant-tinyjs/tinyjs-plugin-extract#readme
- Issues: https://github.com/ant-tinyjs/tinyjs-plugin-extract/issues
- npm.io page: https://npm.io/package/@tinyjs/tinyjs-plugin-extract

## Recent versions

- 1.0.4 (latest) — 2017-05-30
- 1.0.3 — 2017-05-30
- 1.0.2 — 2017-05-28
- 1.0.0 — 2017-05-27

## README

# tinyjs-plugin-extract

> 画布扩展，获取画布的：Image 对象、base64 格式的图片、像素值等等

## 查看demo

http://tinyjs.net/plugins/tinyjs-plugin-extract.html#demo

## 引用方法

- 推荐作为依赖使用

  - `npm install tinyjs-plugin-extract --save`

- 也可以直接引用线上cdn地址，注意要使用最新的版本号，例如：

  - https://gw.alipayobjects.com/os/lib/tinyjs-plugin-extract/1.4.0/index.js
  - https://gw.alipayobjects.com/os/lib/tinyjs-plugin-extract/1.4.0/index.debug.js

## 起步
首先当然是要引入，推荐`NPM`方式，当然你也可以使用`CDN`或下载独立版本，先从几个例子入手吧！

##### 1、最简单的例子

引用 Tiny.js 源码
``` html
<script src="https://gw.alipayobjects.com/os/lib/tinyjs/tiny/1.3.1/tiny.js"></script>
```
``` js
require('tinyjs-plugin-extract');
// 或者
// import * as extract from 'tinyjs-plugin-extract';

// 新建 App
const app = new Tiny.Application();
const texture = Tiny.Texture.fromImage('https://gw.alipayobjects.com/as/g/tiny/resources/1.0.0/images/logo.png');
const sprite = new Tiny.Sprite(texture);
texture.on('update', function () {
  const image = app.renderer.plugins.extract.image(sprite);
  console.log(image);
  //=> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsC..SuQmCC">
});
```

## 依赖
- `Tiny.js`: [Link](http://tinyjs.net/api)

## API文档

http://tinyjs.net/plugins/tinyjs-plugin-extract.html#docs

---
_Source: https://npm.io/package/@tinyjs/tinyjs-plugin-extract · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
