more changes

This commit is contained in:
pavlov%netscape.com 2001-01-07 04:22:41 +00:00
parent 10bd1646c5
commit fd1214a386
4 changed files with 40 additions and 100 deletions

View File

@ -14,7 +14,7 @@
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
@ -38,7 +38,7 @@ interface nsIDrawable;
interface nsIImage : nsISupports
{
/**
* Create a new aWidth x aHeight sized image.
* Create a new \a aWidth x \a aHeight sized image.
*
* @param aWidth The width of the image to create.
* @param aHeight The height of the image to create.
@ -65,22 +65,6 @@ interface nsIImage : nsISupports
in gfx_dimension aWidth,
in gfx_dimension aHeight);
/* we should be consistent about using x, y, width, height and x1,x2, etc */
void setDecodedRect(in gfx_coord x1,
in gfx_coord y1,
in gfx_coord x2,
in gfx_coord y2);
readonly attribute gfx_coord decodedX1;
readonly attribute gfx_coord decodedY1;
readonly attribute gfx_coord decodedX2;
readonly attribute gfx_coord decodedY2;
/**
* A packed representation of the image data as specified by format.
*/
readonly attribute PRUint8 bits;
/**
* The width of the image.
*/
@ -97,25 +81,21 @@ interface nsIImage : nsISupports
*/
readonly attribute gfx_format format;
readonly attribute long lineStride;
/* alpha stuff */
/* depending on the platform and we may not need abits (some might prefer */
/* a packed representation of rgba data */
readonly attribute PRUint8 abits;
readonly attribute long aLineStride;
/**
* this data is const and if you touch it you will die!
*/
PRUint8 getBits();
/**
* Does the system want to top to bottom row ordering.
* @note this should probably be on nsIOutputDevice if we want it.
* @note urgh... you want image decoders to obey this? (tor)
* Sets \a length bytes of \a data in this object.
* @param offset The offset from the first pixel in bytes. To set
* data beginning with the first (top left) pixel in the image, \a offset
* should be 0; to set data beginning with, for example, the sixth pixel in
* the first row of a RGBA32 image, the offset should be 20.
* @attension should we use PRUint32 instead?
*/
readonly attribute boolean isRowOrderTopToBottom;
void setBits([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Used to let the implimentation know that the image data has changed.
* @note need to specify some flags... (or if all data is packed in to 1 accessor, remove flags)
*/
[noscript] void setImageUpdated(in long aFlags, [const] in nsRect2 updateRect);
};

View File

@ -39,95 +39,46 @@ nsImage::~nsImage()
/* void init (in gfx_dimension aWidth, in gfx_dimension aHeight, in gfx_format aFormat); */
NS_IMETHODIMP nsImage::Init(gfx_dimension aWidth, gfx_dimension aHeight, gfx_format aFormat)
{
return NS_ERROR_NOT_IMPLEMENTED;
mSize.SizeTo(aWidth, aHeight);
mFormat = aFormat;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void initFromDrawable (in nsIDrawable aDrawable, in gfx_coord aX, in gfx_coord aY, in gfx_dimension aWidth, in gfx_dimension aHeight); */
NS_IMETHODIMP nsImage::InitFromDrawable(nsIDrawable *aDrawable, gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setDecodedRect (in gfx_coord x1, in gfx_coord y1, in gfx_coord x2, in gfx_coord y2); */
NS_IMETHODIMP nsImage::SetDecodedRect(gfx_coord x1, gfx_coord y1, gfx_coord x2, gfx_coord y2)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute gfx_coord decodedX1; */
NS_IMETHODIMP nsImage::GetDecodedX1(gfx_coord *aDecodedX1)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute gfx_coord decodedY1; */
NS_IMETHODIMP nsImage::GetDecodedY1(gfx_coord *aDecodedY1)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute gfx_coord decodedX2; */
NS_IMETHODIMP nsImage::GetDecodedX2(gfx_coord *aDecodedX2)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute gfx_coord decodedY2; */
NS_IMETHODIMP nsImage::GetDecodedY2(gfx_coord *aDecodedY2)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRUint8 bits; */
NS_IMETHODIMP nsImage::GetBits(PRUint8 *aBits)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute gfx_dimension width; */
NS_IMETHODIMP nsImage::GetWidth(gfx_dimension *aWidth)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aWidth = mSize.width;
return NS_OK;
}
/* readonly attribute gfx_dimension height; */
NS_IMETHODIMP nsImage::GetHeight(gfx_dimension *aHeight)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aHeight = mSize.height;
return NS_OK;
}
/* readonly attribute gfx_format format; */
NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aFormat = mFormat;
return NS_OK;
}
/* readonly attribute long lineStride; */
NS_IMETHODIMP nsImage::GetLineStride(PRInt32 *aLineStride)
/* PRUint8 getBits (); */
NS_IMETHODIMP nsImage::GetBits(PRUint8 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRUint8 abits; */
NS_IMETHODIMP nsImage::GetAbits(PRUint8 *aAbits)
/* void setBits ([array, size_is (length), const] in PRUint8 data, in unsigned long length, in long offset); */
NS_IMETHODIMP nsImage::SetBits(const PRUint8 *data, PRUint32 length, PRInt32 offset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute long aLineStride; */
NS_IMETHODIMP nsImage::GetALineStride(PRInt32 *aALineStride)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean isRowOrderTopToBottom; */
NS_IMETHODIMP nsImage::GetIsRowOrderTopToBottom(PRBool *aIsRowOrderTopToBottom)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [noscript] void setImageUpdated (in long aFlags, [const] in nsRect2 updateRect); */
NS_IMETHODIMP nsImage::SetImageUpdated(PRInt32 aFlags, const nsRect2 * updateRect)
{
return NS_ERROR_NOT_IMPLEMENTED;
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -23,6 +23,8 @@
#include "nsIImage.h"
#include "nsSize2.h"
#define NS_IMAGE_CID \
{0x73c72e6c, 0x1dd2, 0x11b2, \
{ 0x98, 0xb7, 0xae, 0x59, 0x35, 0xee, 0x63, 0xf5 }}
@ -35,6 +37,11 @@ public:
nsImage();
virtual ~nsImage();
/* additional members */
private:
nsSize2 mSize;
gfx_format mFormat;
};

2
gfx2/tests/.cvsignore Normal file
View File

@ -0,0 +1,2 @@
Makefile
.deps