当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript omggif.GifWriter类代码示例

本文整理汇总了TypeScript中omggif.GifWriter的典型用法代码示例。如果您正苦于以下问题:TypeScript GifWriter类的具体用法?TypeScript GifWriter怎么用?TypeScript GifWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GifWriter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: gen_gray_strip

function gen_gray_strip() {
    const gf = new omggif.GifWriter(buf, 256, 1);
    const palette = [];
    const indices = [];
    for (let i = 0; i < 256; ++i) {
        palette.push((i << 16) | (i << 8) | i);
        indices.push(i);
    }
    gf.addFrame(0, 0, 256, 1, indices, { palette });
    return gf.end();
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:11,代码来源:omggif-tests.ts

示例2: gen_anim

function gen_anim() {
    // The loop parameter is the number of times to loop, or 0 for forever.
    // A value of 1 will play twice (first time, and then one loop time).
    // To play only once do not specify loop or pass null.
    const gf = new omggif.GifWriter(buf, 2, 2, { loop: 1 });
    gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0], { palette: [0xff0000, 0x0000ff] });
    gf.addFrame(0, 0, 2, 2, [1, 0, 0, 1], {
        palette: [0xff0000, 0x0000ff],
        delay: 10,
    }); // Delay in hundredths of a sec (100 = 1s).
    return gf.end();
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:12,代码来源:omggif-tests.ts

示例3: gen_block256

// with lzw block of 256.
// see: https://github.com/deanm/omggif/issues/5
function gen_block256() {
    const width = 4840;
    const gf = new omggif.GifWriter(buf, width, 1, {
        palette: [0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000],
    });
    const stream = Array(width);
    for (let i = 0; i < width; ++i) stream[i] = i & 0x7;
    gf.addFrame(0, 0, width, 1, stream, { transparent: 0 });
    const data = buf.slice(0, gf.end());
    // Make sure it decodes.
    const gr = new omggif.GifReader(data);
    const frameInfo = gr.frameInfo(0);
    return frameInfo;
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:16,代码来源:omggif-tests.ts

示例4: gen_color_strip

// More than 8-bit color (via tiling of several frames).  Browsers seem to
// treat this as an animation though, with an enforced minimum time between
// frames which makes it animated instead of the intended static image.
function gen_color_strip() {
    const gf = new omggif.GifWriter(buf, 256, 256, {
        palette: [0x000000, 0xff0000],
        background: 1,
    });

    const indices = [];
    for (let i = 0; i < 256; ++i) indices.push(i);

    for (let j = 0; j < 256; ++j) {
        const palette = [];
        for (let i = 0; i < 256; ++i) palette.push((j << 16) | (i << 8) | i);
        gf.addFrame(0, j, 256, 1, indices, { palette, disposal: 1 });
    }
    return gf.end();
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:19,代码来源:omggif-tests.ts

示例5: gen_static_global

function gen_static_global() {
    const gf = new omggif.GifWriter(buf, 2, 2, { palette: [0xff0000, 0x0000ff] });
    gf.addFrame(0, 0, 2, 2, [0, 1, 1, 0]);
    return gf.end();
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:5,代码来源:omggif-tests.ts

示例6: gen_empty_white

// 1x1 white, generates the same as Google's 35 byte __utm.gif, except for some
// reason that I'm not sure of they set their background index to 255.
function gen_empty_white() {
    const gf = new omggif.GifWriter(buf, 1, 1, { palette: [0xffffff, 0x000000] });
    gf.addFrame(0, 0, 1, 1, [0]);
    return gf.end();
}
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:7,代码来源:omggif-tests.ts


注:本文中的omggif.GifWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。