Immutable data storage
Closed this issue · 0 comments
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