added nsIImageContainer and nsIImageFrame and removed nsIImage2
git-svn-id: svn://10.0.0.236/trunk@85258 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e61f75065e
commit
d9c4e14097
@ -32,7 +32,8 @@ XPIDL_MODULE = gfx2
|
||||
|
||||
XPIDLSRCS = \
|
||||
gfxtypes.idl \
|
||||
nsIImage2.idl \
|
||||
nsIImageContainer.idl \
|
||||
nsIImageFrame.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
||||
@ -29,7 +29,8 @@ XPIDL_MODULE = gfx2
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\gfxtypes.idl \
|
||||
.\nsIImage2.idl \
|
||||
.\nsIImageContainer.idl \
|
||||
.\nsIImageFrame.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
||||
79
mozilla/gfx2/public/nsIImageContainer.idl
Normal file
79
mozilla/gfx2/public/nsIImageContainer.idl
Normal file
@ -0,0 +1,79 @@
|
||||
/** -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIDrawable;
|
||||
interface nsIImageFrame;
|
||||
interface nsIEnumerator;
|
||||
|
||||
/**
|
||||
* nsIImage interface
|
||||
*
|
||||
* @author Tim Rowley <tor@cs.brown.edu>
|
||||
* @author Stuart Parmenter <pavlov@netscape.com>
|
||||
* @version 1.2
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(5e8405a4-1dd2-11b2-8385-bc8e3446cad3)]
|
||||
interface nsIImageContainer : nsISupports
|
||||
{
|
||||
/**
|
||||
* Create a new \a aWidth x \a aHeight sized image container.
|
||||
*
|
||||
* @param aWidth The width of the container in which all the nsIImageFrame children will fit.
|
||||
* @param aHeight The height of the container in which all the nsIImageFrame children will fit.
|
||||
*/
|
||||
void init(in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
|
||||
/**
|
||||
* The width of the image.
|
||||
*/
|
||||
readonly attribute gfx_dimension width;
|
||||
|
||||
/**
|
||||
* The height of the image.
|
||||
*/
|
||||
readonly attribute gfx_dimension height;
|
||||
|
||||
|
||||
/**
|
||||
* Get the current frame that would be drawn if the image was to be drawn now
|
||||
*/
|
||||
readonly attribute nsIImageFrame currentFrame;
|
||||
|
||||
|
||||
|
||||
readonly attribute unsigned long numFrames;
|
||||
nsIImageFrame getFrameAt(in unsigned long index);
|
||||
|
||||
void appendFrame(in nsIImageFrame item);
|
||||
void removeFrame(in nsIImageFrame item);
|
||||
|
||||
nsIEnumerator enumerate();
|
||||
|
||||
void clear();
|
||||
|
||||
};
|
||||
@ -14,7 +14,7 @@
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
@ -24,8 +24,6 @@
|
||||
#include "nsISupports.idl"
|
||||
#include "gfxtypes.idl"
|
||||
|
||||
interface nsIDrawable;
|
||||
|
||||
/**
|
||||
* nsIImage interface
|
||||
*
|
||||
@ -34,36 +32,36 @@ interface nsIDrawable;
|
||||
* @version 1.2
|
||||
* @see "gfx2"
|
||||
*/
|
||||
[scriptable, uuid(5e8405a4-1dd2-11b2-8385-bc8e3446cad3)]
|
||||
interface nsIImage2 : nsISupports
|
||||
[scriptable, uuid(51cc27a8-1dd2-11b2-a1aa-dad33ab193b4)]
|
||||
interface nsIImageFrame : nsISupports
|
||||
{
|
||||
/**
|
||||
* Create a new \a aWidth x \a aHeight sized image.
|
||||
*
|
||||
* @param aX The offset from the nsIImageContainer parent at (0,0)
|
||||
* @param aY The offset from the nsIImageContainer parent at (0,0)
|
||||
* @param aWidth The width of the image to create.
|
||||
* @param aHeight The height of the image to create.
|
||||
* @param aFormat the width of the image to create.
|
||||
*
|
||||
* @note The data of a new image is unspecified (Whats the word i'm looking for here?).
|
||||
*/
|
||||
void init(in gfx_dimension aWidth,
|
||||
void init(in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight,
|
||||
in gfx_format aFormat);
|
||||
|
||||
|
||||
/**
|
||||
* Create an image with the bits copied from aDrawable
|
||||
*
|
||||
* @param aDrawable The drawing area to gather the image bits from.
|
||||
* @param aX The x-coordinate of the rectangle in aDrawable to grab.
|
||||
* @param aY The y-coordinate of the rectangle in aDrawable to grab.
|
||||
* @param aWidth The width of the rectangle in aDrawable to grab.
|
||||
* @param aHeight The height of the rectangle in aDrawable to grab.
|
||||
* The width of the image.
|
||||
*/
|
||||
void initFromDrawable(in nsIDrawable aDrawable,
|
||||
in gfx_coord aX,
|
||||
in gfx_coord aY,
|
||||
in gfx_dimension aWidth,
|
||||
in gfx_dimension aHeight);
|
||||
readonly attribute gfx_coord x;
|
||||
|
||||
/**
|
||||
* The width of the image.
|
||||
*/
|
||||
readonly attribute gfx_coord y;
|
||||
|
||||
/**
|
||||
* The width of the image.
|
||||
@ -75,6 +73,12 @@ interface nsIImage2 : nsISupports
|
||||
*/
|
||||
readonly attribute gfx_dimension height;
|
||||
|
||||
/**
|
||||
* The width of the image.
|
||||
*/
|
||||
[noscript] readonly attribute nsRect2 rect;
|
||||
|
||||
|
||||
/**
|
||||
* The image data format the image was created with.
|
||||
* @see nsIGFXFormat
|
||||
@ -31,7 +31,8 @@ MAKE_OBJ_TYPE = DLL
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsRect.obj \
|
||||
.\$(OBJDIR)\nsImage.obj \
|
||||
.\$(OBJDIR)\nsImageContainer.obj \
|
||||
.\$(OBJDIR)\nsImageFrame.obj \
|
||||
.\$(OBJDIR)\nsGfxFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
@ -24,18 +24,24 @@
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIModule.h"
|
||||
|
||||
#include "nsImage.h"
|
||||
#include "nsImageContainer.h"
|
||||
#include "nsImageFrame.h"
|
||||
|
||||
// objects that just require generic constructors
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImage)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageContainer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageFrame)
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "windows image",
|
||||
NS_IMAGE_CID,
|
||||
{ "windows image container",
|
||||
NS_IMAGECONTAINER_CID,
|
||||
"@mozilla.org/gfx/image;2",
|
||||
nsImageConstructor, },
|
||||
nsImageContainerConstructor, },
|
||||
{ "windows image frame",
|
||||
NS_IMAGEFRAME_CID,
|
||||
"@mozilla.org/gfx/image/frame;2",
|
||||
nsImageFrameConstructor, },
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsGfx2Module", components)
|
||||
|
||||
112
mozilla/gfx2/src/windows/nsImageContainer.cpp
Normal file
112
mozilla/gfx2/src/windows/nsImageContainer.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsImageContainer.h"
|
||||
|
||||
#include "nsUnitConverters.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsImageContainer, nsIImageContainer)
|
||||
|
||||
nsImageContainer::nsImageContainer()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsImageContainer::~nsImageContainer()
|
||||
{
|
||||
/* destructor code */
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* void init (in gfx_dimension aWidth, in gfx_dimension aHeight); */
|
||||
NS_IMETHODIMP nsImageContainer::Init(gfx_dimension aWidth, gfx_dimension aHeight)
|
||||
{
|
||||
if (aWidth <= 0 || aHeight <= 0) {
|
||||
printf("error - negative image size\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mSize.SizeTo(aWidth, aHeight);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension width; */
|
||||
NS_IMETHODIMP nsImageContainer::GetWidth(gfx_dimension *aWidth)
|
||||
{
|
||||
*aWidth = mSize.width;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension height; */
|
||||
NS_IMETHODIMP nsImageContainer::GetHeight(gfx_dimension *aHeight)
|
||||
{
|
||||
*aHeight = mSize.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* readonly attribute nsIImageFrame currentFrame; */
|
||||
NS_IMETHODIMP nsImageContainer::GetCurrentFrame(nsIImageFrame * *aCurrentFrame)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long numFrames; */
|
||||
NS_IMETHODIMP nsImageContainer::GetNumFrames(PRUint32 *aNumFrames)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIImageFrame getFrameAt (in unsigned long index); */
|
||||
NS_IMETHODIMP nsImageContainer::GetFrameAt(PRUint32 index, nsIImageFrame **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void appendFrame (in nsIImageFrame item); */
|
||||
NS_IMETHODIMP nsImageContainer::AppendFrame(nsIImageFrame *item)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void removeFrame (in nsIImageFrame item); */
|
||||
NS_IMETHODIMP nsImageContainer::RemoveFrame(nsIImageFrame *item)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* nsIEnumerator enumerate (); */
|
||||
NS_IMETHODIMP nsImageContainer::Enumerate(nsIEnumerator **_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void clear (); */
|
||||
NS_IMETHODIMP nsImageContainer::Clear()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
49
mozilla/gfx2/src/windows/nsImageContainer.h
Normal file
49
mozilla/gfx2/src/windows/nsImageContainer.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIImageContainer.h"
|
||||
|
||||
#include "nsSize2.h"
|
||||
|
||||
#define NS_IMAGECONTAINER_CID \
|
||||
{ /* aa699204-1dd1-11b2-84a9-a280c268e4fb */ \
|
||||
0xaa699204, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0x84, 0xa9, 0xa2, 0x80, 0xc2, 0x68, 0xe4, 0xfb} \
|
||||
}
|
||||
|
||||
class nsImageContainer : public nsIImageContainer
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIIMAGECONTAINER
|
||||
|
||||
nsImageContainer();
|
||||
virtual ~nsImageContainer();
|
||||
|
||||
private:
|
||||
/* additional members */
|
||||
nsSize2 mSize;
|
||||
};
|
||||
|
||||
@ -14,27 +14,27 @@
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000-2001 Netscape Communications Corporation. All
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsImage.h"
|
||||
#include "nsImageFrame.h"
|
||||
|
||||
#include "nsUnitConverters.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsImage, nsIImage2)
|
||||
NS_IMPL_ISUPPORTS1(nsImageFrame, nsIImageFrame)
|
||||
|
||||
nsImage::nsImage() :
|
||||
nsImageFrame::nsImageFrame() :
|
||||
mBits(nsnull)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
nsImage::~nsImage()
|
||||
nsImageFrame::~nsImageFrame()
|
||||
{
|
||||
/* destructor code */
|
||||
delete[] mBits;
|
||||
@ -129,8 +129,8 @@ void CreateBMPFile(HWND hwnd, LPTSTR pszFile, PBITMAPINFO pbi,
|
||||
|
||||
|
||||
|
||||
/* 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)
|
||||
/* void init (in gfx_coord aX, in gfx_coord aY, in gfx_dimension aWidth, in gfx_dimension aHeight, in gfx_format aFormat); */
|
||||
NS_IMETHODIMP nsImageFrame::Init(gfx_coord aX, gfx_coord aY, gfx_dimension aWidth, gfx_dimension aHeight, gfx_format aFormat)
|
||||
{
|
||||
if (aWidth <= 0 || aHeight <= 0) {
|
||||
printf("error - negative image size\n");
|
||||
@ -139,7 +139,7 @@ NS_IMETHODIMP nsImage::Init(gfx_dimension aWidth, gfx_dimension aHeight, gfx_for
|
||||
|
||||
delete[] mBits;
|
||||
|
||||
mSize.SizeTo(aWidth, aHeight);
|
||||
mRect.SetRect(aX, aY, aWidth, aHeight);
|
||||
mFormat = aFormat;
|
||||
|
||||
switch (aFormat) {
|
||||
@ -156,7 +156,7 @@ NS_IMETHODIMP nsImage::Init(gfx_dimension aWidth, gfx_dimension aHeight, gfx_for
|
||||
break;
|
||||
}
|
||||
|
||||
PRInt32 ceilWidth(GFXCoordToIntCeil(mSize.width));
|
||||
PRInt32 ceilWidth(GFXCoordToIntCeil(mRect.width));
|
||||
|
||||
mBytesPerRow = (ceilWidth * mDepth) >> 5;
|
||||
|
||||
@ -164,41 +164,68 @@ NS_IMETHODIMP nsImage::Init(gfx_dimension aWidth, gfx_dimension aHeight, gfx_for
|
||||
mBytesPerRow++;
|
||||
mBytesPerRow <<= 2;
|
||||
|
||||
mBitsLength = mBytesPerRow * GFXCoordToIntCeil(mSize.height);
|
||||
mBitsLength = mBytesPerRow * GFXCoordToIntCeil(mRect.height);
|
||||
|
||||
mBits = new PRUint8[mBitsLength];
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension width; */
|
||||
NS_IMETHODIMP nsImage::GetWidth(gfx_dimension *aWidth)
|
||||
/* readonly attribute gfx_coord x; */
|
||||
NS_IMETHODIMP nsImageFrame::GetX(gfx_coord *aX)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aWidth = mSize.width;
|
||||
*aX = mRect.x;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_coord y; */
|
||||
NS_IMETHODIMP nsImageFrame::GetY(gfx_coord *aY)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aY = mRect.y;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* readonly attribute gfx_dimension width; */
|
||||
NS_IMETHODIMP nsImageFrame::GetWidth(gfx_dimension *aWidth)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aWidth = mRect.width;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_dimension height; */
|
||||
NS_IMETHODIMP nsImage::GetHeight(gfx_dimension *aHeight)
|
||||
NS_IMETHODIMP nsImageFrame::GetHeight(gfx_dimension *aHeight)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aHeight = mSize.height;
|
||||
*aHeight = mRect.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsRect2 rect; */
|
||||
NS_IMETHODIMP nsImageFrame::GetRect(nsRect2 **aRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
// *aRect = mRect;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute gfx_format format; */
|
||||
NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
|
||||
NS_IMETHODIMP nsImageFrame::GetFormat(gfx_format *aFormat)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@ -211,8 +238,8 @@ NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
|
||||
LPBITMAPINFOHEADER mBHead = (LPBITMAPINFOHEADER)new char[sizeof(BITMAPINFO)];
|
||||
|
||||
mBHead->biSize = sizeof(BITMAPINFOHEADER);
|
||||
mBHead->biWidth = GFXCoordToIntCeil(mSize.width);
|
||||
mBHead->biHeight = -GFXCoordToIntCeil(mSize.height);
|
||||
mBHead->biWidth = GFXCoordToIntCeil(mRect.width);
|
||||
mBHead->biHeight = -GFXCoordToIntCeil(mRect.height);
|
||||
mBHead->biPlanes = 1;
|
||||
mBHead->biBitCount = mDepth;
|
||||
mBHead->biCompression = BI_RGB;
|
||||
@ -243,7 +270,7 @@ NS_IMETHODIMP nsImage::GetFormat(gfx_format *aFormat)
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long bytesPerRow; */
|
||||
NS_IMETHODIMP nsImage::GetBytesPerRow(PRUint32 *aBytesPerRow)
|
||||
NS_IMETHODIMP nsImageFrame::GetBytesPerRow(PRUint32 *aBytesPerRow)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@ -253,7 +280,7 @@ NS_IMETHODIMP nsImage::GetBytesPerRow(PRUint32 *aBytesPerRow)
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned long bitsLength; */
|
||||
NS_IMETHODIMP nsImage::GetBitsLength(PRUint32 *aBitsLength)
|
||||
NS_IMETHODIMP nsImageFrame::GetBitsLength(PRUint32 *aBitsLength)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@ -263,7 +290,7 @@ NS_IMETHODIMP nsImage::GetBitsLength(PRUint32 *aBitsLength)
|
||||
}
|
||||
|
||||
/* void getBits([array, size_is(length)] out PRUint8 bits, out unsigned long length); */
|
||||
NS_IMETHODIMP nsImage::GetBits(PRUint8 **aBits, PRUint32 *length)
|
||||
NS_IMETHODIMP nsImageFrame::GetBits(PRUint8 **aBits, PRUint32 *length)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@ -275,7 +302,7 @@ NS_IMETHODIMP nsImage::GetBits(PRUint8 **aBits, PRUint32 *length)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
NS_IMETHODIMP nsImageFrame::SetBits(const PRUint8 *data, PRUint32 length, PRInt32 offset)
|
||||
{
|
||||
if (!mBits)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
@ -21,27 +21,31 @@
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsIImage2.h"
|
||||
#include "nsIImageFrame.h"
|
||||
|
||||
#include "nsSize2.h"
|
||||
#include "nsRect2.h"
|
||||
|
||||
#define NS_IMAGE_CID \
|
||||
{0x73c72e6c, 0x1dd2, 0x11b2, \
|
||||
{ 0x98, 0xb7, 0xae, 0x59, 0x35, 0xee, 0x63, 0xf5 }}
|
||||
#define NS_IMAGEFRAME_CID \
|
||||
{ /* 99b219ea-1dd1-11b2-aa87-cd48e7d50227 */ \
|
||||
0x99b219ea, \
|
||||
0x1dd1, \
|
||||
0x11b2, \
|
||||
{0xaa, 0x87, 0xcd, 0x48, 0xe7, 0xd5, 0x02, 0x27} \
|
||||
}
|
||||
|
||||
class nsImage : public nsIImage2
|
||||
class nsImageFrame : public nsIImageFrame
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIIMAGE2
|
||||
NS_DECL_NSIIMAGEFRAME
|
||||
|
||||
nsImage();
|
||||
virtual ~nsImage();
|
||||
nsImageFrame();
|
||||
virtual ~nsImageFrame();
|
||||
|
||||
private:
|
||||
/* additional members */
|
||||
PRUint32 mBytesPerRow;
|
||||
nsSize2 mSize;
|
||||
nsRect2 mRect;
|
||||
gfx_format mFormat;
|
||||
|
||||
PRUint32 mBitsLength;
|
||||
Loading…
x
Reference in New Issue
Block a user