Mozilla2:Image Encoding: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
Something like: | Something like: | ||
interface imgIEncoder : | interface imgIEncoder : nsIInputStream | ||
{ | { | ||
/* input image data | /* input image data | ||
* result width | * result width | ||
* result height | * result height | ||
*/ | */ | ||
void | void init(in imgIContainer input, | ||
in unsigned long width, in unsigned long height); | |||
}; | }; | ||
=== Scaling === | === Scaling === | ||
Do we want to support different types of scaling? I' | Do we want to support different types of scaling? I'd prefer to just do nice Bicubic resampling. [http://members.bellatlantic.net/~vze2vrva/design.html] [http://astronomy.swin.edu.au/~pbourke/colour/bicubic/] | ||
=== Brendan's comments === | === Brendan's comments === | ||
A reader should get the bytes requested, if not greater than length of encoded image, and it's up to the encoder to buffer more if it encodes more bytes, reading from the buffer on next read. | A reader should get the bytes requested, if not greater than length of encoded image, and it's up to the encoder to buffer more if it encodes more bytes, reading from the buffer on next read. | ||
This expresses the idea that the encoder is something you read from. | |||
== Use == | == Use == | ||
You would create one by doing: | You would create one by doing: | ||
createInstance("@mozilla.org/image/encoder;2?type=image/png"); | createInstance("@mozilla.org/image/encoder;2?type=image/png"); |
Latest revision as of 06:17, 8 March 2005
Interface
We need to add a new interface. When you read from the stream should we encode just that much? Thoughts?
Something like:
interface imgIEncoder : nsIInputStream { /* input image data * result width * result height */ void init(in imgIContainer input, in unsigned long width, in unsigned long height); };
Scaling
Do we want to support different types of scaling? I'd prefer to just do nice Bicubic resampling. [1] [2]
Brendan's comments
A reader should get the bytes requested, if not greater than length of encoded image, and it's up to the encoder to buffer more if it encodes more bytes, reading from the buffer on next read.
This expresses the idea that the encoder is something you read from.
Use
You would create one by doing:
createInstance("@mozilla.org/image/encoder;2?type=image/png");