Mozilla2:Image Encoding: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
interface imgIEncoder : nsISupports
== Interface ==
{
We need to add a new interface.  Something like:
  nsIOutputStream encode(imgIContainer image, nsAUTF8String mimetype);
interface imgIEncoder : nsISupports
{
  nsIOutputStream encode(imgIContainer image);


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


  /* scaling */
  /* scaling */
  ??
  ??
};
};
 
You would create one by doing:
createInstance("@mozilla.org/image/encoder;2?type=image/png");
 
Do we want to support passing in an output stream?  When you read from the stream should we encode just that much?  Thoughts?

Revision as of 01:05, 8 March 2005

Interface

We need to add a new interface. Something like:

interface imgIEncoder : nsISupports
{
  nsIOutputStream encode(imgIContainer image);
  /* Output width/height */
  attribute unsigned long width;
  attribute unsigned long height;
  /* scaling */
  ??
};

You would create one by doing:

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

Do we want to support passing in an output stream? When you read from the stream should we encode just that much? Thoughts?