Rogue Wave Views |
Rogue Wave Views Documentation Home |
Port class. More...
#include <ilviews/base/port.h>
Public Types | |
enum | MemoryType { NoMemory, VideoMemory, SystemMemory } |
The different types of memory location used by bitmaps. More... | |
Public Member Functions | |
IlvBitmap (IlvDisplay *display, IlvDim width, IlvDim height, IlUShort depth, unsigned char *data, IlBoolean bitOrder=IlTrue, IlUShort padding=32) | |
Constructor. More... | |
IlvBitmap (IlvDisplay *display, IlvDim width, IlvDim height, IlUShort depth) | |
Constructor. More... | |
IlvBitmap (IlvDisplay *display, IlvWindowsHandle hBitmap, IlBoolean owner=IlFalse) | |
Constructor from an HBITMAP. More... | |
IlBoolean | computeMask () |
Computes the mask of this bitmap. More... | |
IlUShort | depth () const |
Retrieves the depth of this bitmap. More... | |
IlvBitmapAnimationHandler * | getAnimationHandler () const |
Returns the animation handler connected to this bitmap. More... | |
IlvBitmap * | getMask () const |
Retrieves the mask of this bitmap. More... | |
MemoryType | getMemoryType () const |
Gets the type of memory used in this bitmap. More... | |
const char * | getName () const |
Retrieves the name of this bitmap. More... | |
IlInt | getTransparentColorIndex () const |
Retrieves the transparent color of this bitmap. More... | |
virtual IlBoolean | isABitmap () const |
Queries the nature of this port. More... | |
void | lock () |
Locks the bitmap. More... | |
virtual IlBoolean | save (const char *filename) const |
Saves the bitmap to a file. More... | |
virtual IlBoolean | save (ostream &stream) const |
Saves a bitmap to a stream. More... | |
IlBoolean | saveAscii (const char *filename) const |
Saves an ASCII representation of this bitmap to a file. More... | |
void | setAnimationHandler (IlvBitmapAnimationHandler *handler) |
Sets the animation handler connected to this bitmap. More... | |
void | setMask (IlvBitmap *mask) |
Sets the mask of this bitmap. More... | |
void | setName (const char *name) |
Sets the name of this bitmap. More... | |
void | setTransparentColorIndex (IlInt tcIndex) |
Sets the transparent color of this bitmap. More... | |
void | unLock () |
Unlocks the bitmap. More... | |
void | useColor (IlvColor *color) |
Verbose: More... | |
Public Member Functions inherited from IlvSystemPort | |
IlvSystemPort (IlvDisplay *display, IlvWindowsHandle HDC, IlvDim width=0, IlvDim height=0) | |
Windows-specific constructor. More... | |
virtual void | clearArea (const IlvRect &, IlBoolean=IlFalse) const |
Clears a rectangular area of the screen. More... | |
virtual void | clearArea (const IlvRegion &, IlBoolean=IlFalse) const |
Clears a region of the screen. More... | |
virtual void | clip (const IlvRect *) const |
Limits the drawing to the given rectangular area. More... | |
virtual void | clip (const IlvRegion *) const |
Limits the drawing to the given region. More... | |
virtual void | drawArc (const IlvPalette *, const IlvRect &, IlFloat, IlFloat) const |
Draws an arc. More... | |
virtual void | drawBitmap (const IlvPalette *, const IlvSystemPort *, const IlvRect &, const IlvPoint &) const |
Draws an image. More... | |
virtual void | drawBitmap (const IlvPalette *, const IlvBitmap *, const IlvRect &, const IlvRegion *=0, IlvPosition=IlvCenter, IlBoolean=IlFalse) const |
Draws an image. More... | |
virtual void | drawIString (const IlvPalette *, const IlvPoint &, const char *, int, IlvPosition=IlvLeft) const |
Draws a string at the given position. More... | |
virtual void | drawLine (const IlvPalette *, const IlvPoint &, const IlvPoint &) const |
Draws a line between 2 points. More... | |
virtual void | drawPoint (const IlvPalette *, const IlvPoint &) const |
Draws a point at the given position. More... | |
virtual void | drawPoints (const IlvPalette *, IlUInt, const IlvPoint *) const |
Draws a series of points. More... | |
virtual void | drawPolyLine (const IlvPalette *, IlUInt, const IlvPoint *) const |
Draws a series of connected lines. More... | |
virtual void | drawPolyLine (const IlvPalette *, const IlvPoint &, IlUInt, const IlvDeltaPoint *) const |
Draws a series of connected lines relatively to a reference. More... | |
virtual void | drawRectangle (const IlvPalette *, const IlvRect &) const |
Draws the given rectangle. More... | |
virtual void | drawRoundRectangle (const IlvPalette *, const IlvRect &, IlUShort) const |
Draws a round rectangle. More... | |
virtual void | drawSegments (const IlvPalette *, IlUInt, const IlvPoint *, const IlvPoint *) const |
Draws a set of segments. More... | |
virtual void | drawString (const IlvPalette *, const IlvPoint &, const char *, int, IlvPosition=IlvLeft) const |
Draws a string at the given position. More... | |
virtual void | drawTransformedString (const IlvPalette *, const char *, int, const IlvTransformer &, const IlvRegion *=0) const |
Draws a transformed string. More... | |
virtual void | drawTransparentBitmap (const IlvPalette *, const IlvSystemPort *, const IlvRect &, const IlvPoint &) const |
Draws a transparent bitmap. More... | |
virtual void | end () |
Closed the dump device. More... | |
virtual void | fillArc (const IlvPalette *, const IlvRect &, IlFloat, IlFloat) const |
Fills the arc. More... | |
virtual void | fillPaths (const IlvPalette *, IlUInt, const IlvPointArray *) const |
Fills the shape defined by the given paths. More... | |
virtual void | fillPolyLine (const IlvPalette *, IlUInt, const IlvPoint *, IlBoolean=IlFalse) const |
Fills a polygon. More... | |
virtual void | fillPolyLine (const IlvPalette *, const IlvPoint &, IlUInt, const IlvDeltaPoint *, IlBoolean=IlFalse) const |
Fills a polygon. More... | |
virtual void | fillRectangle (const IlvPalette *, const IlvRect &) const |
Fills the given rectangle. More... | |
virtual void | fillRoundRectangle (const IlvPalette *, const IlvRect &, IlUShort) const |
Fills a round rectangle. More... | |
IlvWindowsHandle | getDC () const |
Gets the Windows Handle Device Context. More... | |
virtual IlBoolean | initDevice (const char *, IlvRect *=0) |
Initializes the dump device. More... | |
virtual IlBoolean | isASystemPort () const |
Indicates that this port is a true system port (not a dump device). More... | |
virtual IlBoolean | isBad () const |
Indicates whether this port is valid. More... | |
virtual IlBoolean | newPage () const |
Produces an output page and prepares for a new page. More... | |
void | releaseDC () |
Releases the Windows Handle Device Context. More... | |
virtual void | send (const char *) const |
Sends character strings to an output device. More... | |
virtual void | setTransformer (const IlvTransformer &) |
Applies another transformer to the coordinates provided for the drawing functions. More... | |
virtual void | stretchBitmap (const IlvPalette *, const IlvPoint &, const IlvBitmap *, const IlvTransformer &, const IlvRect *=0) const |
Stretches a bitmap. More... | |
virtual void | stretchBitmap (const IlvPalette *, const IlvRect &, const IlvBitmap *, const IlvRect *=0) const |
Stretches a bitmap. More... | |
virtual void | stretchBitmapData (const IlvPalette *palette, const IlvBitmapData *src, const IlvRect &from, const IlvRect &to, IlBoolean opaque=IlFalse) const |
Draws a bitmap data. More... | |
virtual void | stretchTransparentBitmap (const IlvPalette *, const IlvPoint &, const IlvBitmap *, const IlvTransformer &, const IlvRect *=0) const |
Stretches a transparent bitmap. More... | |
virtual void | stretchTransparentBitmap (const IlvPalette *, const IlvRect &, const IlvBitmap *, const IlvRect *=0) const |
Stretches a transparent bitmap. More... | |
Public Member Functions inherited from IlvPort | |
IlvPort (IlvDisplay *display=0) | |
Constructor. More... | |
void | composeAlpha (IlvIntensity alpha) |
Composes the current alpha value of the port. More... | |
virtual void | drawArrow (const IlvPalette *palette, const IlvPoint &from, const IlvPoint &to, IlFloat position) const |
Draws an arrow. More... | |
virtual void | drawBezier (const IlvPalette *palette, IlUInt count, const IlvPoint *points) const |
Draws a set of Bézier curves. More... | |
virtual void | drawClosedBezier (const IlvPalette *palette, IlUInt count, const IlvPoint *points) const |
Appends a closing curve to a set of Bézier curves. More... | |
virtual void | drawILabel (const IlvPalette *palette, const char *label, int length, const IlvRect &drawRect, const IlvRegion *clip=0, IlvPosition align=IlvCenter) const |
Draws a label in a rectangle. More... | |
virtual void | drawLabel (const IlvPalette *palette, const char *label, int length, const IlvRect &drawRect, const IlvRegion *clip=0, IlvPosition align=IlvCenter) const |
Draws a label in a rectangle. More... | |
virtual void | drawMarker (const IlvPalette *palette, const IlvPoint &location, IlvMarkerType type=IlvMarkerSquare, IlUShort size=IlvDefaultMarkerSize) const |
Draws a marker. More... | |
virtual void | drawMnemonicLabel (const IlvPalette *palette, const char *label, const IlvRect &drawRect, const IlvRegion *clip=0, IlvPosition align=IlvCenter, IlBoolean underline=IlTrue) const |
Draws an underlined letter in a label. More... | |
virtual void | drawOutlineRectangle (const IlvPalette *outlinePalette, const IlvPalette *fillPalette, const IlvRect &rect, const IlvRegion *clip=0) const |
Draws a rectangle with border effects. More... | |
virtual void | drawPaths (const IlvPalette *palette, IlUInt count, const IlvPointArray *paths) const |
Draws an array of paths as polylines. More... | |
virtual void | drawReliefDiamond (const IlvPalette *, const IlvPalette *invertedPalette, const IlvPalette *topShade, const IlvPalette *bottomShade, const IlvRect &bbox, IlUShort thickness, const IlvRegion *clip=0) const |
Draws a diamond with depth effects. More... | |
virtual void | drawReliefRectangle (const IlvPalette *palette, const IlvPalette *invertedPalette, const IlvPalette *topShade, const IlvPalette *bottomShade, const IlvRect &bbox, IlUShort thickness, const IlvRegion *clip=0) const |
Draws a filled rectangle with depth effects. More... | |
virtual void | drawShadowRectangle (const IlvPalette *palette, const IlvPalette *invertedPalette, const IlvRect &bbox, IlUShort thickness, IlvPosition shadowPosition, const IlvRegion *clip=0) const |
Draws a filled rectangle with its shadow. More... | |
virtual void | fillBezier (const IlvPalette *palette, IlUInt count, const IlvPoint *points) const |
Fills an area specified by a set of Bézier curves. More... | |
IlvIntensity | getAlpha () const |
Provides the alpha value of the port. More... | |
IlvAntialiasingMode | getAntialiasingMode () const |
Provides the anti-aliasing mode of the port. More... | |
IlvDisplay * | getDisplay () const |
Returns a pointer to the IlvDisplay of this port. More... | |
IlvDim | height () const |
Provides the height of the port. More... | |
virtual IlBoolean | isADevice () const |
Indicates that this port is a dump device. More... | |
void | setAlpha (IlvIntensity alpha) |
Sets the alpha value of the port. More... | |
void | setAntialiasingMode (IlvAntialiasingMode mode) |
Sets the anti-aliasing mode of the port. More... | |
void | size (IlvDim &w, IlvDim &h) const |
Gives the dimensions of the port. More... | |
IlvDim | width () const |
Provides the width of the port. More... | |
Friends | |
class | IlvDisplay |
Additional Inherited Members | |
Static Public Member Functions inherited from IlvSystemPort | |
static IlvBitmapData * | GetBitmapData (IlvSystemPort *port, const IlvRect *rect=0) |
Creates an IlvBitmapData from a rectangular area in an IlvSystemPort . More... | |
Port class.
Library: xviews or winviews or mviews (mutually exclusive)
Instances of the IlvBitmap
class are rectangular areas that store a group of pixels that make an image. These images can be in full color. In this case, each pixel value represents a color index when your display system has no true-color capabilities. To find the exact color that will be displayed for this pixel, the system lookup table is consulted. If your display system has true color capabilities, then each pixel of the bitmap stores its complete color information.
Also, images can be monochrome. In this case, there is only one bit per pixel, and the drawing of these one-bit-deep bitmaps will take place by setting the 1
pixels to the foreground color of the palette that is used, and the 0
pixels will be set to the background color of this palette or left unchanged.
A colored bitmap can be associated a mask. A mask is a monochrome bitmap that indicates which of the pixels in the actual source image will be displayed. The pixels in the bitmap that correspond to '0' bits in the mask will be capable of not being displayed, achieving the effect of a transparent bitmap, that is, a color bitmap that has transparent parts.
Because IlvBitmap
derives from IlvPort
, you can actually draw into bitmap using the member functions of its parent classes. Most of the time, though, a bitmap is made from the conversion of a data file using an IlvBitmapStreamer
.
The different types of memory location used by bitmaps.
Indicates the type of memory used by a given bitmap.
getMemoryType()
, IlvWindowsDisplayConfig::setBitmapAllocationFailedCallback(IlvBitmapAllocationFailedCallback)
. Enumerator | |
---|---|
NoMemory |
Bitmap storage is invalid. |
VideoMemory |
Bitmap storage is allocated in the memory of the video card. |
SystemMemory |
Bitmap storage is allocated in the system memory. |
IlvBitmap::IlvBitmap | ( | IlvDisplay * | display, |
IlvDim | width, | ||
IlvDim | height, | ||
IlUShort | depth, | ||
unsigned char * | data, | ||
IlBoolean | bitOrder = IlTrue , |
||
IlUShort | padding = 32 |
||
) |
Constructor.
Initializes an empty image. Its content is unpredictable but the memory area to hold a future valid image is allocated and made available.
display | The display where this bitmap is created. |
width | The width of this new bitmap. |
height | The height of this new bitmap. |
depth | The depth of this new bitmap, that is, how many bits should be used to hold the pixel value of each individual image element. This can be either 1 for monochrome bitmaps, or the depth of the display as returned by calling IlvDisplay::screenDepth() . |
data | The initial data that initializes the bitmap pixel. This data must respect the following rules:
|
bitOrder | Indicates the bit order of the data. The data bits are considered most significant bits first if bitOrder is IlTrue , or least significant bits first if bitOrder is set to IlFalse . |
padding | The padding value. The length of each scan line in data must be a multiple of this value. |
IlvBitmap::IlvBitmap | ( | IlvDisplay * | display, |
IlvDim | width, | ||
IlvDim | height, | ||
IlUShort | depth | ||
) |
Constructor.
Initializes a bitmap that has the indicated size and depth. The initial contents are unpredictable.
display | The display where this bitmap is created. |
width | The width of this new bitmap. |
height | The height of this new bitmap. |
depth | The depth of this new bitmap, that is, how many bits should be used to hold the pixel value of each individual image element. This can be either 1 for monochrome bitmaps, or the depth of the display as returned by calling display->screenDepth() . |
IlvBitmap::IlvBitmap | ( | IlvDisplay * | display, |
IlvWindowsHandle | hBitmap, | ||
IlBoolean | owner = IlFalse |
||
) |
Constructor from an HBITMAP.
Initializes a bitmap from a Windows handle to a bitmap (HBITMAP
). The width, height, and depth are retrieved directly from the HBITMAP
.
display | A pointer to an IlvDisplay . |
hBitmap | The HBITMAP . |
owner | A Boolean that indicates whether the object must delete the HBITMAP when this parameter is IlTrue or not delete it when this parameter is IlFalse . |
IlBoolean IlvBitmap::computeMask | ( | ) |
Computes the mask of this bitmap.
This member function computes a monochrome mask of the image currently stored in this bitmap. This mask is used to draw this bitmap transparently. The mask has the same dimensions as this bitmap, but every pixel of the original image that matches the transparent color index will be converted to a '0' bit in the output mask (see setTransparentColorIndex
). All other pixels will result in a '1' in the mask. The original image may be modified after a call to computeMask
.
IlTrue
if the mask is successfully computed (that is, there is a transparent color index that was used to compute the image mask). If the original bitmap is monochrome, or if the transparent color index has not been set, then this member function returns IlFalse
.
|
virtual |
Retrieves the depth of this bitmap.
Reimplemented from IlvSystemPort.
IlvBitmapAnimationHandler* IlvBitmap::getAnimationHandler | ( | ) | const |
Returns the animation handler connected to this bitmap.
0
if there's none. IlvBitmap* IlvBitmap::getMask | ( | ) | const |
Retrieves the mask of this bitmap.
0
if there is none (that is, the bitmap has no transparent area). MemoryType IlvBitmap::getMemoryType | ( | ) | const |
Gets the type of memory used in this bitmap.
Views can allocate bitmaps in the video card memory or in the system memory, depending of the deployment environment state and the application configuration. This methods lets your application query the type of memory that is used for this bitmap.
const char* IlvBitmap::getName | ( | ) | const |
Retrieves the name of this bitmap.
IlInt IlvBitmap::getTransparentColorIndex | ( | ) | const |
Retrieves the transparent color of this bitmap.
-1
means that this bitmap has no transparent color.
|
virtual |
Queries the nature of this port.
IlTrue
. Reimplemented from IlvSystemPort.
void IlvBitmap::lock | ( | ) |
Locks the bitmap.
You must call this function if you want this bitmap to be shared among different objects (such as in the IlvIcon
class).
|
virtual |
Saves the bitmap to a file.
Writes out the binary description of the image.
filename | The filename of the file where this bitmap is saved. |
IlTrue
if the save is successful, and IlFalse
otherwise.
|
virtual |
Saves a bitmap to a stream.
Writes out the binary description of the image.
stream | The output stream where this bitmap is saved. |
IlTrue
if the save is successful, and IlFalse
otherwise. IlBoolean IlvBitmap::saveAscii | ( | const char * | filename | ) | const |
Saves an ASCII representation of this bitmap to a file.
The description of this IlvBitmap
image will be stored in XBM
(black and white) or XPM
(color) format. This makes it easier, for example, to transfer your images from one site to another. The IlvDisplay
class has a member function that lets you read from this new format (see IlvDisplay::readAsciiBitmap
).
filename | The filename of the file where this bitmap is saved. |
IlTrue
if the save is successful, and IlFalse
otherwise. void IlvBitmap::setAnimationHandler | ( | IlvBitmapAnimationHandler * | handler | ) |
Sets the animation handler connected to this bitmap.
The animation handler is deleted when the bitmap will be deleted.
handler | The animation handler. |
void IlvBitmap::setMask | ( | IlvBitmap * | mask | ) |
Sets the mask of this bitmap.
The previous mask is unlocked, and the new mask is locked.
mask | The new mask of this bitmap. |
void IlvBitmap::setName | ( | const char * | name | ) |
Sets the name of this bitmap.
name | The string that is copied as the new name of this bitmap. |
void IlvBitmap::setTransparentColorIndex | ( | IlInt | tcIndex | ) |
Sets the transparent color of this bitmap.
tcIndex | The new transparent color index of this bitmap. |
void IlvBitmap::unLock | ( | ) |
Unlocks the bitmap.
If no more objects are locking this bitmap, it will then be destroyed.
void IlvBitmap::useColor | ( | IlvColor * | color | ) |
Verbose:
Indicates that the color referred to as color
is used in this bitmap. The effect of this function call is that the color will be locked, and referenced to be unlocked when the bitmap is destroyed.
color | The color that this bitmap is indicated to use. |
© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.