minor api changes/indentation and spacing fixes, etc

This commit is contained in:
pavlov%netscape.com 2001-03-14 00:35:27 +00:00
parent fa4b497eb8
commit d714532feb
5 changed files with 329 additions and 190 deletions

View File

@ -59,6 +59,17 @@ interface gfxIImageFrame : nsISupports
in nscoord aHeight,
in gfx_format aFormat);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in nscoord aDX,
in nscoord aDY,
in nscoord aDWidth,
in nscoord aDHeight);
/**
* The x-offset of the image.
*/
@ -90,12 +101,6 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
@ -119,6 +124,19 @@ interface gfxIImageFrame : nsISupports
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
*/
void lockImageData();
/**
* Unlock image pixels
*/
void unlockImageData();
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
@ -127,6 +145,33 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock alpha pixels before addressing the data directly
*/
void lockAlphaData();
/**
* Unlock alpha pixels
*/
void unlockAlphaData();
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* frame disposal method, used only by GIFs. Should probably subclass image frame
* and image container for GIFs special needs, but for simplicity it is here for the
* moment
@ -137,34 +182,4 @@ interface gfxIImageFrame : nsISupports
*/
attribute gfx_color backgroundColor;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
* @param mask If true, lock the mask bits, else lock image pixels.
*/
void lockImagePixels(in boolean mask);
/**
* Unlock image pixels
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void unlockImagePixels(in boolean mask);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in long aDX,
in long aDY,
in long aDWidth,
in long aDHeight);
};

View File

@ -59,6 +59,17 @@ interface gfxIImageFrame : nsISupports
in nscoord aHeight,
in gfx_format aFormat);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in nscoord aDX,
in nscoord aDY,
in nscoord aDWidth,
in nscoord aDHeight);
/**
* The x-offset of the image.
*/
@ -90,12 +101,6 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
@ -119,6 +124,19 @@ interface gfxIImageFrame : nsISupports
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
*/
void lockImageData();
/**
* Unlock image pixels
*/
void unlockImageData();
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
@ -127,6 +145,33 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock alpha pixels before addressing the data directly
*/
void lockAlphaData();
/**
* Unlock alpha pixels
*/
void unlockAlphaData();
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* frame disposal method, used only by GIFs. Should probably subclass image frame
* and image container for GIFs special needs, but for simplicity it is here for the
* moment
@ -137,34 +182,4 @@ interface gfxIImageFrame : nsISupports
*/
attribute gfx_color backgroundColor;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
* @param mask If true, lock the mask bits, else lock image pixels.
*/
void lockImagePixels(in boolean mask);
/**
* Unlock image pixels
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void unlockImagePixels(in boolean mask);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in long aDX,
in long aDY,
in long aDWidth,
in long aDHeight);
};

View File

@ -101,6 +101,16 @@ NS_IMETHODIMP gfxImageFrame::Init(nscoord aX, nscoord aY, nscoord aWidth, nscoor
return NS_OK;
}
/* void drawTo */
NS_IMETHODIMP gfxImageFrame::DrawTo(gfxIImageFrame* aDst, nscoord aDX, nscoord aDY, nscoord aDWidth, nscoord aDHeight)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIImage> img(do_GetInterface(aDst));
return mImage->DrawToImage(img, aDX, aDY, aDWidth, aDHeight);
}
/* readonly attribute nscoord x; */
NS_IMETHODIMP gfxImageFrame::GetX(nscoord *aX)
{
@ -163,19 +173,6 @@ NS_IMETHODIMP gfxImageFrame::GetFormat(gfx_format *aFormat)
return NS_OK;
}
/* attribute long timeout; */
NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout)
{
*aTimeout = mTimeout;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetTimeout(PRInt32 aTimeout)
{
mTimeout = aTimeout;
return NS_OK;
}
/* readonly attribute unsigned long imageBytesPerRow; */
NS_IMETHODIMP gfxImageFrame::GetImageBytesPerRow(PRUint32 *aBytesPerRow)
{
@ -245,28 +242,22 @@ NS_IMETHODIMP gfxImageFrame::SetImageData(const PRUint8 *aData, PRUint32 aLength
return NS_OK;
}
/* attribute long frameDisposalMethod; */
NS_IMETHODIMP gfxImageFrame::GetFrameDisposalMethod(PRInt32 *aFrameDisposalMethod)
/* void lockImageData (); */
NS_IMETHODIMP gfxImageFrame::LockImageData()
{
*aFrameDisposalMethod = mDisposalMethod;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetFrameDisposalMethod(PRInt32 aFrameDisposalMethod)
{
mDisposalMethod = aFrameDisposalMethod;
return NS_OK;
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
return mImage->LockImagePixels(PR_FALSE);
}
/* attribute gfx_color backgroundColor; */
NS_IMETHODIMP gfxImageFrame::GetBackgroundColor(gfx_color *aBackgroundColor)
/* void unlockImageData (); */
NS_IMETHODIMP gfxImageFrame::UnlockImageData()
{
*aBackgroundColor = mBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetBackgroundColor(gfx_color aBackgroundColor)
{
mBackgroundColor = aBackgroundColor;
return NS_OK;
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
return mImage->UnlockImagePixels(PR_FALSE);
}
/* readonly attribute unsigned long alphaBytesPerRow; */
@ -330,25 +321,81 @@ NS_IMETHODIMP gfxImageFrame::SetAlphaData(const PRUint8 *aData, PRUint32 aLength
return NS_OK;
}
/* void lockImagePixels (in boolean mask); */
NS_IMETHODIMP gfxImageFrame::LockImagePixels(PRBool mask)
/* void lockAlphaData (); */
NS_IMETHODIMP gfxImageFrame::LockAlphaData()
{
return mImage->LockImagePixels(mask);
if (!mInitalized || !mImage->GetHasAlphaMask())
return NS_ERROR_NOT_INITIALIZED;
return mImage->LockImagePixels(PR_TRUE);
}
/* void unlockImagePixels (in boolean mask); */
NS_IMETHODIMP gfxImageFrame::UnlockImagePixels(PRBool mask)
/* void unlockAlphaData (); */
NS_IMETHODIMP gfxImageFrame::UnlockAlphaData()
{
return mImage->UnlockImagePixels(mask);
if (!mInitalized || !mImage->GetHasAlphaMask())
return NS_ERROR_NOT_INITIALIZED;
return mImage->UnlockImagePixels(PR_TRUE);
}
/* void drawTo */
NS_IMETHODIMP gfxImageFrame::DrawTo(gfxIImageFrame* aDst, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
/* attribute long timeout; */
NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout)
{
nsCOMPtr<nsIImage> img(do_GetInterface(aDst));
return mImage->DrawToImage(img, aDX, aDY, aDWidth, aDHeight);
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aTimeout = mTimeout;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetTimeout(PRInt32 aTimeout)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mTimeout = aTimeout;
return NS_OK;
}
/* attribute long frameDisposalMethod; */
NS_IMETHODIMP gfxImageFrame::GetFrameDisposalMethod(PRInt32 *aFrameDisposalMethod)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aFrameDisposalMethod = mDisposalMethod;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetFrameDisposalMethod(PRInt32 aFrameDisposalMethod)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mDisposalMethod = aFrameDisposalMethod;
return NS_OK;
}
/* attribute gfx_color backgroundColor; */
NS_IMETHODIMP gfxImageFrame::GetBackgroundColor(gfx_color *aBackgroundColor)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aBackgroundColor = mBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetBackgroundColor(gfx_color aBackgroundColor)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mBackgroundColor = aBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::GetInterface(const nsIID & aIID, void * *result)

View File

@ -59,6 +59,17 @@ interface gfxIImageFrame : nsISupports
in nscoord aHeight,
in gfx_format aFormat);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in nscoord aDX,
in nscoord aDY,
in nscoord aDWidth,
in nscoord aDHeight);
/**
* The x-offset of the image.
*/
@ -90,12 +101,6 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute gfx_format format;
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* data accessors */
readonly attribute unsigned long imageBytesPerRow;
@ -119,6 +124,19 @@ interface gfxIImageFrame : nsISupports
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
*/
void lockImageData();
/**
* Unlock image pixels
*/
void unlockImageData();
/* alpha stuff.. used for _A1 and _A8 formated images */
readonly attribute unsigned long alphaBytesPerRow;
@ -127,6 +145,33 @@ interface gfxIImageFrame : nsISupports
*/
readonly attribute unsigned long alphaDataLength;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock alpha pixels before addressing the data directly
*/
void lockAlphaData();
/**
* Unlock alpha pixels
*/
void unlockAlphaData();
/**
* Represents the number of milliseconds until the next frame should be displayed.
* @note -1 means that this frame should be displayed forever.
*/
attribute long timeout;
/* frame disposal method, used only by GIFs. Should probably subclass image frame
* and image container for GIFs special needs, but for simplicity it is here for the
* moment
@ -137,34 +182,4 @@ interface gfxIImageFrame : nsISupports
*/
attribute gfx_color backgroundColor;
// XXX do we copy here? lets not...
void getAlphaData([array, size_is(length)] out PRUint8 bits, out unsigned long length);
/**
* Sets \a length bytes of \a data in this object.
*/
void setAlphaData([array, size_is(length), const] in PRUint8 data,
in unsigned long length,
in long offset);
/**
* Lock image pixels before addressing the data directly
* @param mask If true, lock the mask bits, else lock image pixels.
*/
void lockImagePixels(in boolean mask);
/**
* Unlock image pixels
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void unlockImagePixels(in boolean mask);
/**
* Blit this frame into another frame. Used for GIF animation compositing
* @param mask If true, unlock the mask bits, else unlock image pixels.
*/
void drawTo(in gfxIImageFrame aDst,
in long aDX,
in long aDY,
in long aDWidth,
in long aDHeight);
};

View File

@ -101,6 +101,16 @@ NS_IMETHODIMP gfxImageFrame::Init(nscoord aX, nscoord aY, nscoord aWidth, nscoor
return NS_OK;
}
/* void drawTo */
NS_IMETHODIMP gfxImageFrame::DrawTo(gfxIImageFrame* aDst, nscoord aDX, nscoord aDY, nscoord aDWidth, nscoord aDHeight)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIImage> img(do_GetInterface(aDst));
return mImage->DrawToImage(img, aDX, aDY, aDWidth, aDHeight);
}
/* readonly attribute nscoord x; */
NS_IMETHODIMP gfxImageFrame::GetX(nscoord *aX)
{
@ -163,19 +173,6 @@ NS_IMETHODIMP gfxImageFrame::GetFormat(gfx_format *aFormat)
return NS_OK;
}
/* attribute long timeout; */
NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout)
{
*aTimeout = mTimeout;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetTimeout(PRInt32 aTimeout)
{
mTimeout = aTimeout;
return NS_OK;
}
/* readonly attribute unsigned long imageBytesPerRow; */
NS_IMETHODIMP gfxImageFrame::GetImageBytesPerRow(PRUint32 *aBytesPerRow)
{
@ -245,28 +242,22 @@ NS_IMETHODIMP gfxImageFrame::SetImageData(const PRUint8 *aData, PRUint32 aLength
return NS_OK;
}
/* attribute long frameDisposalMethod; */
NS_IMETHODIMP gfxImageFrame::GetFrameDisposalMethod(PRInt32 *aFrameDisposalMethod)
/* void lockImageData (); */
NS_IMETHODIMP gfxImageFrame::LockImageData()
{
*aFrameDisposalMethod = mDisposalMethod;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetFrameDisposalMethod(PRInt32 aFrameDisposalMethod)
{
mDisposalMethod = aFrameDisposalMethod;
return NS_OK;
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
return mImage->LockImagePixels(PR_FALSE);
}
/* attribute gfx_color backgroundColor; */
NS_IMETHODIMP gfxImageFrame::GetBackgroundColor(gfx_color *aBackgroundColor)
/* void unlockImageData (); */
NS_IMETHODIMP gfxImageFrame::UnlockImageData()
{
*aBackgroundColor = mBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetBackgroundColor(gfx_color aBackgroundColor)
{
mBackgroundColor = aBackgroundColor;
return NS_OK;
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
return mImage->UnlockImagePixels(PR_FALSE);
}
/* readonly attribute unsigned long alphaBytesPerRow; */
@ -330,25 +321,81 @@ NS_IMETHODIMP gfxImageFrame::SetAlphaData(const PRUint8 *aData, PRUint32 aLength
return NS_OK;
}
/* void lockImagePixels (in boolean mask); */
NS_IMETHODIMP gfxImageFrame::LockImagePixels(PRBool mask)
/* void lockAlphaData (); */
NS_IMETHODIMP gfxImageFrame::LockAlphaData()
{
return mImage->LockImagePixels(mask);
if (!mInitalized || !mImage->GetHasAlphaMask())
return NS_ERROR_NOT_INITIALIZED;
return mImage->LockImagePixels(PR_TRUE);
}
/* void unlockImagePixels (in boolean mask); */
NS_IMETHODIMP gfxImageFrame::UnlockImagePixels(PRBool mask)
/* void unlockAlphaData (); */
NS_IMETHODIMP gfxImageFrame::UnlockAlphaData()
{
return mImage->UnlockImagePixels(mask);
if (!mInitalized || !mImage->GetHasAlphaMask())
return NS_ERROR_NOT_INITIALIZED;
return mImage->UnlockImagePixels(PR_TRUE);
}
/* void drawTo */
NS_IMETHODIMP gfxImageFrame::DrawTo(gfxIImageFrame* aDst, PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
/* attribute long timeout; */
NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout)
{
nsCOMPtr<nsIImage> img(do_GetInterface(aDst));
return mImage->DrawToImage(img, aDX, aDY, aDWidth, aDHeight);
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aTimeout = mTimeout;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetTimeout(PRInt32 aTimeout)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mTimeout = aTimeout;
return NS_OK;
}
/* attribute long frameDisposalMethod; */
NS_IMETHODIMP gfxImageFrame::GetFrameDisposalMethod(PRInt32 *aFrameDisposalMethod)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aFrameDisposalMethod = mDisposalMethod;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetFrameDisposalMethod(PRInt32 aFrameDisposalMethod)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mDisposalMethod = aFrameDisposalMethod;
return NS_OK;
}
/* attribute gfx_color backgroundColor; */
NS_IMETHODIMP gfxImageFrame::GetBackgroundColor(gfx_color *aBackgroundColor)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
*aBackgroundColor = mBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::SetBackgroundColor(gfx_color aBackgroundColor)
{
if (!mInitalized)
return NS_ERROR_NOT_INITIALIZED;
mBackgroundColor = aBackgroundColor;
return NS_OK;
}
NS_IMETHODIMP gfxImageFrame::GetInterface(const nsIID & aIID, void * *result)