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

Immutable data storage #49

Closed
gforge opened this issue May 7, 2019 · 0 comments
Closed

Immutable data storage #49

gforge opened this issue May 7, 2019 · 0 comments

Comments

@gforge
Copy link
Collaborator

gforge commented May 7, 2019

When using Redux it is:

It is highly recommended that you only put plain serializable objects, arrays, and primitives into your store

The pngjs3 would therefore benefit from a serialize() and static deserialize() methods.

The data should then be kept in a storage that follows the immutability principles implemented by libraries such as immer.

In addition the width & height object should be available in a combined object. Components not responsible for drawing (e.g. non-canvas) often only care about the image shape and not the data and should therefore not have to handle the entire object. This should be available as a shape property.

The plan to implementation is through getters and setters for retaining the current API while adding a store property that contains:

  • width: number;
  • height: number;
  • color: boolean;
  • depth: number;
  • _grayscaleData: Uint8Array | Uint16Array | void;
  • _propData: ?Float32Array;
  • data: ?Buffer;
  • gamma: number
gforge added a commit that referenced this issue May 7, 2019
The properties have been moved into "storage" and are now available thorugh getters & setters.
Also added shape for convenience.
@gforge gforge closed this as completed May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant