BitmapSource Class Reference

Objects of this class encapsulate the original source for a bitmap. Scope: public. More...

#include <bmpsrc.h>

Inheritance diagram for BitmapSource:

JPEGBitmapSource List of all members.

Public Member Functions

 BitmapSource (OFFSET Size)
 Constructor providing BitmapSource objects of the given size. We construct objects of the required size, and associate bitmaps with them via SetOriginalSource.
virtual ~BitmapSource ()
 Destructor for BitmapSource objects.
BOOL IsOK () const
 Since the constructor can fail, this member function determines whether or not it was wholly successful. Users should always call this function after constructing BitmapSource objects.
virtual BOOL GetByte (BYTE &byte)
 Allows this BitmapSource to be copied elsewhere (to disk) a byte at a time. Notes: SeekPos() should be called to reset the current position.
virtual BOOL PutByte (const BYTE byte)
 Adds a byte to this BitmapSorce object.
virtual BOOL SeekPos (OFFSET pos)
 Sets the position in the BitmapSource at which the next GetByte/PutByte will occur. Usually this function will just be used to start from the beginning of the BitmapSource, by passing zero for nPos.
BOOL AttachToBufferFile (CCBufferFile *pFile) const
 The entry points to filters need a CCFile object. This function provides a CCFile object which uses this BitmapSource when calling the CCFile member functions. Notes: The returned CCFile should be destroyed using delete when no longer needed.
virtual BOOL IsJPEG ()
OFFSET GetSize () const

Protected Attributes

ADDR m_pBuffer
OFFSET m_nSize
OFFSET m_ReadWritePosition

Private Member Functions

 CC_DECLARE_MEMDUMP (BitmapSource)

Detailed Description

Objects of this class encapsulate the original source for a bitmap. Scope: public.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/08/96

Definition at line 117 of file bmpsrc.h.


Constructor & Destructor Documentation

BitmapSource::BitmapSource OFFSET  Size  ) 
 

Constructor providing BitmapSource objects of the given size. We construct objects of the required size, and associate bitmaps with them via SetOriginalSource.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Parameters:
Size : The size of the bitmap source (usually the file size). Must be [INPUTS] greater than one.
See also:
KernelBitmap::SetOriginalSource

Definition at line 134 of file bmpsrc.cpp.

00135 {
00136     m_pBuffer           = NULL;
00137     m_nSize             = 0;
00138     m_ReadWritePosition = 0;    
00139 
00140     if (Size > 0)
00141     {
00142         m_pBuffer   = new BYTE[Size];
00143         m_nSize     = Size;
00144     }
00145 }

BitmapSource::~BitmapSource  )  [virtual]
 

Destructor for BitmapSource objects.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/08/96

Definition at line 158 of file bmpsrc.cpp.

00159 {
00160     if (m_pBuffer != NULL)
00161     {
00162         delete m_pBuffer;
00163         m_pBuffer = NULL;
00164     }       
00165     m_nSize = 0;
00166 }


Member Function Documentation

BOOL BitmapSource::AttachToBufferFile CCBufferFile pFile  )  const
 

The entry points to filters need a CCFile object. This function provides a CCFile object which uses this BitmapSource when calling the CCFile member functions. Notes: The returned CCFile should be destroyed using delete when no longer needed.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/08/96
Returns:
A pointer to a CCBufferFile object which will provide a reference to this BitmapSource. NULL is returned if an error occurred

Definition at line 292 of file bmpsrc.cpp.

00293 {
00294     ERROR3IF(!pFile->IS_KIND_OF(CCBufferFile), "pFile is not");
00295 
00296     pFile->init(m_pBuffer, m_nSize);
00297 
00298     return TRUE;
00299 }

BitmapSource::CC_DECLARE_MEMDUMP BitmapSource   )  [private]
 

BOOL BitmapSource::GetByte BYTE &  byte  )  [virtual]
 

Allows this BitmapSource to be copied elsewhere (to disk) a byte at a time. Notes: SeekPos() should be called to reset the current position.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/08/96
Parameters:
byte : Returns the byte from the current position in the BitmapSource [OUTPUTS]
Returns:
Errors: ERROR2 if trying to read beyond the end of this BitmapSource

Definition at line 208 of file bmpsrc.cpp.

00209 {
00210     ERROR2IF(m_ReadWritePosition > GetSize(), FALSE, "m_ReadWritePosition > GetSize()");
00211 
00212     byte = m_pBuffer[m_ReadWritePosition];
00213     ++m_ReadWritePosition;
00214 
00215     return TRUE;
00216 }

OFFSET BitmapSource::GetSize  )  const [inline]
 

Definition at line 134 of file bmpsrc.h.

00134 {return m_nSize;}

virtual BOOL BitmapSource::IsJPEG  )  [inline, virtual]
 

Reimplemented in JPEGBitmapSource.

Definition at line 132 of file bmpsrc.h.

00132 { return FALSE; } 

BOOL BitmapSource::IsOK  )  const
 

Since the constructor can fail, this member function determines whether or not it was wholly successful. Users should always call this function after constructing BitmapSource objects.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/8/96
Returns:
TRUE if constructor succeeded FALSE otherwise
See also:
BitmapSource::BitmapSource(...)

Definition at line 187 of file bmpsrc.cpp.

00188 {
00189     return (m_pBuffer != NULL);
00190 }

BOOL BitmapSource::PutByte const BYTE  byte  )  [virtual]
 

Adds a byte to this BitmapSorce object.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/08/96
Parameters:
byte,: a BYTE to place at the current position in this BitmapSource [INPUTS]
Returns:
TRUE if put succeeded FALSE otherwise

Errors: ERROR2 if trying to put after end of BitmapSource

Definition at line 234 of file bmpsrc.cpp.

00235 {
00236     ERROR2IF(m_ReadWritePosition > GetSize(), FALSE, "m_ReadWritePosition > GetSize()");
00237 
00238     m_pBuffer[m_ReadWritePosition] = byte;
00239     ++m_ReadWritePosition;
00240 
00241     return TRUE;
00242 }

BOOL BitmapSource::SeekPos OFFSET  nPos  )  [virtual]
 

Sets the position in the BitmapSource at which the next GetByte/PutByte will occur. Usually this function will just be used to start from the beginning of the BitmapSource, by passing zero for nPos.

Author:
Colin_Barfoot (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/08/96
Parameters:
nPos,: The position to be set [INPUTS]
Returns:
TRUE : if successful FALSE: otherwise

Errors: ERROR2 if trying to seek after the end of this BitmapSource

Definition at line 265 of file bmpsrc.cpp.

00266 {
00267     ERROR2IF(nPos > GetSize(), FALSE, "nPos > GetSize()");
00268 
00269     m_ReadWritePosition = nPos;
00270     return TRUE;
00271 }


Member Data Documentation

OFFSET BitmapSource::m_nSize [protected]
 

Definition at line 138 of file bmpsrc.h.

ADDR BitmapSource::m_pBuffer [protected]
 

Definition at line 137 of file bmpsrc.h.

OFFSET BitmapSource::m_ReadWritePosition [protected]
 

Definition at line 139 of file bmpsrc.h.


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