Class hierarchy Compound list File list Compound Members File Members
Drawable Class Reference
This class is a base for all objects that are inherently bitmaps, (Currently: Screen & Bitmap) It contains methods that allow manipulating the object: - Drawing - Buffer access - Copying and more. More...
Inherits Interface.
Inherited by Screen and Texture.
List of all members.
Public Members
- virtual int getWidth () const = 0
- Returns the width of the drawable.
- virtual int getHeight () const = 0
- Returns the height of the drawable.
- virtual long status () const = 0
- Returns a non-zero value if an error occurred.
- virtual int getNoAccel () const = 0
- Returns non-zero if hareware acceleration is disabled for this Drawable.
- virtual long clear (TColor Color=0) = 0
- Fill the entire drawable with a specified color.
- virtual long copy (Drawable* Source, int x, int y, int x1=-1, int y1=-1, int x2=-1, int y2=-1, int Transparent=-1) = 0
- Copies (Blits) a rectangle from the source to this drawable.
- virtual long rawCopy (Drawable* Source, int x, int y, int x1=-1, int y1=-1, int x2=-1, int y2=-1, int Transparent=-1) = 0
- This does the same as copy, but it doesn't clip the blit.
- virtual long rawCopy (const Rect2D& destRect, Drawable* Source, const Rect2D& srcRect, int Transparent) = 0
- Copies an arbitrary src rect to an arbitrary dest rect, stretching as necessary.
- virtual long scaleCopy (Drawable* Source, const Rect2D& Section=Rect2D()) = 0
- Copies the a section of the source, scaling it to fit current drawable dimensions.
- virtual long flipHorizontal (Drawable* Source) = 0
- Copies the image from the source, flipping it horizontally.
- virtual long flipVertical (Drawable* Source) = 0
- Copies the image from the source, flipping it vertically.
- virtual long rotate (Drawable* Source, int Degrees) = 0
- Copies the image from the source, rotating it around its center pixels that cannot be obtained due to being out of the image, will be filled with the source current transparent color.
- virtual void* getDDrawSurface () = 0
- Return the internal surface for creating special effects.
- virtual int isLocked () const = 0
- Returns a non-zero value if the Drawable is locked.
- virtual long lock (int Optimize=1, int WriteOnly=0) = 0
- Use Optimize=1 if you will do more than a few drawings.
- virtual long unlock () = 0
- Unlocks the Drawable.
- virtual long drawHLine (int y, int x1, int x2, TColor color) = 0
- Draw a horizontal line at y, from x1 to x2.
- virtual long drawVLine (int x, int y1, int y2, TColor color) = 0
- Draw a vertical line at x, from y1 to y2.
- virtual long drawLine (int x1, int y1, int x2, int y2, TColor color) = 0
- Draw any line.
- virtual long setClipArea (int x1, int y1, int x2, int y2) = 0
- Set an area outside of which nothing can be drawn.
- virtual long getClipArea (int& x1, int& y1, int& x2, int& y2) const = 0
- Get the current Clip Area.
- virtual long isInClipArea (int x, int y) const = 0
- Check if a point is within the clipping area.
- virtual TColor* getBuffer () const = 0
- Returns a pointer to the beginning of the buffer.
- virtual int getPitch () const = 0
- Returns the size of a line in bytes.
- virtual TColor* getLine (int y) const = 0
- Returns a pointer to the beginning of a certain line Returns NULL for all errors.
- virtual long beginDraw () = 0
- Locks the buffer and creates a GDI device context.
- virtual long endDraw () = 0
- Unlocks the buffer and releases the GDI device context.
- virtual void* getDeviceContext () = 0
- Returns the device context.
- virtual long setPixel (int x, int y, int Red, int Green, int Blue) = 0
- Sets a single pixel to the specified color.
- virtual long setPixel (int x, int y, long Color) = 0
- Sets a single pixel to the specified color.
- virtual long getPixel (int x, int y) const = 0
- Gets the color value of the pixel.
- virtual long ellipse (int x1, int y1, int x2, int y2) = 0
- Draws an ellipse that is bounded by the specified rectangle.
- virtual long line (int x1, int y1, int x2, int y2) = 0
- Draw a generic line.
- virtual long setColor (int Red, int Green, int Blue) = 0
- Set the current drawing color.
- virtual long setBKColor (int Red, int Green, int Blue) = 0
- Set the current background color.
- virtual long printXY (int x, int y, int Color, const char* str) = 0
- Print text.
- virtual long getTextWidth () = 0
- Returns the width of a character.
- virtual long getTextHeight () = 0
- Returns the height of a character.
- virtual long fillRect (int x1, int y1, int x2, int y2) = 0
- Draws a filled rectangle.
- virtual long loadRaw (istream& is, int TopToBottom=1, int Pad32=0) = 0
- Loads data into the Drawable from a 24 bit raw data stream.
- virtual long loadRaw (void* Buffer, ulong Length, int TopToBottom=1, int Pad32=0) = 0
- Loads data into the Drawable from a 24 bit raw data memory buffer.
- virtual long save (ostream& os, int BMP=1) = 0
- Saves the drawable as a bitmap to a stream.
- virtual int getTransparency () const = 0
- Returns a non-zero value if this drawable has a transparent color (for copy ops).
- virtual long setTransparency (int Transparency) = 0
- Set transparency mode.
- virtual long setTransparentColor (TColor Color) = 0
- Sets the color which will be transparent in copies.
- virtual TColor getTransparentColor () const = 0
- Gets the color which will be transparent in copies.
- virtual TColor getColor (int Red, int Green, int Blue) const = 0
- Convert 24 bit color components into 16 bit.
- virtual TColor getColor (long Color) const = 0
- Convert 24 bit color into 16 bit.
- virtual long getRGBColor (TColor Color) const = 0
- Convert 16 bit color into 24 bit.
Related Functions
(Note that these are not member functions.)
- DLLExport Bitmap* newBitmap (int Width, int Height, int NoAccel=0)
- Creates a new bitmap with the specified size.
- DLLExport Bitmap* newBitmap (Bitmap* BM)
- Creates a copy of the given bitmap.
- DLLExport Bitmap* newBitmap (istream& is, int Width, int Height, int NoAccel=0)
- Creates a bitmap and loads it from the input stream.
- DLLExport Bitmap* newBitmap (istream& is, int NoAccel=0)
- Creates a bitmap and loads it from the input stream.
- DLLExport Bitmap* loadBMP (const char* Filename)
- Creates a bitmap and loads it from a *.BMP file.
Detailed Description
This class is a base for all objects that are inherently bitmaps, (Currently: Screen & Bitmap) It contains methods that allow manipulating the object: - Drawing - Buffer access - Copying and more.
Member Function Documentation
virtual int Drawable::getWidth() const = 0 [pure virtual]
Returns the width of the drawable.
virtual int Drawable::getHeight() const = 0 [pure virtual]
Returns the height of the drawable.
virtual long Drawable::status() const = 0 [pure virtual]
Returns a non-zero value if an error occurred.
virtual int Drawable::getNoAccel() const = 0 [pure virtual]
Returns non-zero if hareware acceleration is disabled for this Drawable.
Return value of 0 does not assure
hardware acceleration.
virtual long Drawable::clear(TColor Color=0) = 0 [pure virtual]
Fill the entire drawable with a specified color.
virtual long Drawable::copy(Drawable* Source, int x, int y, int x1=-1, int y1=-1, int x2=-1, int y2=-1, int Transparent=-1) = 0 [pure virtual]
Copies (Blits) a rectangle from the source to this drawable.
Both must be unlocked.
x,y are the destination coordinates.
x1,y1,x2,y2 is the source rectangle, defaulting to the entire area.
Transparent: (-1 use drawable transparency, 0 no transparency, 1 force transparency.
Returns >0 if copy was clipped out.
virtual long Drawable::rawCopy(Drawable* Source, int x, int y, int x1=-1, int y1=-1, int x2=-1, int y2=-1, int Transparent=-1) = 0 [pure virtual]
This does the same as copy, but it doesn't clip the blit.
This can be used for optimization if the application does clipping.
virtual long Drawable::rawCopy(const Rect2D& destRect, Drawable* Source, const Rect2D& srcRect, int Transparent) = 0 [pure virtual]
Copies an arbitrary src rect to an arbitrary dest rect, stretching as necessary.
If a rect is properly empty (br.x < tl.x || br.y < tl.y), then the entire
source or dest dimensions are used.
virtual long Drawable::scaleCopy(Drawable* Source, const Rect2D& Section=Rect2D()) = 0 [pure virtual]
Copies the a section of the source, scaling it to fit current drawable dimensions.
The default section takes the entire sources.
virtual long Drawable::flipHorizontal(Drawable* Source) = 0 [pure virtual]
Copies the image from the source, flipping it horizontally.
virtual long Drawable::flipVertical(Drawable* Source) = 0 [pure virtual]
Copies the image from the source, flipping it vertically.
virtual long Drawable::rotate(Drawable* Source, int Degrees) = 0 [pure virtual]
Copies the image from the source, rotating it around its center pixels that cannot be obtained due to being out of the image, will be filled with the source current transparent color.
virtual void* Drawable::getDDrawSurface() = 0 [pure virtual]
Return the internal surface for creating special effects.
Care must be taken to return the surface to its original state (locks)
to prevent internal inconsistencies.
Return type should be cast to: LPDIRECTDRAWSURFACE4
virtual int Drawable::isLocked() const = 0 [pure virtual]
Returns a non-zero value if the Drawable is locked.
virtual long Drawable::lock(int Optimize=1, int WriteOnly=0) = 0 [pure virtual]
Use Optimize=1 if you will do more than a few drawings.
This will pre-calculate offsets in the buffer.
If only a few single pixels are accessed, it is preferred
not to use optimize.
virtual long Drawable::unlock() = 0 [pure virtual]
Unlocks the Drawable.
Must be done to enable other access to
the object
virtual long Drawable::drawHLine(int y, int x1, int x2, TColor color) = 0 [pure virtual]
Draw a horizontal line at y, from x1 to x2.
virtual long Drawable::drawVLine(int x, int y1, int y2, TColor color) = 0 [pure virtual]
Draw a vertical line at x, from y1 to y2.
virtual long Drawable::drawLine(int x1, int y1, int x2, int y2, TColor color) = 0 [pure virtual]
virtual long Drawable::setClipArea(int x1, int y1, int x2, int y2) = 0 [pure virtual]
Set an area outside of which nothing can be drawn.
virtual long Drawable::getClipArea(int& x1, int& y1, int& x2, int& y2) const = 0 [pure virtual]
Get the current Clip Area.
virtual long Drawable::isInClipArea(int x, int y) const = 0 [pure virtual]
Check if a point is within the clipping area.
virtual TColor* Drawable::getBuffer() const = 0 [pure virtual]
Returns a pointer to the beginning of the buffer.
Returns NULL for all errors
virtual int Drawable::getPitch() const = 0 [pure virtual]
Returns the size of a line in bytes.
This includes pixel data and some extra information
Only the pixel data should be modified
For more information, refer to the manual.
virtual TColor* Drawable::getLine(int y) const = 0 [pure virtual]
Returns a pointer to the beginning of a certain line Returns NULL for all errors.
virtual long Drawable::beginDraw() = 0 [pure virtual]
Locks the buffer and creates a GDI device context.
endDraw must be called after all operations are done.
virtual long Drawable::endDraw() = 0 [pure virtual]
Unlocks the buffer and releases the GDI device context.
virtual void* Drawable::getDeviceContext() = 0 [pure virtual]
Returns the device context.
Return value should be cast
to HDC
virtual long Drawable::setPixel(int x, int y, int Red, int Green, int Blue) = 0 [pure virtual]
Sets a single pixel to the specified color.
virtual long Drawable::setPixel(int x, int y, long Color) = 0 [pure virtual]
Sets a single pixel to the specified color.
virtual long Drawable::getPixel(int x, int y) const = 0 [pure virtual]
Gets the color value of the pixel.
virtual long Drawable::ellipse(int x1, int y1, int x2, int y2) = 0 [pure virtual]
Draws an ellipse that is bounded by the specified rectangle.
virtual long Drawable::line(int x1, int y1, int x2, int y2) = 0 [pure virtual]
virtual long Drawable::setColor(int Red, int Green, int Blue) = 0 [pure virtual]
Set the current drawing color.
virtual long Drawable::setBKColor(int Red, int Green, int Blue) = 0 [pure virtual]
Set the current background color.
virtual long Drawable::printXY(int x, int y, int Color, const char* str) = 0 [pure virtual]
virtual long Drawable::getTextWidth() = 0 [pure virtual]
Returns the width of a character.
Assumes default monospace font
virtual long Drawable::getTextHeight() = 0 [pure virtual]
Returns the height of a character.
Assumes default monospace font
virtual long Drawable::fillRect(int x1, int y1, int x2, int y2) = 0 [pure virtual]
Draws a filled rectangle.
virtual long Drawable::loadRaw(istream& is, int TopToBottom=1, int Pad32=0) = 0 [pure virtual]
Loads data into the Drawable from a 24 bit raw data stream.
TopToBottom indicates if image is y inverted.
Pad32 indicates that each row is padded to 32 bit bounday. (BMP style)
virtual long Drawable::loadRaw(void* Buffer, ulong Length, int TopToBottom=1, int Pad32=0) = 0 [pure virtual]
Loads data into the Drawable from a 24 bit raw data memory buffer.
TopToBottom indicates if image is y inverted.
Pad32 indicates that each row is padded to 32 bit bounday. (BMP style)
virtual long Drawable::save(ostream& os, int BMP=1) = 0 [pure virtual]
Saves the drawable as a bitmap to a stream.
If BMP is zero this includes a header consisting of:
Width (4 bytes) Height (4 Bytes) Bits Per Pixel (4 Bytes) and raw 24 bit data
If BMP is not 0, the output is a windows BMP file.
virtual int Drawable::getTransparency() const = 0 [pure virtual]
Returns a non-zero value if this drawable has a transparent color (for copy ops).
virtual long Drawable::setTransparency(int Transparency) = 0 [pure virtual]
Set transparency mode.
Still requiring setting a transparent color.
virtual long Drawable::setTransparentColor(TColor Color) = 0 [pure virtual]
Sets the color which will be transparent in copies.
(Default: 1)
virtual TColor Drawable::getTransparentColor() const = 0 [pure virtual]
Gets the color which will be transparent in copies.
virtual TColor Drawable::getColor(int Red, int Green, int Blue) const = 0 [pure virtual]
Convert 24 bit color components into 16 bit.
virtual TColor Drawable::getColor(long Color) const = 0 [pure virtual]
Convert 24 bit color into 16 bit.
virtual long Drawable::getRGBColor(TColor Color) const = 0 [pure virtual]
Convert 16 bit color into 24 bit.
DLLExport Bitmap* newBitmap(int Width, int Height, int NoAccel=0)
Creates a new bitmap with the specified size.
DLLExport Bitmap* newBitmap(Bitmap* BM)
Creates a copy of the given bitmap.
DLLExport Bitmap* newBitmap(istream& is, int Width, int Height, int NoAccel=0)
Creates a bitmap and loads it from the input stream.
DLLExport Bitmap* newBitmap(istream& is, int NoAccel=0)
Creates a bitmap and loads it from the input stream.
DLLExport Bitmap* loadBMP(const char* Filename)
Creates a bitmap and loads it from a *.BMP file.
The documentation for this class was generated from the following files: