snowkit / gif

Haxe GIF encoder, implementing the NeuQuant and LZW encoding algorithms
40 stars 13 forks source link

Removed unused frame sizes #6

Closed anissen closed 7 years ago

ruby0x1 commented 7 years ago

Hmm, I can't remember why I was keeping the variable frame sizes around, I must have changed my mind while refactoring. We'll just do it inversely: if the need arises for them, we'll add the sizes back to the frames and use those internally.

anissen commented 7 years ago

I also considered making delay and flippedY optional because they are probably not used for the majority of cases;

typedef GifFrame = {

        /** Delay of the frame in seconds. This value gets floored
            when encoded due to gif format requirements. If this value is negative,
            the default encoder frame rate will be used. */
    @:optional var delay: Float;
        /** Whether or not this frame should be flipped on the Y axis */
    @:optional var flippedY: Bool;
        /** Pixels data in unsigned bytes, rgb format */
    var data: UInt8Array;

}

However, I don't know if that should be handled here or simply by making a helper function where this library is used.

ruby0x1 commented 7 years ago

No they are definitely necessary on a per frame level. If you want a slideshow with 1s, 5s, 2s of delay time, it's crucial to have this control. FlippedY is used on OpenGL when reading back from a framebuffer, but allows you to mix non-GL grabbed frames (i.e pixels manually created) with GL captured frames interleaved.

EDIT: oh, I misread your intent to remove them - I think they're fine as not optional. Most users will probably use the higher level wrappers, and it's hardly a problem.