Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting position, width and height for addFrame #1

Open
GMartigny opened this issue Nov 27, 2019 · 0 comments
Open

Support setting position, width and height for addFrame #1

GMartigny opened this issue Nov 27, 2019 · 0 comments

Comments

@GMartigny
Copy link
Member

Each frame can be set a different position, width and height, allowing to update only a part of the GIF.

The each are encoded in the imageDescriptor and should use lsb() like width and height already does.

We may need to add an options parameters to the addFrame function.

const encoder = new GIF(width, height);

// Bad, too much arguments
encoder.addFrame(context, delay, x, y, width, height);
// Better ?
encoder.addFrame(context, delay, {
	position: [x, y],
	size: [width, height],
});

As of now, we extract data from the whole context. This new position option can be mistaken for the position from where to extract data.
This is the same issue as drawImage from the CanvasRenderingContext2D API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant