Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations | Functions
nsBMPDecoder.h File Reference
#include "nsCOMPtr.h"
#include "imgIDecoder.h"
#include "imgIContainer.h"
#include "imgIDecoderObserver.h"
#include "gfxIImageFrame.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BMPFILEHEADER
struct  BMPINFOHEADER
struct  colorTable
struct  bitFields
class  nsBMPDecoder
 Decoder for BMP-Files, as used by Windows and OS/2. More...

Defines

#define NS_BMPDECODER_CID
#define BFH_LENGTH   18
#define OS2_BIH_LENGTH   12
#define OS2_HEADER_LENGTH   (BFH_LENGTH + 8)
#define WIN_HEADER_LENGTH   (BFH_LENGTH + 36)
#define BITFIELD_LENGTH   12
#define LITTLE_TO_NATIVE16(x)   x
#define LITTLE_TO_NATIVE32(x)   x
#define USE_RGB
#define BMP_GFXFORMAT   gfxIFormats::RGB
#define RLE_GFXFORMAT_ALPHA   gfxIFormats::RGB_A1
#define GFXBYTESPERPIXEL   3
#define BI_RLE8   1
#define BI_RLE4   2
#define BI_BITFIELDS   3
#define RLE_ESCAPE   0
#define RLE_ESCAPE_EOL   0
#define RLE_ESCAPE_EOF   1
#define RLE_ESCAPE_DELTA   2

Enumerations

enum  ERLEState {
  eRLEStateInitial, eRLEStateNeedSecondEscapeByte, eRLEStateNeedXDelta, eRLEStateNeedYDelta,
  eRLEStateAbsoluteMode, eRLEStateAbsoluteModePadded
}
 enums for mState More...

Functions

void SetPixel (PRUint8 *&aDecoded, PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue)
 Sets the pixel data in aDecoded to the given values.
void SetPixel (PRUint8 *&aDecoded, PRUint8 idx, colorTable *aColors)
void Set4BitPixel (PRUint8 *&aDecoded, PRUint8 aData, PRUint32 &aCount, colorTable *aColors)
 Sets two (or one if aCount = 1) pixels.

Class Documentation

struct BMPFILEHEADER

Definition at line 56 of file nsBMPDecoder.h.

Class Members
PRUint32 bihsize
PRUint32 dataoffset
PRUint32 filesize
PRInt32 reserved
char signature
struct BMPINFOHEADER

Definition at line 70 of file nsBMPDecoder.h.

Class Members
PRUint16 bpp
PRUint32 colors
PRUint32 compression
PRInt32 height
PRUint32 image_size
PRUint32 important_colors
PRUint16 planes
PRInt32 width
PRUint32 xppm
PRUint32 yppm
struct colorTable

Definition at line 84 of file nsBMPDecoder.h.

Class Members
PRUint8 blue
PRUint8 green
PRUint8 red
struct bitFields

Definition at line 90 of file nsBMPDecoder.h.

Class Members
PRUint32 blue
PRUint8 blueLeftShift
PRUint8 blueRightShift
PRUint32 green
PRUint8 greenLeftShift
PRUint8 greenRightShift
PRUint32 red
PRUint8 redLeftShift
PRUint8 redRightShift

Define Documentation

#define BFH_LENGTH   18

Definition at line 64 of file nsBMPDecoder.h.

Definition at line 137 of file nsBMPDecoder.h.

#define BI_RLE4   2

Definition at line 136 of file nsBMPDecoder.h.

#define BI_RLE8   1

Definition at line 135 of file nsBMPDecoder.h.

Definition at line 102 of file nsBMPDecoder.h.

Definition at line 124 of file nsBMPDecoder.h.

Definition at line 131 of file nsBMPDecoder.h.

#define LITTLE_TO_NATIVE16 (   x)    x

Definition at line 115 of file nsBMPDecoder.h.

#define LITTLE_TO_NATIVE32 (   x)    x

Definition at line 116 of file nsBMPDecoder.h.

Value:
{ /* {78c61626-4d1f-4843-9364-4652d98ff6e1} */ \
  0x78c61626, \
  0x4d1f, \
  0x4843, \
  { 0x93, 0x64, 0x46, 0x52, 0xd9, 0x8f, 0xf6, 0xe1 } \
}

Definition at line 48 of file nsBMPDecoder.h.

Definition at line 66 of file nsBMPDecoder.h.

Definition at line 67 of file nsBMPDecoder.h.

#define RLE_ESCAPE   0

Definition at line 140 of file nsBMPDecoder.h.

Definition at line 143 of file nsBMPDecoder.h.

Definition at line 142 of file nsBMPDecoder.h.

Definition at line 141 of file nsBMPDecoder.h.

Definition at line 125 of file nsBMPDecoder.h.

Definition at line 123 of file nsBMPDecoder.h.

Definition at line 68 of file nsBMPDecoder.h.


Enumeration Type Documentation

enum ERLEState

enums for mState

Enumerator:
eRLEStateInitial 
eRLEStateNeedSecondEscapeByte 
eRLEStateNeedXDelta 
eRLEStateNeedYDelta 

mStateData will hold x delta

eRLEStateAbsoluteMode 

mStateData will hold count of existing data to read

eRLEStateAbsoluteModePadded 

As above, but another byte of data has to be read as padding.

Definition at line 146 of file nsBMPDecoder.h.


Function Documentation

void Set4BitPixel ( PRUint8 *&  aDecoded,
PRUint8  aData,
PRUint32 aCount,
colorTable aColors 
) [inline]

Sets two (or one if aCount = 1) pixels.

Parameters:
aDecodedwhere the data is stored. Will be moved 3 or 6 bytes, depending on whether one or two pixels are written.
aDataThe values for the two pixels
aCountCurrent count. Is decremented by one or two.

Definition at line 263 of file nsBMPDecoder.h.

{
    PRUint8 idx = aData >> 4;
    SetPixel(aDecoded, idx, aColors);
    if (--aCount > 0) {
        idx = aData & 0xF;
        SetPixel(aDecoded, idx, aColors);
        --aCount;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetPixel ( PRUint8 *&  aDecoded,
PRUint8  aRed,
PRUint8  aGreen,
PRUint8  aBlue 
) [inline]

Sets the pixel data in aDecoded to the given values.

The variable passed in as aDecoded will be moved on 3 bytes!

Definition at line 233 of file nsBMPDecoder.h.

{
#if defined(XP_MAC) || defined(XP_MACOSX)
    *aDecoded++ = 0; // Mac needs this padding byte
#endif
#ifdef USE_RGB
    *aDecoded++ = aRed;
    *aDecoded++ = aGreen;
    *aDecoded++ = aBlue;
#else
    *aDecoded++ = aBlue;
    *aDecoded++ = aGreen;
    *aDecoded++ = aRed;
#endif
}

Here is the caller graph for this function:

void SetPixel ( PRUint8 *&  aDecoded,
PRUint8  idx,
colorTable aColors 
) [inline]

Definition at line 249 of file nsBMPDecoder.h.

{
    PRUint8 red, green, blue;
    red = aColors[idx].red;
    green = aColors[idx].green;
    blue = aColors[idx].blue;
    SetPixel(aDecoded, red, green, blue);
}

Here is the call graph for this function: