CartoType API
Public Types | Public Member Functions
CartoType::TBitmap Class Reference

#include <cartotype_graphics.h>

Inheritance diagram for CartoType::TBitmap:
CartoType::CBitmap

List of all members.

Public Types

enum  { EBitsPerPixelMask = 63, EColored = 64, ETwin = 128 }
enum  TType {
  E1BitMono = 1, E8BitMono = 8, E16BitColor = EColored | 16, E24BitColor = EColored | 24,
  E32BitColor = EColored | 32, E8BitTwin = ETwin | 8
}
typedef TColor(* TColorFunction )(const TBitmap &aBitmap, uint32 aX, uint32 aY)

Public Member Functions

 TBitmap (TType aType, uint8 *aData, int32 aWidth, int32 aHeight, int32 aRowBytes)
CT_IMPORT TColorFunction ColorFunction () const
CT_IMPORT CBitmapCopy (TResult &aError, int32 aExpansion=0) const
CT_IMPORT CBitmapBlur (TResult &aError, bool aGaussian, TFixed aWidth) const
TType Type () const
int32 BitsPerPixel () const
const uint8 * Data () const
uint8 * Data ()
int32 DataBytes () const
int32 Width () const
int32 Height () const
int32 RowBytes () const
void Clear ()

Detailed Description

A bitmap that does not take ownership of pixel data.


Member Enumeration Documentation

anonymous enum
Enumerator:
EBitsPerPixelMask 

A mask for the bits in TBitmap::TType that represent the number of bits per pixel.

EColored 

The bit in TBitmap::TType that indicates whether the type is inherently colored, which means that its color data is held in the pixel value.

ETwin 

The bit in TBitmap::TType that indicates whether the type's data bits are split equally between intensity bits and palette bits.

An enumerated type for supported bitmap types. The number of bits per pixel is held in the low 6 bits.

Enumerator:
E1BitMono 

One bit per pixel: 1 = foreground color, 0 = background color.

E8BitMono 

Eight bits per pixel: 255 = foreground color, 0 = background color.

E16BitColor 

16 bits per pixel, accessed as 16-bit words, not as bytes; top 5 bits = red, middle 6 bits = green, low 5 bits = blue.

E24BitColor 

24 bits per pixel: first byte blue, second byte green, third byte red.

E32BitColor 

32 bits per pixel: first byte alpha, second byte blue, second byte green, third byte red. The red, green and blue values are premultiplied by the alpha value.

E8BitTwin 

8 bits per pixel twin-purpose format: high nybble is the intensity, low nybble is the color, which is an index into a palette. This format was designed to allow anti-aliased map labels in more than one color to be stored in an 8bpp bitmap.


Constructor & Destructor Documentation

CartoType::TBitmap::TBitmap ( TType  aType,
uint8 *  aData,
int32  aWidth,
int32  aHeight,
int32  aRowBytes 
) [inline]

Create a bitmap with a specified type, data, and dimensions.


Member Function Documentation

int32 CartoType::TBitmap::BitsPerPixel ( ) const [inline]

Return the bitmap depth: that number of bits used to store each pixel.

CT_EXPORT CBitmap * TBitmap::Blur ( TResult aError,
bool  aGaussian,
TFixed  aWidth 
) const

Create a blurred bitmap with edges aWidth pixels wide. The new bitmap is wider and taller than the original bitmap by aWidth * 2 pixels.

void CartoType::TBitmap::Clear ( ) [inline]

Clear the pixel data to zeroes.

CT_EXPORT TBitmap::TColorFunction TBitmap::ColorFunction ( ) const

Return a pointer to a function to get the premultiplied-alpha color at a certain point, for this type of bitmap. Monochrome bitmaps return only an alpha level (the low 24 bits of the color value returned are all zeroes).

Color functions take the coordinates modulo the width and height of the bitmap.

CT_EXPORT CBitmap * TBitmap::Copy ( TResult aError,
int32  aExpansion = 0 
) const

Copy a bitmap, optionally expanding it by aExpansion pixels all round.

const uint8* CartoType::TBitmap::Data ( ) const [inline]

Return a constant pointer to the start of the pixel data.

uint8* CartoType::TBitmap::Data ( ) [inline]

Return a writable pointer to the start of the pixel data.

int32 CartoType::TBitmap::DataBytes ( ) const [inline]

Return the number of bytes actually used to store the data. This may include padding at the ends of rows.

int32 CartoType::TBitmap::Height ( ) const [inline]

Return the height in pixels.

int32 CartoType::TBitmap::RowBytes ( ) const [inline]

Return the number of bytes used to store each horizontal row of pixels.

TType CartoType::TBitmap::Type ( ) const [inline]

Return the bitmap type, which indicates its depth and whether it is colored.

int32 CartoType::TBitmap::Width ( ) const [inline]

Return the width in pixels.


The documentation for this class was generated from the following files: