Mozilla2:Image Encoding: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 26: Line 26:
Do we want to support different types of scaling?  I'm thinking we may not and may just want a solid good scaling algorithm that all encoders can use.
Do we want to support different types of scaling?  I'm thinking we may not and may just want a solid good scaling algorithm that all encoders can use.


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

Revision as of 01:27, 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 : nsISupports
{
  void encode(in imgIContainer input, in nsIOutputStream output);

  /* Output width/height */
  attribute unsigned long width;
  attribute unsigned long height;

  /* type of scaling */
  const unsigned long SCALE_BAD = 0;
  const unsigned long SCALE_NORMAL = 1;
  const unsigned long SCALE_GOOD = 2;

  attribute unsigned long scaling;
};

encode() method

Should we put width/height on the encode method?

Scaling

Do we want to support different types of scaling? I'm thinking we may not and may just want a solid good scaling algorithm that all encoders can use.

Use

You would create one by doing:

createInstance("@mozilla.org/image/encoder;2?type=image/png");