Public Member Functions

Celartem::DjVu::PackedBitmap Class Reference

#include <djv_jb2common.h>

List of all members.

Public Member Functions

 PackedBitmap ()
 PackedBitmap (size_t inWidth, size_t inHeight)
 PackedBitmap (size_t inWidth, size_t inHeight, ssize_t inRowStride, const u8 *inImagePtr, bool inPacked=false)
 PackedBitmap (const PackedBitmap &inBitmap)
size_t getWidth () const
size_t getHeight () const
ssize_t getRowStride () const
const u8getPtr () const
u8getPtr ()
void swap (PackedBitmap &ioBitmap)
u8allocate (size_t inWidth, size_t inHeight)
void zeroClear ()
bool isIdentical (const PackedBitmap &inBitmap) const

Detailed Description

This class is used to preserve 1-bit black and white image, which defines JB2 shapes.


Constructor & Destructor Documentation

Celartem::DjVu::PackedBitmap::PackedBitmap (  )  [inline]

Initialize a new instance.

With this constructor, you are responsible for all the content and the number of foreground bits.

Celartem::DjVu::PackedBitmap::PackedBitmap ( size_t  inWidth,
size_t  inHeight 
) [inline]

Initialize a new instance.

Parameters:
inWidth The width in pixels.
inHeight The heigth in pixels.

With this constructor, you are responsible for all the content and the number of foreground bits.

Celartem::DjVu::PackedBitmap::PackedBitmap ( size_t  inWidth,
size_t  inHeight,
ssize_t  inRowStride,
const u8 inImagePtr,
bool  inPacked = false 
)

Initialize a new instance.

Parameters:
inWidth The width in pixels.
inHeight The heigth in pixels.
inRowStride The row-stride in bytes.
inImagePtr Pointer to the image. The type of the image is determined by inPacked and if inPacked is false, each byte stands for a pixel. All the pixels with non-0 value will be translated as 1 and others as 0.
Otherwise, if inPacked is ture, each bit stands for a pixel. MSB(0x80) in each byte is the left-side pixel of a sequential pixels and LSB(0x01) in the byte is the right-side pixel. 1 stands for a foreground pixel (usually in black) and 0 for a background pixel (usually in white).
inPacked If inImagePtr is a packed bitmap, this is true; otherwise if unpacked bitmap, this is false.
Celartem::DjVu::PackedBitmap::PackedBitmap ( const PackedBitmap inBitmap  )  [inline]

Duplicate an existing PackedBitmap instance.

Parameters:
inBitmap An instance to duplicate.

Member Function Documentation

u8* Celartem::DjVu::PackedBitmap::allocate ( size_t  inWidth,
size_t  inHeight 
) [inline]

Initialize a bitmap.

Parameters:
inWidth The width in pixels.
inHeight The heigth in pixels.
Returns:
The pointer to the raw packed (1-bit per pixel) image.
Note that the buffer is not zero-cleared.

Referenced by PackedBitmap().

size_t Celartem::DjVu::PackedBitmap::getHeight (  )  const [inline]

Get the height in pixels.

Returns:
The height in pixels.
const u8* Celartem::DjVu::PackedBitmap::getPtr (  )  const [inline]

Get the pointer to the (0,0) pixel.

Returns:
The pointer to the (0,0) pixel.
u8* Celartem::DjVu::PackedBitmap::getPtr (  )  [inline]

Get the pointer to the (0,0) pixel.

Returns:
The pointer to the (0,0) pixel.
ssize_t Celartem::DjVu::PackedBitmap::getRowStride (  )  const [inline]

Get the row-stride (bytes-to-the-next-line) in bytes.

Returns:
The row-stride.
size_t Celartem::DjVu::PackedBitmap::getWidth (  )  const [inline]

Get the width in pixels.

Returns:
The width in pixels.
bool Celartem::DjVu::PackedBitmap::isIdentical ( const PackedBitmap inBitmap  )  const

Compare two instances.

Parameters:
inBitmap A PackedBitmap instance to compare with.
Returns:
true if two instances are identical; otherwise false.
void Celartem::DjVu::PackedBitmap::swap ( PackedBitmap ioBitmap  )  [inline]

Swap this one with the specified one.

Parameters:
ioBitmap An instance to swap with.
void Celartem::DjVu::PackedBitmap::zeroClear (  )  [inline]

Zero-clear the buffer.

Referenced by PackedBitmap().


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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:20.
Caminova Logo