diff --git a/README.md b/README.md index 205220a..95768fb 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ window.open(URL.createObjectURL(blob)) ## Types -See the [gif.ts](src/gif.ts) +See the [types.ts](src/types.ts) ## Encode Options diff --git a/src/Encoder.ts b/src/Encoder.ts index 71eec22..0361bee 100644 --- a/src/Encoder.ts +++ b/src/Encoder.ts @@ -3,7 +3,8 @@ import { Logger } from './Logger' import { CropIndexedFrame, EncodeGif, EncodeIndexdFrame, FrameToIndexedFrame } from './transformers' import { loadImage, resovleSource } from './utils' import { createWorker } from './create-worker' -import type { EncoderOptions, EncodingFrame, UnencodedFrame } from './types' +import type { EncoderOptions } from './options' +import type { EncodingFrame, UnencodedFrame } from './types' export interface EncoderConfig extends EncoderOptions { maxColors: number diff --git a/src/encode.ts b/src/encode.ts index 6d4dd65..68afcd5 100644 --- a/src/encode.ts +++ b/src/encode.ts @@ -1,5 +1,5 @@ import { Encoder } from './Encoder' -import type { EncoderOptions } from './types' +import type { EncoderOptions } from './options' export function encode(options: EncoderOptions & { format: 'blob' }): Promise export function encode(options: EncoderOptions & { format?: 'arrayBuffer' }): Promise diff --git a/src/options.ts b/src/options.ts new file mode 100644 index 0000000..f492d54 --- /dev/null +++ b/src/options.ts @@ -0,0 +1,20 @@ +import type { Gif, UnencodedFrame } from './types' + +export interface EncoderOptions extends Partial> { + /** GIF width */ + width: number + /** GIF height */ + height: number + /** The frames that needs to be encoded */ + frames?: Array + /** Enable debug mode to view the execution time log */ + debug?: boolean + /** Worker script url */ + workerUrl?: string + /** Max colors count 2-255 */ + maxColors?: number + /** Palette premultipliedAlpha */ + premultipliedAlpha?: boolean + /** Palette tint */ + tint?: Array +} diff --git a/src/types.ts b/src/types.ts index 28eead9..c2dd9c7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -102,22 +102,3 @@ export interface Gif89a extends Gif87a { export interface Gif extends Gif89a { version: '89a' | '87a' } - -export interface EncoderOptions extends Partial> { - /** GIF width */ - width: number - /** GIF height */ - height: number - /** The frames that needs to be encoded */ - frames?: Array - /** Enable debug mode to view the execution time log */ - debug?: boolean - /** Worker script url */ - workerUrl?: string - /** Max colors count 2-255 */ - maxColors?: number - /** Palette premultipliedAlpha */ - premultipliedAlpha?: boolean - /** Palette tint */ - tint?: Array -}