Mozilla2:Image Encoding

From MozillaWiki
Jump to: navigation, search


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);


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.


You would create one by doing: