KernelBitmap Class Reference

To encapsulate bitmaps, which are implemented in the OIL layer. Kernel code is only allowed to use this interface. OIL code is allowed to use the specific OILy functions that can be done via the OILBitmap pointer. More...

#include <bitmap.h>

Inheritance diagram for KernelBitmap:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 KernelBitmap (OILBitmap *pBitmap=NULL, BOOL Temp=FALSE)
 Constructor for kernel bitmaps. Attaches to the OILBitmap and increases its usage count.
 KernelBitmap (const KernelBitmap &)
 Copy constructor for kernel bitmaps. MAintains usage count on OILBitmap.
 KernelBitmap (UINT32, UINT32, UINT32, UINT32, BOOL Temp=FALSE)
 Constructor for kernel bitmaps which attaches it to a blank OILbitmap. Actually, the OILBitmap isn't really blank, it is entirely uninitialised i.e its contents will be random (including its palette if it has one).
 ~KernelBitmap ()
 Destructor. Detaches any current OILBitmap.
INT32 operator== (const KernelBitmap &)
KernelBitmapoperator= (const KernelBitmap &)
 Assigns one KernelBitmap to another while maintaining usage count on OILBitmap.
OILBitmapGetActualBitmap () const
BOOL IsOK () const
 Tell if KernelBitmap is OK.
virtual BOOL WritePalette (BaseCamelotFilter *pFilter)
 Exports the palette out to the file using the BaseCamelotFilter supplied. This means that it is being written to a web or native file. At present, used by the code when outputting an 8bpp JPEG to squirt the palette into the record so that we can convert it back to 8bpp using the palette on loading.
virtual BOOL Convert24To8 (RGBTRIPLE *pPalette, UINT32 NumberOfPaletteEntries)
 Converts the OILbitmap from its present 24bpp form into an 8bpp form which should closely match the one that was exported.
void PlotPixel (INT32 x, INT32 y, Pixel32bpp NewValue)
 Plots a 32bpp pixel to a deep bitmap (16, 24, or 32bpp).
void PlotPixel (INT32 x, INT32 y, PixelGreyscale NewValue)
 Plots an 8bpp (0..255) pixel to any type of bitmap The pixel is taken to be a greyscale, and is truncated or expanded as appropriate to fit the greyscale value into the destination bitmap pixel format.
Pixel32bpp ReadPixel32bpp (INT32 x, INT32 y, BOOL UsePalette=TRUE) const
 reads a pixel
INT32 ReturnPaletteIndexUsed (INT32 x, INT32 y) const
PixelGreyscale ReadPixelGreyscale (INT32 x, INT32 y) const
 Reads a pixel as a greyscale intensity value (0..255).
ADDR GetBitmapBits () const
 Helper function to get the actual bits (as in Bitmap).
BitmapListGetParentBitmapList ()
BOOL IsUsedInDocument (Document *pDoc, BOOL bIncludeHidden=FALSE)
 Finds if this bitmap is being used in a specified document or not.
void Attach (BitmapList *=NULL)
 Adds this kernel bitmap to the specified document bitmap list.
void Detach ()
 Removes this kernel bitmap from it's current document bitmap list.
UINT32 GetWidth () const
 Finds the width of this bitmap.
UINT32 GetHeight () const
 Finds the height of this bitmap.
UINT32 GetBPP ()
 Finds the colour resolution of this bitmap.
UINT32 GetNumPaletteEntries () const
 Finds the number of colours colour in this bitmap.
INT32 GetRecommendedWidth ()
 Finds the recommended width of the bitmap.
INT32 GetRecommendedHeight ()
 Finds the recommended height of the bitmap.
void SetRecommendedWidth (INT32)
 Sets the recommended width of the bitmap.
void SetRecommendedHeight (INT32)
 Sets the recommended height of the bitmap.
BOOL SetTransparencyIndex (INT32)
 Finds the Transparent index colour of a bitmap if one exists.
BOOL GetTransparencyIndex (INT32 *pIndex)
 Finds the Transparent index colour of a bitmap if one exists.
BOOL IsTransparent ()
 Determines if a bitmap is not totally opaque.
BOOL IsDefaultBitmap ()
 To find out if the bitmap is the default bitmap or not. This is used by the native/web saving code to see if the bitmap is the default one and if so save a reference to it.
BOOL HasBeenDeleted ()
 Tests whether or not the OIL bitmap attached to the kernel bitmap class has been deleted.
BOOL IsGreyscale ()
 Finds if this bitmap is greyscale or not.
BOOL IsLossy ()
 Finds if this bitmap is lossy or not.
void SetOriginalSource (BitmapSource *pFileBuffer=NULL, BaseBitmapFilter *pImportFilter=NULL)
 Sets the original bitmap file associated with this reference.
BOOL GetOriginalSource (BitmapSource **ppFileBuffer=NULL, BaseBitmapFilter **ppImportFilter=NULL)
 Gets the original bitmap file buffer associated with this reference.
BOOL CreateGreyscaleVersion (BOOL ForceGreyBmp=FALSE)
 Creates a greyscale version of this bitmap.
BOOL DestroyGreyscaleVersion ()
 Destroys the greyscale version of this bitmap.
OILBitmapGetGreyscaleVersion (BOOL ForceGreyBmp=FALSE)
 Gets the greyscale version of this bitmap.
OILBitmapExtractOILBitmap ()
 Extracts the OILBitmap from this kernel bitmap AND DELETES THIS KERNEL BITMAP.
void GenerateGreyscaleTable ()
 

BOOL SetAsFractal ()
 Set this bitmap as a fractal bitmap.
BOOL SetAsGreyscale ()
 Set this bitmap as a greyscale bitmap This is used to inform the bitmap that it is a greyscale 8bpp bitmap. This is because when we create a grteyscale OILBitmap and attach a KernelBitmap to it, there is no way to indicate to the system that it's a true greyscale bitmap, which is necessary to stop it farting around and making a new copy of the bitmap when someone calls GetGreyscaleVersion(). This is used by the airbrush stroke provider when it generates a greyscale bitmap for use as a transparency mask.
BOOL SetAsLossy (BOOL bLossy=TRUE)
 Set this bitmap' lossy flag.
UINT32 GetDelay ()
 Returns m_AnimDelay for an OilBitmap.
void SetDelay (UINT32 Delay)
 Sets the m_AnimDelay memeber for an OilBitmap.
BOOL GetInterpolation ()
 Returns m_bInterpolation for an OilBitmap.
void SetInterpolation (BOOL bInterpolation)
 Sets the m_bInterpolation member for an OilBitmap.
void SetAnimationRestoreType (GIFDisposalMethod Type)
 Sets the GIF restore type for an OilBitmap.
GIFDisposalMethod GetAnimationRestoreType () const
 Returns the GIF restore type for an OilBitmap.
void SetLeftOffset (UINT32 LeftOffset)
 Sets the left offset for an OilBitmap.
UINT32 GetLeftOffset () const
 Gets the left offset for an OilBitmap.
void SetTopOffset (UINT32 TopOffset)
 Sets the top offset for an OilBitmap.
UINT32 GetTopOffset () const
 Gets the top offset for an OilBitmap.
BOOL IsBrowserPalette () const
 To see if the palette attached to this bitmap is browser compatible.
BOOL ArePalettesTheSame (const LPLOGPALETTE pLogPalette, const INT32 TransColour=-1)
 To see if the palette attached to this bitmap is browser compatible. It runs through the colours in a browser palette and checks to see if they are all present. The ordering is not checked and so the palette may be different from the one that we actually use.
UINT32 GetHorizontalDPI () const
 Retrieve information on this bitmap.
UINT32 GetVerticalDPI () const
 Retrieve information on this bitmap.
void SetName (String_256 &NewName)
 Set information on this bitmap.
String_256GetName ()
 Retrieve information on this bitmap.
LPBITMAPINFO GetBitmapInfo ()
 To get at the BITMAPINFO that this bitmap may have.
LPRGBQUAD GetPaletteForBitmap ()
 To get at the RGBQUAD palette that this bitmap may have.
LPBITMAPINFOHEADER GetBitmapInfoHeader ()
 To get at the BITMAPINFOHEADER that this bitmap should have.
void SetUsedByBrush (BOOL Used)
BOOL IsUsedByBrush ()
virtual void SetXPEInfo (KernelBitmap *pMasterBitmap, IXMLDOMDocumentPtr pNewEditList)
 Sets the XPE edit list document for this bitmap.
virtual void GetXPEInfo (KernelBitmap *&refMasterBitmap, IXMLDOMDocumentPtr &refEditList, BOOL bEnsureList=FALSE)
 Gets the stored XPE information for this bitmap.
virtual BOOL IsXPEMaster ()
 Gets the XPE master status of this bitmap by searching the bitmap list.
virtual BOOL DestroyXPEInfo ()
 Aks the user whether he wants to destroy XPE info.
virtual void ReplaceOILBitmap (LPBYTE pBits, LPBITMAPINFO pInfo)
 Remove the OIL bitmap from memory if it can be constructed from master and edits.

Static Public Member Functions

static KernelBitmapMakeKernelBitmap (OILBitmap *pBitmap=NULL, Document *pDoc=NULL, BOOL bAlwaysNew=FALSE)
 Makes a KernelBitmap from an OIL bitmap. Will use an existing one if the OILBitmap is already in use in the Doc.
static void SetCreateTracker (List *pList)
static BOOL ImportBitmap (CCLexFile *pFile, BaseBitmapFilter *pBitmapFilter, BaseCamelotFilter *pFilter, BOOL IsCompressed, RGBTRIPLE *pPalette, UINT32 NumberOfPaletteEntries, KernelBitmap **ppImportedBitmap, BOOL *IsNew)
 Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.
static BOOL ImportBitmap (Filter *pFilter, const BitmapInfo *pInfo, INT32 BitmapType, KernelBitmap **, BOOL *)
 Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.
static KernelBitmapTryAndUseExistingBitmap (OILBitmap *pOILBitmap, Document *pDoc, BOOL *IsNew)
 Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.

Public Attributes

OILBitmapActualBitmap

Static Public Attributes

static Lists_pTrackerList = NULL

Protected Attributes

BitmapListm_pParentList
BOOL m_bDontDeleteActualBitmap: 1
BOOL m_bFractalAttached: 1
BOOL m_bUsedByBrush: 1

Friends

class BitmapList

Detailed Description

To encapsulate bitmaps, which are implemented in the OIL layer. Kernel code is only allowed to use this interface. OIL code is allowed to use the specific OILy functions that can be done via the OILBitmap pointer.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94

Definition at line 483 of file bitmap.h.


Constructor & Destructor Documentation

KernelBitmap::KernelBitmap OILBitmap pBitmap = NULL,
BOOL  IsTemp = FALSE
 

Constructor for kernel bitmaps. Attaches to the OILBitmap and increases its usage count.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
Parameters:
Pointer to an OIL bitmap. If NULL then uses default built-in bitmap. [INPUTS]
Returns:
Errors: -
See also:
KernelBitmap::IsOK;OILBitmap::Attach

Definition at line 294 of file bitmap.cpp.

00295 {
00296     m_pParentList = NULL;
00297     m_bDontDeleteActualBitmap = FALSE;
00298     m_bFractalAttached = FALSE;
00299     m_bUsedByBrush = FALSE;
00300     if (pBitmap == NULL)
00301         ActualBitmap = OILBitmap::Attach();
00302     else
00303         ActualBitmap = OILBitmap::Attach(pBitmap, IsTemp);
00304 
00305     if (ActualBitmap && ActualBitmap->IsAFractal())
00306         m_bFractalAttached = TRUE;
00307 }

KernelBitmap::KernelBitmap const KernelBitmap other  ) 
 

Copy constructor for kernel bitmaps. MAintains usage count on OILBitmap.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
Parameters:
Another kernel bitmap. [INPUTS]
See also:
KernelBitmap::IsOK;OILBitmap::Attach

Definition at line 390 of file bitmap.cpp.

KernelBitmap::KernelBitmap UINT32  Width,
UINT32  Height,
UINT32  Depth,
UINT32  dpi,
BOOL  bTemp = FALSE
 

Constructor for kernel bitmaps which attaches it to a blank OILbitmap. Actually, the OILBitmap isn't really blank, it is entirely uninitialised i.e its contents will be random (including its palette if it has one).

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
Parameters:
Bitmap pxiel width, height & depth and dpi setting. [INPUTS]
Returns:
Errors: Possible - SetError will be called, use IsOK for result.
See also:
KernelBitmap::IsOK;OILBitmap::Create

Definition at line 417 of file bitmap.cpp.

00418 {
00419     m_pParentList = NULL;
00420     m_bDontDeleteActualBitmap = FALSE;
00421     m_bFractalAttached = FALSE;
00422     m_bUsedByBrush = FALSE;
00423     OILBitmap *bm = OILBitmap::Create( Width, Height, Depth, dpi );
00424     if (bm)
00425         ActualBitmap = OILBitmap::Attach( bm, bTemp );
00426     else
00427         ActualBitmap = NULL;
00428 }

KernelBitmap::~KernelBitmap  ) 
 

Destructor. Detaches any current OILBitmap.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
See also:
OILBitmap::Detach

Definition at line 458 of file bitmap.cpp.

00459 {
00460     if (m_pParentList != NULL)
00461     {
00462         // If we're still in the bitmap list, then remove us
00463         m_pParentList->RemoveItem(this);
00464         m_pParentList = NULL;
00465     }
00466 
00467     if (ActualBitmap)
00468     {
00469         ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap, 
00470                         "Bitmap Error.  Found a reference to a deleted bitmap.");
00471 
00472         // JustinF says: made the above check in retail builds as well, or we'll crash!
00473         if (//(INT32) ActualBitmap->m_pColourVersion != 0xFEEEFEEE &&
00474             //(INT32) ActualBitmap->m_pColourVersion != 0xCDCDCDCD &&
00475             //(INT32) ActualBitmap->m_pColourVersion != 0xDDDDDDDD &&
00476             !m_bDontDeleteActualBitmap &&
00477             !m_bFractalAttached &&
00478             ActualBitmap->IsTemp())
00479         {
00480             delete ActualBitmap;
00481         }
00482         
00483         // AndyH says: what a load of rubbish.
00484         // ActualBitmap->m_pColourVersion never evaluates to the constants
00485         // given above in the release build. In fact bug 6712 occurs because
00486         // we try to delete a KernelBitmap whose OILBitmap has already been
00487         // deleted; in turn, this function deletes ActualBitmap (an OILBitmap)
00488         // and causes an access violation.
00489 
00490         // By removing the above 'bodge', such access violations will occur in
00491         // debug mode too, as they should.
00492 
00493         ActualBitmap = NULL;
00494     }
00495 }


Member Function Documentation

BOOL KernelBitmap::ArePalettesTheSame const LPLOGPALETTE  pLogPalette,
const INT32  TransColour = -1
 

To see if the palette attached to this bitmap is browser compatible. It runs through the colours in a browser palette and checks to see if they are all present. The ordering is not checked and so the palette may be different from the one that we actually use.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/07/97
Parameters:
pLogPalette A log palette to check the palette against [INPUTS] TransColour The transparent colour in the palette
Returns:
True if the bitmap has the same palette as the LOG palette.

Definition at line 2017 of file bitmap.cpp.

02018 {
02019     if (ActualBitmap != NULL)
02020         return ActualBitmap->ArePalettesTheSame(pLogPalette, TransColour);
02021 
02022     return FALSE;   
02023 }

void KernelBitmap::Attach BitmapList BmpList = NULL  ) 
 

Adds this kernel bitmap to the specified document bitmap list.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
The bitmap list to attach this bitmap to. [INPUTS] if NULL then the bitmap is Re-Attached to its old list.
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 1207 of file bitmap.cpp.

01208 {
01209     if (BmpList == NULL)
01210         BmpList = m_pParentList;
01211 
01212     ERROR3IF(BmpList == NULL, "Warning ... NULL BmpList in KernelBitmap::Attach");
01213     if (BmpList == NULL)    
01214         return;
01215 
01216     if (m_pParentList == NULL)
01217     {
01218         TRACEUSER( "Neville", _T("Attaching KBmp @ %x, to List at %x\n"), this, BmpList );
01219         m_pParentList = BmpList;
01220         BmpList->AddItem(this);
01221 
01222         if (KernelBitmap::s_pTrackerList)
01223         {
01224             KernelBmpListItem* pItem = new KernelBmpListItem(this);
01225             if (pItem)
01226                 KernelBitmap::s_pTrackerList->AddTail(pItem);
01227         }
01228     }
01229 
01230     ActualBitmap->RebuildXPEBitmap();
01231 }

BOOL KernelBitmap::Convert24To8 RGBTRIPLE pPalette,
UINT32  NumberOfPaletteEntries
[virtual]
 

Converts the OILbitmap from its present 24bpp form into an 8bpp form which should closely match the one that was exported.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/96
Parameters:
pPalette - pointer to the palette in RGBTIPLE format to use when converting [INPUTS] NumberOfPaletteEntries - entries in this palette
- [OUTPUTS]
Returns:
True if worked ok, False otherwise

Definition at line 735 of file bitmap.cpp.

00736 {
00737     ERROR2IF(pPalette == NULL,FALSE,"KernelBitmap::Convert24To8 null pFilter");
00738     ERROR2IF(NumberOfPaletteEntries == 0,FALSE,"KernelBitmap::Convert24To8 NumberOfPaletteEntries = 0");
00739 
00740     if (ActualBitmap == NULL)
00741         return FALSE;
00742 
00743     // If the bitmap is already 8bpp then do nothing
00744     if (GetBPP() == 8)
00745         return TRUE;
00746 
00747     return ActualBitmap->Convert24To8(pPalette, NumberOfPaletteEntries);
00748 }

BOOL KernelBitmap::CreateGreyscaleVersion BOOL  ForceGreyBmp = FALSE  ) 
 

Creates a greyscale version of this bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1597 of file bitmap.cpp.

01598 {
01599     if (ActualBitmap == NULL)
01600         return FALSE;
01601 
01602     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01603                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01604 
01605     if (!IsGreyscale())
01606     {
01607 //      if (GetBPP() == 8 && !ForceGreyBmp)
01608         if (!ForceGreyBmp)
01609         {
01610             // If the bitmap is already a paletted bitmap, then we don't
01611             // need to generate a greyscale version, 'cus we can use some
01612             // clever palette manipulation
01613             GenerateGreyscaleTable();
01614         }
01615         else
01616         {
01617             // Make a new grey level version of the bitmap
01618             OILBitmap* pOILBmp = DIBUtil::Create8bppGreyscaleBitmap(this);
01619             if (pOILBmp == NULL)
01620                 return FALSE;
01621 
01622             pOILBmp->m_bIsGreyscale = TRUE;
01623             ActualBitmap->SetGreyscaleVersion(pOILBmp);
01624         }
01625     }
01626 
01627     return TRUE;
01628 }

BOOL KernelBitmap::DestroyGreyscaleVersion  ) 
 

Destroys the greyscale version of this bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1640 of file bitmap.cpp.

01641 {
01642     if (ActualBitmap == NULL)
01643         return FALSE;
01644 
01645     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01646                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01647 
01648     return ActualBitmap->DestroyGreyscaleVersion();
01649 }

BOOL KernelBitmap::DestroyXPEInfo  )  [virtual]
 

Aks the user whether he wants to destroy XPE info.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/01/2004
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this bitmap has no XPE info or the user agreed it could be destroyed FALSE otherwise

Definition at line 1530 of file bitmap.cpp.

01531 {
01532     if (ActualBitmap==NULL)
01533         return TRUE;
01534 
01535     PORTNOTETRACE("other","KernelBitmap::DestroyXPEInfo - do nothing");
01536 #ifndef EXCLUDE_FROM_XARALX
01537     IXMLDOMDocumentPtr pEdits = NULL;
01538     OILBitmap* pMaster = NULL;
01539     ActualBitmap->GetXPEInfo(pMaster, pEdits);
01540 
01541     if (pEdits==NULL || pMaster==NULL)
01542         return TRUE;
01543 
01544     INT32 iButton = InformWarning(_R(IDS_XPE_DESTROY_MSG), _R(IDS_CONTINUE), _R(IDS_CANCEL));
01545     if (iButton==1)
01546     {
01547         ActualBitmap->DestroyXPEInfo();
01548     }
01549     return (iButton==1);
01550 #else
01551     return TRUE;
01552 #endif
01553 }

void KernelBitmap::Detach  ) 
 

Removes this kernel bitmap from it's current document bitmap list.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Errors: -
See also:
-

Definition at line 1247 of file bitmap.cpp.

01248 {
01249     // For each document
01250     // If bitmap is used in document
01251     // Go though all the documents
01252     Document* pDoc = (Document*)GetApplication()->Documents.GetHead();
01253     while (pDoc != NULL)
01254     {
01255         if (ActualBitmap->IsUsedInDocument(pDoc))
01256         return;
01257 
01258         // Move onto the next document
01259         pDoc = (Document*)GetApplication()->Documents.GetNext(pDoc);
01260     }
01261 
01262     // If we got here then the bitmap is not used in any document
01263     // so we can safely vape its data if we can later rebuild it
01264     ActualBitmap->RemoveXPEBitmap();
01265 }

OILBitmap * KernelBitmap::ExtractOILBitmap  ) 
 

Extracts the OILBitmap from this kernel bitmap AND DELETES THIS KERNEL BITMAP.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1662 of file bitmap.cpp.

01663 {
01664     if (ActualBitmap == NULL)
01665         return NULL;
01666 
01667     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01668                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01669 
01670     OILBitmap* pBmp = ActualBitmap;
01671 
01672     if (ActualBitmap->IsInGlobalList())
01673         ActualBitmap->RemoveFromGlobalList();
01674 
01675 #ifdef _DEBUG
01676     ActualBitmap->m_bIsAttached = FALSE;
01677 #endif
01678 
01679     m_bDontDeleteActualBitmap = TRUE;
01680     delete this;
01681 
01682     return pBmp;
01683 }

void KernelBitmap::GenerateGreyscaleTable  ) 
 

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1726 of file bitmap.cpp.

01727 {
01728 //  if (ActualBitmap == NULL || GetBPP() != 8)
01729     if (ActualBitmap == NULL || GetBPP()>8)
01730         return;
01731 
01732     ActualBitmap->GenerateGreyscaleTable();
01733 }

OILBitmap* KernelBitmap::GetActualBitmap  )  const [inline]
 

Definition at line 508 of file bitmap.h.

00508 { return ActualBitmap; }

GIFDisposalMethod KernelBitmap::GetAnimationRestoreType  )  const
 

Returns the GIF restore type for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/04/97

Definition at line 1885 of file bitmap.cpp.

01886 {
01887     if (ActualBitmap != NULL)
01888         return ActualBitmap->GetAnimationRestoreType();
01889 
01890     return GDM_LEAVE;   
01891 }

ADDR KernelBitmap::GetBitmapBits  )  const
 

Helper function to get the actual bits (as in Bitmap).

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/11/96
Returns:
The address of the bits of this KernelBitmap NULL if an error occurred

Errors: Checks runtime class

Definition at line 1177 of file bitmap.cpp.

01178 {
01179     OILBitmap* pOILy = GetActualBitmap();
01180     if (pOILy == NULL)
01181     {
01182         TRACE( _T("KernelBitmap::GetBitmapBits() - no OILBitmap") );
01183         return NULL;
01184     }
01185 
01186     ERROR3IF(!pOILy->IS_KIND_OF(OILBitmap), "pOILy isn't");
01187     
01188     return pOILy->GetBitmapBits();
01189 }

LPBITMAPINFO KernelBitmap::GetBitmapInfo  ) 
 

To get at the BITMAPINFO that this bitmap may have.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/07/97
Returns:
The BITMAPINFO for this bitmap or null.
BITMAPINFO consists of:- BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; This is the real bitmap info header giving the overall size of the export

Note: Only use from Winoil code

Definition at line 2131 of file bitmap.cpp.

02132 {
02133     if (ActualBitmap != NULL)
02134         return ActualBitmap->GetBitmapInfo();
02135 
02136     return NULL;
02137 }

LPBITMAPINFOHEADER KernelBitmap::GetBitmapInfoHeader  ) 
 

To get at the BITMAPINFOHEADER that this bitmap should have.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/07/97
Returns:
The bitmap header for this bitmap or null.
BITMAPINFO consists of:- BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1];

Note: Only use from Winoil code

Definition at line 2182 of file bitmap.cpp.

02183 {
02184     if (ActualBitmap != NULL)
02185         return ActualBitmap->GetBitmapInfoHeader();
02186 
02187     return NULL;
02188 }

UINT32 KernelBitmap::GetBPP  ) 
 

Finds the colour resolution of this bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/1/95
Returns:
The number of Bits per pixel of this bitmap

Errors: -

See also:
-

Definition at line 1280 of file bitmap.cpp.

01281 {
01282     if (ActualBitmap == NULL)
01283         return 0;
01284 
01285     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,"Bitmap Error.  Found a reference to a deleted bitmap.");
01286 
01287     return ActualBitmap->GetBPP();
01288 }

UINT32 KernelBitmap::GetDelay  ) 
 

Returns m_AnimDelay for an OilBitmap.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/01/96

Definition at line 1818 of file bitmap.cpp.

01819 {
01820     if (ActualBitmap != NULL)
01821         return ActualBitmap->GetBitmapAnimDelay();
01822 
01823     return 0;   
01824 }

OILBitmap * KernelBitmap::GetGreyscaleVersion BOOL  ForceGreyBmp = FALSE  ) 
 

Gets the greyscale version of this bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1695 of file bitmap.cpp.

01696 {
01697     if (ActualBitmap == NULL)
01698         return NULL;
01699 
01700     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01701                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01702 
01703     if (IsGreyscale())
01704         return ActualBitmap;
01705 
01706     OILBitmap* pGreyBmp = ActualBitmap->GetGreyscaleVersion();
01707     if (pGreyBmp == NULL)
01708     {
01709         // Make a greyscale bitmap
01710         CreateGreyscaleVersion(ForceGreyBmp);
01711     }
01712 
01713     return ActualBitmap->GetGreyscaleVersion();
01714 }

UINT32 KernelBitmap::GetHeight  )  const
 

Finds the height of this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/97
Returns:
The height of this bitmap

Definition at line 1320 of file bitmap.cpp.

01321 {
01322     if (ActualBitmap == NULL)
01323         return 0;
01324 
01325     return ActualBitmap->GetHeight();
01326 }

UINT32 KernelBitmap::GetHorizontalDPI  )  const
 

Retrieve information on this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/06/97
Returns:
The Horizontal DPI of this bitmap

Definition at line 2036 of file bitmap.cpp.

02037 {
02038     if (ActualBitmap != NULL)
02039         return ActualBitmap->GetHorizontalDPI();
02040 
02041     return 96;  
02042 }

BOOL KernelBitmap::GetInterpolation  ) 
 

Returns m_bInterpolation for an OilBitmap.

Author:
Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/10/00

Definition at line 1851 of file bitmap.cpp.

01852 {
01853     if (ActualBitmap != NULL)
01854         return ActualBitmap->GetInterpolation();
01855 
01856     return 0;   
01857 }

UINT32 KernelBitmap::GetLeftOffset  )  const
 

Gets the left offset for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/06/97
Returns:
the current left offset

Definition at line 1938 of file bitmap.cpp.

01939 {
01940     if (ActualBitmap != NULL)
01941         return ActualBitmap->GetLeftOffset();
01942 
01943     return 0;   
01944 }

String_256 & KernelBitmap::GetName  ) 
 

Retrieve information on this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/06/97
Returns:
The name of this bitmap

Definition at line 2096 of file bitmap.cpp.

02097 {
02098     if (ActualBitmap != NULL)
02099         return ActualBitmap->GetName();
02100 
02101 
02102     // In the "oh no where's the ActualBitmap" case
02103     // The old code used to be:
02104     //      return String_256("");
02105     // This static dummy object is used for returning in the error case
02106     // The original used to return a ptr to a local variable, which is a tad dangerous.
02107     // This solution is not ideal, because there's a permanent instance of an object
02108     // that will probably never be used.
02109     static String_256 Dummy("");
02110     return Dummy;
02111 }   

UINT32 KernelBitmap::GetNumPaletteEntries  )  const
 

Finds the number of colours colour in this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/97
Returns:
The number of palette entries of this bitmap

Definition at line 1339 of file bitmap.cpp.

01340 {
01341     if (ActualBitmap == NULL)
01342         return 0;
01343 
01344     return ActualBitmap->GetNumPaletteEntries();
01345 }

BOOL KernelBitmap::GetOriginalSource BitmapSource **  pSource = NULL,
BaseBitmapFilter **  ppImportFilter = NULL
 

Gets the original bitmap file buffer associated with this reference.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Parameters:
pSource,ptr to a void ptr to update to point at the original BitmapSource [INPUTS] ppFilterName, ptr to a BaseBitmapFilter ptr to update to point at the filter to use to decode the bitmap
If both these inputs are NULL, then the function will simply return whether an original file exists or not.

Parameters:
The input pointers are set if an original file is available, otherwise they [OUTPUTS] are left unchanged.
Returns:
TRUE, if an original file is available, and the pointers were set if non NULL. FALSE, if no orginal files is available.

Definition at line 1399 of file bitmap.cpp.

01400 {
01401     if (ActualBitmap == NULL)
01402         return FALSE;
01403 
01404     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01405                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01406 
01407     // The OILBitmap has the reference in it
01408     return ActualBitmap->GetOriginalSource(pSource, ppImportFilter);
01409 }

LPRGBQUAD KernelBitmap::GetPaletteForBitmap  ) 
 

To get at the RGBQUAD palette that this bitmap may have.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
03/07/97
Returns:
The palette for this bitmap or null.
BITMAPINFO consists of:- BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[1]; This is the real bitmap info header giving the overall size of the export

Note: Only use from Winoil code

Definition at line 2157 of file bitmap.cpp.

02158 {
02159     if (ActualBitmap != NULL)
02160         return ActualBitmap->GetPaletteForBitmap();
02161 
02162     return NULL;
02163 }

BitmapList* KernelBitmap::GetParentBitmapList  )  [inline]
 

Definition at line 538 of file bitmap.h.

00538 { return m_pParentList; }

INT32 KernelBitmap::GetRecommendedHeight  ) 
 

Finds the recommended height of the bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Returns:
The current recommended height of the bitmap in Millipoints

Definition at line 1118 of file bitmap.cpp.

01119 {
01120     INT32 Height = 0;
01121 
01122     if (ActualBitmap)
01123     {
01124         Height = ActualBitmap->GetRecommendedHeight();
01125     }
01126 
01127     return Height;
01128 }

INT32 KernelBitmap::GetRecommendedWidth  ) 
 

Finds the recommended width of the bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Returns:
The current recommended width of the bitmap in Millipoints

Definition at line 1095 of file bitmap.cpp.

01096 {
01097     INT32 Width = 0;
01098 
01099     if (ActualBitmap)
01100     {
01101         Width = ActualBitmap->GetRecommendedWidth();
01102     }
01103 
01104     return Width;
01105 }

UINT32 KernelBitmap::GetTopOffset  )  const
 

Gets the top offset for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/06/97
Returns:
the current top offset

Definition at line 1974 of file bitmap.cpp.

01975 {
01976     if (ActualBitmap != NULL)
01977         return ActualBitmap->GetTopOffset();
01978 
01979     return 0;   
01980 }

BOOL KernelBitmap::GetTransparencyIndex INT32 *  pIndex  ) 
 

Finds the Transparent index colour of a bitmap if one exists.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/6/96
Returns:
TRUE if the Index was set, FALSE if there is no transparent index

Definition at line 1047 of file bitmap.cpp.

01048 {
01049     if (ActualBitmap == NULL)
01050         return FALSE;
01051 
01052     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01053                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01054 
01055     if (ActualBitmap->GetBPP() > 8)
01056         return FALSE;
01057 
01058     return ActualBitmap->GetTransparencyIndex(pIndex);
01059 }

UINT32 KernelBitmap::GetVerticalDPI  )  const
 

Retrieve information on this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/06/97
Returns:
The Vertical DPI of this bitmap

Definition at line 2055 of file bitmap.cpp.

02056 {
02057     if (ActualBitmap != NULL)
02058         return ActualBitmap->GetVerticalDPI();
02059 
02060     return 96;  
02061 }

UINT32 KernelBitmap::GetWidth  )  const
 

Finds the width of this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/97
Returns:
The width of this bitmap

Definition at line 1301 of file bitmap.cpp.

01302 {
01303     if (ActualBitmap == NULL)
01304         return 0;
01305 
01306     return ActualBitmap->GetWidth();
01307 }

void KernelBitmap::GetXPEInfo KernelBitmap *&  refMasterBitmap,
IXMLDOMDocumentPtr &  refEditList,
BOOL  bEnsureList = FALSE
[virtual]
 

Gets the stored XPE information for this bitmap.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/2004
Parameters:
- [INPUTS]
Updates the passed-in reference variables!!! [OUTPUTS] refMasterBitmap updated to contain pointer to the master bitmap for this bitmap refEditList updated to contain pointer the edits list for this bitmap NOTE: I'd prefer to use pointers but there are problems with IXMLDOMDocument2Ptr*
Returns:
Pointer to XML document containing edit list for this bitmap.

Definition at line 1458 of file bitmap.cpp.

01461 {
01462     if (ActualBitmap)
01463     {
01464         OILBitmap* pMasterOil = NULL;
01465         ActualBitmap->GetXPEInfo(pMasterOil, refEditList, bEnsureList);
01466         BitmapList* pBitmapList = m_pParentList;
01467         if (pBitmapList==NULL)
01468         {
01469             Document* pDoc = Document::GetCurrent();
01470             if (pDoc)
01471                 pBitmapList = pDoc->GetBitmapList();
01472         }
01473 
01474         if (pMasterOil && pBitmapList)
01475         {
01476             KernelBitmap* pBmp = (KernelBitmap*)pBitmapList->GetHead();
01477 
01478             // Scan through the Documents bitmap list to see if any of
01479             // the existing KernelBitmaps reference this OILBitmap.
01480             while (pBmp != NULL)
01481             {
01482                 if (pBmp->ActualBitmap == pMasterOil)
01483                 {
01484                     refMasterBitmap = pBmp;
01485                     break;
01486                 }
01487 
01488                 pBmp = (KernelBitmap*)pBitmapList->GetNext(pBmp);
01489             }
01490         }
01491     }
01492 }

BOOL KernelBitmap::HasBeenDeleted  ) 
 

Tests whether or not the OIL bitmap attached to the kernel bitmap class has been deleted.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/96
Returns:
TRUE - The bitmap has already been deleted. FALSE - The bitmap hasn't been deleted.

Definition at line 672 of file bitmap.cpp.

00673 {
00674     // This test is far better done BEFORE the ERROR3!
00675     // Graeme (21/6/00) - Added a test to see whether the pointer points at 0xdddddddd, as
00676     // this is the value that the memory is (re)set to by delete.
00677     // Luke (31/10/05) - Removed these tests, since I'd rather this excepts rather than
00678     // perform a dodgy read on some memory that may be returned to OS (or used for something 
00679     // else)
00680     if( ActualBitmap == NULL )
00681     {
00682         return TRUE;
00683     }
00684     else
00685     {
00686         ERROR3IF_OILBMP_PTR_INVALID ( ActualBitmap,
00687                 "Bitmap Error. Found a reference to a deleted bitmap." );
00688 
00689         return ActualBitmap->HasBeenDeleted ();
00690     }
00691 }

BOOL KernelBitmap::ImportBitmap Filter pFilter,
const BitmapInfo pInfo,
INT32  BitmapType,
KernelBitmap **  ppImportedBitmap,
BOOL *  IsNew
[static]
 

Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/95
Parameters:
pFilter,The filter to use for importing the bitmap. [INPUTS] pInfo, Optional bitmap info to use to create the bitmap IsNew, if NULL then no check will be made to see if the imported bitmap already exists in the filter's associated document. A check for the OILBitmap will always be made.
*ppImportedBitmap,updated to point at new or existing bitmap. [OUTPUTS] IsNew = TRUE, if a new bitmap was created, or FALSE, if an existing one has been returned.
Returns:
Errors: -
See also:
OILBitmap::ImportBitmap

Definition at line 870 of file bitmap.cpp.

00872 {
00873     ERROR2IF(pFilter == NULL,FALSE,"KernelBitmap::ImportBitmap null pFilter");
00874     ERROR2IF(ppImportedBitmap == NULL,FALSE,"KernelBitmap::ImportBitmap null ppImportedBitmap");
00875 
00876     *ppImportedBitmap = NULL;
00877     if (IsNew)
00878         *IsNew = TRUE;
00879 
00880     // Get a new bitmap object for this node.
00881     OILBitmap *pOILBitmap = OILBitmap::Create();
00882     if (pOILBitmap == NULL)
00883     {
00884         return FALSE;
00885     }
00886 
00887     if (!pOILBitmap->ImportBitmap(pFilter, pInfo, BitmapType))
00888     {
00889         delete pOILBitmap;
00890         return FALSE;
00891     }
00892 
00893     // Now check to see if this bitmap already exists if necessary....
00894     Document* ImportDoc = ((Filter*)pFilter)->GetDocument();
00895     if (ImportDoc == NULL)
00896         ImportDoc = Document::GetSelected();
00897 
00898     if (ImportDoc == NULL)
00899     {
00900 //      delete pOILBitmap;
00901 //      return FALSE;
00902 //  }
00903         // no document, so don't try to re-use any existing bitmaps
00904         *ppImportedBitmap = TryAndUseExistingBitmap(pOILBitmap, NULL, NULL);
00905     }
00906     else
00907     {
00908         // The bitmap system relies on the Current Doc being correct,
00909         // so we'll set it to be on the safe side
00910         ImportDoc->SetCurrent();
00911 
00912         // Is there an existing KernelBitmap already in the bitmap list ?
00913         *ppImportedBitmap = TryAndUseExistingBitmap(pOILBitmap, ImportDoc, IsNew);
00914     }
00915 
00916     return (*ppImportedBitmap != NULL);
00917 }

BOOL KernelBitmap::ImportBitmap CCLexFile pFile,
BaseBitmapFilter pBitmapFilter,
BaseCamelotFilter pFilter,
BOOL  IsCompressed,
RGBTRIPLE pPalette,
UINT32  NumberOfPaletteEntries,
KernelBitmap **  ppImportedBitmap,
BOOL *  IsNew
[static]
 

Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/6/96
Parameters:
pFile - The file to read the data from [INPUTS] pBitmapFilter - The bitmap filter to use for importing the bitmap. pFilter - The BaseCamelotFilter which provides functions for things like progress bar updates. IsCompressed - Flag to say the bitmap is compressed or not. pPalette - If non-null then palette to convert the 24bpp bitmap into an 8bpp bitmap NumberOfPaletteEntries - Is the number of entries in the above palette
*ppImportedBitmap - updated to point at new or existing bitmap. [OUTPUTS] IsNew = TRUE - if a new bitmap was created, or FALSE - if an existing one has been returned.
This is used web/native filters to pull out a bitmap definition from inside a bitmap definition record. IsCompressed is only used for BMP/BMPZIP type bitmaps, at present.

Assumes: pFile has already been opened up for reading pFilter has been set up for reading the data e.g. progress bar

Returns:
Errors: -
See also:
OILBitmap::ImportBitmap

Definition at line 784 of file bitmap.cpp.

00788 {
00789     ERROR2IF(pFile == NULL,FALSE,"KernelBitmap::ImportBitmap null pFile");
00790     ERROR2IF(pBitmapFilter == NULL,FALSE,"KernelBitmap::ImportBitmap null pBitmapFilter");
00791     ERROR2IF(pFilter == NULL,FALSE,"KernelBitmap::ImportBitmap null pFilter");
00792     ERROR2IF(ppImportedBitmap == NULL,FALSE,"KernelBitmap::ImportBitmap null ppImportedBitmap");
00793 
00794     *ppImportedBitmap = NULL;
00795     
00796     if (IsNew)
00797         *IsNew = TRUE;
00798 
00799     // Get a new bitmap object to import into
00800     OILBitmap *pOILBitmap = OILBitmap::Create();
00801     if (pOILBitmap == NULL)
00802     {
00803         return FALSE;
00804     }
00805 
00806     // Import the bitmap data
00807     if (!pOILBitmap->ImportBitmap(pFile, pBitmapFilter, pFilter, IsCompressed))
00808     {
00809         delete pOILBitmap;
00810         return FALSE;
00811     }
00812 
00813     // Check if a palette has been supplied, if so then it is a JPEG which started out
00814     // as 8bpp colour but has been converted to 24bpp so that it can be JPEGed.
00815     // If this is the case then the palette is the one from the original bitmap. So use
00816     // it to go and convert the data back into the 8bpp data.
00817     if (pPalette && NumberOfPaletteEntries > 0 && NumberOfPaletteEntries <= 256)
00818     {   
00819         // If the loaded bitmap is not 24bpp then do nothing
00820         if (pOILBitmap->GetBPP() == 24)
00821             pOILBitmap->Convert24To8(pPalette, NumberOfPaletteEntries);
00822         // If a problem has happened then we will forget the conversion and use the
00823         // 24 bpp version
00824     }
00825 
00826     // Now check to see if this bitmap already exists ....
00827     Document* ImportDoc = ((Filter*)pFilter)->GetDocument();
00828     if (ImportDoc == NULL)
00829         ImportDoc = Document::GetSelected();
00830 
00831     if (ImportDoc == NULL)
00832     {
00833         delete pOILBitmap;
00834         return FALSE;
00835     }
00836 
00837     // The bitmap system relies on the Current Doc being correct,
00838     // so we'll set it to be on the safe side
00839     ImportDoc->SetCurrent();
00840 
00841     // Is there an existing KernelBitmap already in the bitmap list ?
00842     *ppImportedBitmap = TryAndUseExistingBitmap(pOILBitmap, ImportDoc, IsNew);
00843 
00844     return (*ppImportedBitmap != NULL);
00845 }

BOOL KernelBitmap::IsBrowserPalette  )  const
 

To see if the palette attached to this bitmap is browser compatible.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/06/97
Returns:
True if the bitmap has a browser compatible palette.

Definition at line 1993 of file bitmap.cpp.

01994 {
01995     if (ActualBitmap != NULL)
01996         return ActualBitmap->IsBrowserPalette();
01997 
01998     return FALSE;   
01999 }

BOOL KernelBitmap::IsDefaultBitmap  ) 
 

To find out if the bitmap is the default bitmap or not. This is used by the native/web saving code to see if the bitmap is the default one and if so save a reference to it.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/96
Returns:
TRUE if KernelBitmap is the default bitmap, FALSE if not.
See also:

Definition at line 640 of file bitmap.cpp.

00641 {
00642     if (ActualBitmap == NULL)
00643         return FALSE;
00644 
00645     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
00646                 "Bitmap Error.  Found a reference to a deleted bitmap.");
00647 
00648     // Treat as the default bitmap, if we've been deleted
00649     if (HasBeenDeleted())
00650         return TRUE;
00651 
00652     // Check to see if its the default bitmap
00653     if (ActualBitmap == OILBitmap::Default)
00654         return TRUE;
00655 
00656     return FALSE;
00657 }

BOOL KernelBitmap::IsGreyscale  ) 
 

Finds if this bitmap is greyscale or not.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1769 of file bitmap.cpp.

01770 {
01771     if (ActualBitmap == NULL)
01772         return FALSE;
01773 
01774     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01775                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01776 
01777     if (HasBeenDeleted())
01778         return OILBitmap::Default->IsGreyscale();
01779 
01780     return ActualBitmap->IsGreyscale();
01781 }

BOOL KernelBitmap::IsLossy  ) 
 

Finds if this bitmap is lossy or not.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1794 of file bitmap.cpp.

01795 {
01796     if (ActualBitmap == NULL)
01797         return FALSE;
01798 
01799     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01800                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01801 
01802     if (HasBeenDeleted())
01803         return OILBitmap::Default->IsLossy();
01804 
01805     return ActualBitmap->IsLossy();
01806 }

BOOL KernelBitmap::IsOK  )  const
 

Tell if KernelBitmap is OK.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
Returns:
TRUE if KernelBitmap has a valid attached OILBitmap, FALSE if it doesn't (e.g. its constructor failed).

Definition at line 442 of file bitmap.cpp.

00443 {
00444     return ActualBitmap ? TRUE : FALSE;
00445 }

BOOL KernelBitmap::IsTransparent  ) 
 

Determines if a bitmap is not totally opaque.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/03/2004
Returns:
TRUE if the bitmap has any non-opaque pixels

Definition at line 1072 of file bitmap.cpp.

01073 {
01074     if (ActualBitmap == NULL)
01075         return FALSE;
01076 
01077     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01078                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01079 
01080     return ActualBitmap->IsTransparent();
01081 }

BOOL KernelBitmap::IsUsedByBrush  )  [inline]
 

Definition at line 608 of file bitmap.h.

00608 { return m_bUsedByBrush;}

BOOL KernelBitmap::IsUsedInDocument Document pDoc,
BOOL  bIncludeHidden = FALSE
 

Finds if this bitmap is being used in a specified document or not.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/8/96

Definition at line 1745 of file bitmap.cpp.

01746 {
01747     if (ActualBitmap == NULL)
01748         return FALSE;
01749 
01750     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01751                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01752 
01753     if (HasBeenDeleted())
01754         return OILBitmap::Default->IsUsedInDocument(pDoc, bIncludeHidden);
01755 
01756     return ActualBitmap->IsUsedInDocument(pDoc, bIncludeHidden) || IsXPEMaster();
01757 }

BOOL KernelBitmap::IsXPEMaster  )  [virtual]
 

Gets the XPE master status of this bitmap by searching the bitmap list.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/2004
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this bitmap is a used as a master by other bitmaps in the same list

Definition at line 1508 of file bitmap.cpp.

01509 {
01510     if (ActualBitmap)
01511         return ActualBitmap->IsXPEMaster();
01512     return FALSE;
01513 }

KernelBitmap * KernelBitmap::MakeKernelBitmap OILBitmap pBitmap = NULL,
Document pDoc = NULL,
BOOL  bAlwaysNew = FALSE
[static]
 

Makes a KernelBitmap from an OIL bitmap. Will use an existing one if the OILBitmap is already in use in the Doc.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/1/95
Parameters:
Pointer to an OIL bitmap. If NULL then uses default built-in bitmap. [INPUTS] Pointer to the Document the bitmap is use in (NULL = Current).
Returns:
Errors: -
See also:
KernelBitmap::IsOK;OILBitmap::Attach

Definition at line 326 of file bitmap.cpp.

00327 {
00328     KernelBitmap* NewBitmap;
00329 
00330     if (pBitmap == NULL)
00331         pBitmap = OILBitmap::Default;
00332 
00333     if (pDoc == NULL)
00334         pDoc = Document::GetCurrent();
00335 
00336     // Get the bitmap list from the document
00337     BitmapList* BmpList = NULL;
00338     if (pDoc) BmpList = pDoc->GetBitmapList();
00339 
00340     if (BmpList == NULL)
00341     {
00342         // This shouldn't really happen ...
00343         NewBitmap = new KernelBitmap(pBitmap);
00344         return NewBitmap;
00345     }
00346 
00347     KernelBitmap* Bmp = (KernelBitmap*)BmpList->GetHead();
00348     BOOL Exists = FALSE;
00349 
00350     // Scan through the Documents bitmap list to see if any of
00351     // the existing KernelBitmaps reference this OILBitmap.
00352     while (!bAlwaysNew && Bmp != NULL)
00353     {
00354         if (Bmp->ActualBitmap == pBitmap)
00355         {
00356             Exists = TRUE;
00357             break;
00358         }
00359 
00360         Bmp = (KernelBitmap*)BmpList->GetNext(Bmp);
00361     }
00362 
00363     if (Exists)
00364     {
00365         // Use the existing KernelBitmap.
00366         NewBitmap = Bmp;
00367     }
00368     else
00369     {
00370         // Make a new KernelBitmap.
00371         NewBitmap = new KernelBitmap(pBitmap);
00372     }   
00373 
00374     return NewBitmap;
00375 }

KernelBitmap & KernelBitmap::operator= const KernelBitmap other  ) 
 

Assigns one KernelBitmap to another while maintaining usage count on OILBitmap.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
?/8/94
Parameters:
Another kernel bitmap. [INPUTS]

Definition at line 508 of file bitmap.cpp.

00509 {
00510     if (other.ActualBitmap == NULL)
00511         ActualBitmap = OILBitmap::Attach( NULL );
00512     else
00513         ActualBitmap = OILBitmap::Attach( other.ActualBitmap, other.ActualBitmap->IsTemp() );
00514 
00515     if (ActualBitmap && ActualBitmap->IsAFractal())
00516         m_bFractalAttached = TRUE;
00517     
00518     return *this;
00519 }

INT32 KernelBitmap::operator== const KernelBitmap  ) 
 

void KernelBitmap::PlotPixel INT32  x,
INT32  y,
PixelGreyscale  NewValue
[inline]
 

Plots an 8bpp (0..255) pixel to any type of bitmap The pixel is taken to be a greyscale, and is truncated or expanded as appropriate to fit the greyscale value into the destination bitmap pixel format.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/7/96
Parameters:
x,y - coordinates within the bitmap of the pixel to plot [INPUTS] NewValue - an 8bpp pixel value, presumed to be a greyscale.
(changes attached oil bitmap) [OUTPUTS]
Returns:
Nothing
Notes: In debug builds, will check all kinds of stuff, but in release builds, it assumes that you are providing legal offsets in the bitmap, and are only using this call where it will work - this is to reduce retail overhead on each pixel operation.

See also:
OILBitmap::PlotPixel

Definition at line 756 of file bitmap.h.

00757 {
00758     ERROR3IF(ActualBitmap == NULL, "PlotPixel with no bitmap!");
00759     ActualBitmap->PlotPixel(x, y, NewValue);
00760 }

void KernelBitmap::PlotPixel INT32  x,
INT32  y,
Pixel32bpp  NewValue
[inline]
 

Plots a 32bpp pixel to a deep bitmap (16, 24, or 32bpp).

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com> (Jason)
Date:
13/9/94 (3/7/96)
Parameters:
x,y - coordinates within the bitmap of the pixel to plot [INPUTS] NewValue - a 32bpp pixel value.
(changes attached oil bitmap) [OUTPUTS]
Returns:
Nothing
Notes: In debug builds, will check all kinds of stuff, but in release builds, it assumes that you are providing legal offsets in the bitmap, and are only using this call where it will work - this is to reduce retail overhead on each pixel operation.

Returns:
Errors: ERROR3 if the bitmap is not 16, 24, or 32bpp
See also:
OILBitmap::PlotPixel

Definition at line 722 of file bitmap.h.

00723 {
00724     ERROR3IF(ActualBitmap == NULL, "PlotPixel with no bitmap!");
00725     ActualBitmap->PlotPixel(x, y, NewValue);
00726 }

Pixel32bpp KernelBitmap::ReadPixel32bpp INT32  x,
INT32  y,
BOOL  UsePalette = TRUE
const [inline]
 

reads a pixel

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com> (Jason)
Date:
13/9/94 (3/7/96)
Parameters:
x,y - coordinates of the pixel to read [INPUTS] UsePalette -Ignored for deep bitmaps For <=8bpp bitmaps, if this value is: FALSE, the bitmap's palette will be ignored, and the actual pixel (palette index) value will be returned as a greyscale RGB value TRUE, the pixel index value will be used to retrieve the 24bpp palette entry for the pixel, if a palette is available.
(changes attached oil bitmap) [OUTPUTS]
Returns:
The pixel value of the given pixel
Notes: In debug builds, will check all kinds of stuff, but in release builds, it assumes that you are providing legal offsets in the bitmap, and are only using this call where it will work - this is to reduce retail overhead on each pixel operation.

Returns:
Errors: -
See also:
OILBitmap::ReadPixel32bpp

Definition at line 793 of file bitmap.h.

00794 {
00795     ERROR3IF(ActualBitmap == NULL, "PlotPixel with no bitmap!");
00796     return(ActualBitmap->ReadPixel32bpp(x, y));
00797 }

PixelGreyscale KernelBitmap::ReadPixelGreyscale INT32  x,
INT32  y
const [inline]
 

Reads a pixel as a greyscale intensity value (0..255).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/7/96
Parameters:
x,y - coordinates of the pixel to read [INPUTS]
(changes attached oil bitmap) [OUTPUTS]
Returns:
The pixel value of the given pixel
Notes: When reading a pixel from <8bpp bitmaps, the pixel value will be assumed to be a greyscale, and will be expanded up to 8bpp. When reading a pixel from a deep bitmap, the RGB value will be converted into a greyscale intensity value.

In debug builds, will check all kinds of stuff, but in release builds, it assumes that you are providing legal offsets in the bitmap, and are only using this call where it will work - this is to reduce retail overhead on each pixel operation.

Returns:
Errors: -
See also:
OILBitmap::ReadPixelGreyscale

Definition at line 836 of file bitmap.h.

00837 {
00838     ERROR3IF(ActualBitmap == NULL, "PlotPixel with no bitmap!");
00839     return(ActualBitmap->ReadPixelGreyscale(x, y));
00840 }

void KernelBitmap::ReplaceOILBitmap LPBYTE  pBits,
LPBITMAPINFO  pInfo
[virtual]
 

Remove the OIL bitmap from memory if it can be constructed from master and edits.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/02/2004
Parameters:
pBits - pointer to bitmap data [INPUTS] pInfo - pointer to bitmap info header
- [OUTPUTS]
Returns:
-

Definition at line 1570 of file bitmap.cpp.

01571 {
01572     if (IsDefaultBitmap())
01573     {
01574         // We can't replace the default bitmap so make a new OilBitmap and attach that
01575         CWxBitmap      *pOilBitmap = new CWxBitmap(pInfo, pBits);
01576         if (pOilBitmap && IsLossy())
01577             pOilBitmap->SetAsLossy();
01578         ActualBitmap = OILBitmap::Attach(pOilBitmap);
01579     }
01580     else
01581     {
01582         ActualBitmap->ReplaceBitmap(pBits, pInfo);
01583     }
01584 }

INT32 KernelBitmap::ReturnPaletteIndexUsed INT32  x,
INT32  y
const [inline]
 

Definition at line 801 of file bitmap.h.

00802 {
00803     ERROR3IF(ActualBitmap == NULL, "Can't do anything without a bitmap");
00804     return(ActualBitmap->ReturnPaletteIndexUsed(x, y));
00805 }

void KernelBitmap::SetAnimationRestoreType GIFDisposalMethod  Type  ) 
 

Sets the GIF restore type for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/04/97
Parameters:
new GIF disposal method [INPUTS]

Definition at line 1904 of file bitmap.cpp.

01905 {
01906     if (ActualBitmap != NULL)
01907         ActualBitmap->SetAnimationRestoreType(Type);
01908 }

BOOL KernelBitmap::SetAsFractal  ) 
 

Set this bitmap as a fractal bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/96
Returns:
FALSE if invalid pointer found

Definition at line 532 of file bitmap.cpp.

00533 {
00534     if (ActualBitmap == NULL)
00535         return FALSE;
00536 
00537     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
00538                 "Bitmap Error.  Found a reference to a deleted bitmap.");
00539 
00540     if (ActualBitmap)
00541     {
00542         m_bFractalAttached = TRUE;
00543         ActualBitmap->SetAsFractal();
00544     
00545         return TRUE;
00546     }
00547 
00548     return FALSE;
00549 }

BOOL KernelBitmap::SetAsGreyscale  ) 
 

Set this bitmap as a greyscale bitmap This is used to inform the bitmap that it is a greyscale 8bpp bitmap. This is because when we create a grteyscale OILBitmap and attach a KernelBitmap to it, there is no way to indicate to the system that it's a true greyscale bitmap, which is necessary to stop it farting around and making a new copy of the bitmap when someone calls GetGreyscaleVersion(). This is used by the airbrush stroke provider when it generates a greyscale bitmap for use as a transparency mask.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/2/97
Returns:
FALSE if invalid pointer found
Notes: ERROR3 will be given if the bitmap is not 8bpp. This may not be strictly necessary (who can tell with this bitmap system - it's so confusing), but for transparency masks, they must (AFAIK) be 8bpp, so it's a good safety check.

Definition at line 575 of file bitmap.cpp.

00576 {
00577     if (ActualBitmap == NULL)
00578         return FALSE;
00579 
00580     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
00581                 "Bitmap Error.  Found a reference to a deleted bitmap.");
00582 
00583     ERROR3IF(GetBPP() != 8, "SetAsGreyscale - this isn't an 8bpp bitmap - how can it be a greyscale?");
00584 
00585     if (ActualBitmap)
00586     {
00587         ActualBitmap->SetAsGreyscale();
00588         return TRUE;
00589     }
00590 
00591     return FALSE;
00592 }

BOOL KernelBitmap::SetAsLossy BOOL  bLossy = TRUE  ) 
 

Set this bitmap' lossy flag.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/2/97
Returns:
FALSE if invalid pointer found

Definition at line 608 of file bitmap.cpp.

00609 {
00610     if (ActualBitmap == NULL)
00611         return FALSE;
00612 
00613     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
00614                 "Bitmap Error.  Found a reference to a deleted bitmap.");
00615 
00616     if (ActualBitmap)
00617     {
00618         ActualBitmap->SetAsLossy(bLossy);
00619         return TRUE;
00620     }
00621 
00622     return FALSE;
00623 }

static void KernelBitmap::SetCreateTracker List pList  )  [inline, static]
 

Definition at line 499 of file bitmap.h.

00500     {
00501         s_pTrackerList = pList;
00502     }

void KernelBitmap::SetDelay UINT32  Delay  ) 
 

Sets the m_AnimDelay memeber for an OilBitmap.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
05/01/96

Definition at line 1836 of file bitmap.cpp.

01837 {
01838     if (ActualBitmap != NULL)
01839         ActualBitmap->SetBitmapAnimDelay(Delay);
01840 }

void KernelBitmap::SetInterpolation BOOL  bInterpolation  ) 
 

Sets the m_bInterpolation member for an OilBitmap.

Author:
Andy_Hills (Xara Group Ltd) <camelotdev@xara.com>
Date:
06/10/00

Definition at line 1869 of file bitmap.cpp.

01870 {
01871     if (ActualBitmap != NULL)
01872         ActualBitmap->SetInterpolation(bInterpolation);
01873 }

void KernelBitmap::SetLeftOffset UINT32  LeftOffset  ) 
 

Sets the left offset for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/06/97
Parameters:
new left offset [INPUTS]

Definition at line 1921 of file bitmap.cpp.

01922 {
01923     if (ActualBitmap != NULL)
01924         ActualBitmap->SetLeftOffset(LeftOffset);
01925 }

void KernelBitmap::SetName String_256 NewName  ) 
 

Set information on this bitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/06/97
Parameters:
The new name of this bitmap [INPUTS]

Definition at line 2074 of file bitmap.cpp.

02075 {
02076     if (ActualBitmap != NULL)
02077     {
02078         ActualBitmap->SetName(NewName);
02079         return;
02080     }
02081 
02082     return; 
02083 }

void KernelBitmap::SetOriginalSource BitmapSource pSource = NULL,
BaseBitmapFilter pImportFilter = NULL
 

Sets the original bitmap file associated with this reference.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Parameters:
pSource,a pointer to BitmapSource of the original file. [INPUTS] pImportFilter, pointer to the filter to use to decode the bitmap

Definition at line 1362 of file bitmap.cpp.

01363 {
01364     if (ActualBitmap == NULL)
01365         return;
01366 
01367     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01368                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01369 
01370     // The OILBitmap has the reference in it
01371     ActualBitmap->SetOriginalSource(pSource, pImportFilter);
01372 }

void KernelBitmap::SetRecommendedHeight INT32  NewHeight  ) 
 

Sets the recommended height of the bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Parameters:
NewHeight,the new height of the bitmap in Millipoints [INPUTS]

Definition at line 1158 of file bitmap.cpp.

01159 {
01160     if (ActualBitmap)
01161         ActualBitmap->SetRecommendedWidth(NewHeight);
01162 }

void KernelBitmap::SetRecommendedWidth INT32  NewWidth  ) 
 

Sets the recommended width of the bitmap.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/6/96
Parameters:
NewWidth,the new width of the bitmap in Millipoints [INPUTS]

Definition at line 1141 of file bitmap.cpp.

01142 {
01143     if (ActualBitmap)
01144         ActualBitmap->SetRecommendedWidth(NewWidth);
01145 }

void KernelBitmap::SetTopOffset UINT32  TopOffset  ) 
 

Sets the top offset for an OilBitmap.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/06/97
Parameters:
new top offset [INPUTS]

Definition at line 1957 of file bitmap.cpp.

01958 {
01959     if (ActualBitmap != NULL)
01960         ActualBitmap->SetTopOffset(TopOffset);
01961 }

BOOL KernelBitmap::SetTransparencyIndex INT32  Index  ) 
 

Finds the Transparent index colour of a bitmap if one exists.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/6/96
Returns:
TRUE if the Index was set, FALSE if there is no transparent index

Definition at line 1022 of file bitmap.cpp.

01023 {
01024     if (ActualBitmap == NULL)
01025         return FALSE;
01026 
01027     ERROR3IF_OILBMP_PTR_INVALID(ActualBitmap,
01028                 "Bitmap Error.  Found a reference to a deleted bitmap.");
01029 
01030     if (ActualBitmap->GetBPP() > 8)
01031         return FALSE;
01032 
01033     return ActualBitmap->SetTransparencyIndex(Index);
01034 }

void KernelBitmap::SetUsedByBrush BOOL  Used  )  [inline]
 

Definition at line 607 of file bitmap.h.

00607 { m_bUsedByBrush = Used;}

void KernelBitmap::SetXPEInfo KernelBitmap pMasterBitmap,
IXMLDOMDocumentPtr  pNewEditList
[virtual]
 

Sets the XPE edit list document for this bitmap.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/01/2004
Parameters:
pNewEditList - pointer to XML edit list document to be stored with this bitmap [INPUTS]

Definition at line 1426 of file bitmap.cpp.

01427 {
01428     if (ActualBitmap)
01429     {
01430         OILBitmap* pOilMaster = NULL;
01431         if (pMasterBitmap) pOilMaster = pMasterBitmap->GetActualBitmap();
01432         ActualBitmap->SetXPEInfo(pOilMaster, pNewEditList);
01433     }
01434 }

KernelBitmap * KernelBitmap::TryAndUseExistingBitmap OILBitmap pOILBitmap,
Document pDoc,
BOOL *  IsNew
[static]
 

Imports a bitmap, and checks to see if the bitmap already exist, returning a pointer to the existing bitmap if possible, or creates a new one.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/8/96
Parameters:
pOILBitmap,[INPUTS] pDoc, IsNew, if NULL then no check will be made to see if the imported bitmap already exists in the filter's associated document. A check for the OILBitmap will always be made.
*IsNew = TRUE, if a new bitmap was created, or [OUTPUTS] FALSE, if an existing one has been returned.
Returns:
Errors: -

Definition at line 940 of file bitmap.cpp.

00942 {
00943     // Is IsNew is NULL, then we won't try and use an existing bitmap
00944     if (IsNew != NULL)
00945     {   
00946         // Find this documents BitmapList
00947         BitmapList* pBmpList = pDoc->GetBitmapList();
00948 
00949         // Is there an existing KernelBitmap already in the bitmap list ?
00950         KernelBitmap* pExistingKBmp = pBmpList->FindDuplicateBitmap(pOILBitmap);
00951 
00952         if (pExistingKBmp)
00953         {
00954             TRACEUSER( "Neville", _T("This bitmap already exists.  Re-using existing KernelBitmap.\n") );
00955             
00956             // We'll use the one that's there already
00957             delete pOILBitmap;
00958 
00959             *IsNew = FALSE;     // We're using an existing Bitmap
00960             return pExistingKBmp;
00961         }
00962 
00963         // There is no existing version in this document,
00964         // but there might be one in another document somewhere
00965         // so we'll have a look in the global list.
00966 
00967         OILBitmap* pExistingBmp = 
00968             GetApplication()->GetGlobalBitmapList()->FindDuplicateBitmap(pOILBitmap);
00969 
00970         if (pExistingBmp)
00971         {
00972             TRACEUSER("Neville", _T("This bitmap already exists.  Re-using existing OILBitmap.\n") );
00973 
00974             // There's already an existing OIL bitmap we can use,
00975             // so we'll make a new kernel bitmap out of it ...
00976             delete pOILBitmap;
00977 
00978             KernelBitmap* KernelBmp = new KernelBitmap(pExistingBmp);
00979             if (KernelBmp == NULL)
00980             {
00981                 return NULL;
00982             }
00983 
00984             *IsNew = FALSE;     // We're using an existing Bitmap
00985 
00986             return KernelBmp;
00987         }
00988     }
00989 
00990     TRACEUSER( "Neville", _T("This is a new bitmap\n") );
00991 
00992     BOOL Temp = FALSE;
00993     if (IsNew == NULL)
00994         Temp = TRUE; // mark it as temp
00995 
00996     // We'll make a completely new bitmap then
00997     KernelBitmap* NewKernelBmp = new KernelBitmap(pOILBitmap, Temp);
00998     if (NewKernelBmp == NULL)
00999     {
01000         delete pOILBitmap;
01001         return NULL;
01002     }
01003 
01004     if (IsNew)
01005         *IsNew = TRUE;          // This is a new Bitmap
01006 
01007     return NewKernelBmp;
01008 }

BOOL KernelBitmap::WritePalette BaseCamelotFilter pFilter  )  [virtual]
 

Exports the palette out to the file using the BaseCamelotFilter supplied. This means that it is being written to a web or native file. At present, used by the code when outputting an 8bpp JPEG to squirt the palette into the record so that we can convert it back to 8bpp using the palette on loading.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/9/96
Parameters:
pFilter - The filter to use to write the data with [INPUTS]
- [OUTPUTS]
Returns:
True if saved ok, False otherwise

Definition at line 710 of file bitmap.cpp.

00711 {
00712     ERROR2IF(pFilter == NULL,FALSE,"KernelBitmap::WritePalette null pFilter");
00713 
00714     if (ActualBitmap == NULL)
00715         return FALSE;
00716 
00717     return ActualBitmap->WritePalette(pFilter);
00718 }


Friends And Related Function Documentation

friend class BitmapList [friend]
 

Definition at line 485 of file bitmap.h.


Member Data Documentation

OILBitmap* KernelBitmap::ActualBitmap
 

Definition at line 629 of file bitmap.h.

BOOL KernelBitmap::m_bDontDeleteActualBitmap [protected]
 

Definition at line 634 of file bitmap.h.

BOOL KernelBitmap::m_bFractalAttached [protected]
 

Definition at line 635 of file bitmap.h.

BOOL KernelBitmap::m_bUsedByBrush [protected]
 

Definition at line 636 of file bitmap.h.

BitmapList* KernelBitmap::m_pParentList [protected]
 

Definition at line 632 of file bitmap.h.

List * KernelBitmap::s_pTrackerList = NULL [static]
 

Definition at line 503 of file bitmap.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:39 2007 for Camelot by  doxygen 1.4.4