Public Member Functions | List of all members
Celartem::DjVu::PackedBitmap Class Reference

#include <djv_jb2common.h>

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)
 
bool isValid () const
 
size_t getWidth () const
 
size_t getHeight () const
 
ssize_t getRowStride () const
 
const u8getPtr (size_t y=0) const
 
u8getPtr (size_t y=0)
 
void swap (PackedBitmap &ioBitmap)
 
u8allocate (size_t inWidth, size_t inHeight)
 
void zeroClear ()
 
bool isIdentical (const PackedBitmap &inBitmap) const
 
size_t getPixelCount () 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
inWidthThe width in pixels.
inHeightThe 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
inWidthThe width in pixels.
inHeightThe heigth in pixels.
inRowStrideThe row-stride in bytes.
inImagePtrPointer 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).
inPackedIf 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
inBitmapAn instance to duplicate.

Member Function Documentation

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

Initialize a bitmap.

Parameters
inWidthThe width in pixels.
inHeightThe 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.
size_t Celartem::DjVu::PackedBitmap::getPixelCount ( ) const

Get the number of flagged pixels.

Returns
The number of flagged pixels.
const u8* Celartem::DjVu::PackedBitmap::getPtr ( size_t  y = 0) const
inline

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

Parameters
yY coordinate.
Returns
The pointer to the (0,y) pixel.
u8* Celartem::DjVu::PackedBitmap::getPtr ( size_t  y = 0)
inline

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

Parameters
yY coordinate.
Returns
The pointer to the (0,y) 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
inBitmapA PackedBitmap instance to compare with.
Returns
true if two instances are identical; otherwise false.
bool Celartem::DjVu::PackedBitmap::isValid ( ) const
inline

Determine whether the instance is valid (contains meaningful bitmap) or not.

Returns
true if the instance is valid.
void Celartem::DjVu::PackedBitmap::swap ( PackedBitmap ioBitmap)
inline

Swap this one with the specified one.

Parameters
ioBitmapAn 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:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo