41#ifndef _CHOMP_BITMAPS_BITMAPS_H_
42#define _CHOMP_BITMAPS_BITMAPS_H_
102 int create (
const char *filename,
int _width,
int _height,
103 int _bitsperpixel = 24,
int _pallength = 0,
104 int32 *_pallette = NULL,
int quiet = 0);
126 long color = 0,
bool index =
false);
130 int thickness = 1,
long color = 0,
The class 'bmpfile' is an elementary interface that can be used to read or create and write images in...
char * header
The header of the bitmap file.
bool palette_allocated
Has the palette memory been allocated?
FILE * fbmp
The binary stream containing the picture file.
void drawsegment(int x1, int y1, int x2, int y2, int thickness=1, long color=0, bool index=false)
Draws a segment built of pixels, with the desired thickness.
int current
The current row.
void invertedpicture(int _inverted=1)
Sets processing of the invertec picture, as stored in the file.
void drawpixel(int x, int y, int thickness=1, long color=0, bool index=false)
Writes a thick pixel and returns its true color.
int writeheader(void)
Writes the header to the file.
~bmpfile()
The destructor.
unsigned char * defined
Flags that indicate which rows have been defined.
int bitsperpixel
The number of bits per pixel in the bitmap file.
int getbitsperpixel(void)
Returns the current number of bits per pixel in the picture.
int create(const char *filename, int _width, int _height, int _bitsperpixel=24, int _pallength=0, int32 *_pallette=NULL, int quiet=0)
Create a bmp file (only 1- and 24-bit supported - sorry!).
void flush(void)
Flushes the buffers to update the contents BMP file.
int firstundefinedbyte
The number of the first undefined byte in the BMP file that has not yet been written after creating t...
unsigned char ** rowbuf
The rows of the picture stored in the memory.
int firstundefinedrow
The number of the first row undefined in the picture.
int height
The actual height of the picture stored in the file.
int rows
The number of rows allocated in the memory.
unsigned rowlength
The length of a row in the bitmap (in bytes)
int picture_height(void)
Returns the height of the picture.
int bmpstart
The offset of the bitmap beginning in the file.
int inverted
A flag that remembers whether the inverted picture should be processed.
int width
The actual width of the picture stored in the file.
unsigned char fillbyte
The value of the byte to fill empty lines (background).
char * changed
Flags that indicate which rows have been changed.
int32 getpixel(int x, int y, bool index=false)
Reads the true color of a pixel or its index if 'index = true'.
unsigned getrowlength() const
Returns the length of a row stored in the memory.
int readrow(int row)
Reads the current row from the file to the memory.
int32 * palette
The palette buffer.
unsigned char * getrow(int row)
Returns the pointer to the given row stored in the memory.
bmpfile(int _rows=20)
The only allowed constructor.
int picture_width(void)
Returns the width of the picture.
int32 putpixel(int x, int y, long color=0, bool index=false)
Writes a pixel and returns its true color.
long rows_written
The counter of rows written to a BMP file.
int getpallength(void)
Returns the length of the current color palette (if any).
int32 y_resolution
The Y resolution of the picture (in dpi).
int pallength
Palette length (in 32-bit words).
int32 * getpalette(void)
Returns a pointer to the current color palette (if any).
long rows_read
The counter of rows read from a BMP file.
int32 x_resolution
The X resolution of the picture (in dpi).
int fileinuse
The type of the bitmap file: 0 = none, 1 = read, 2 = write, 3 = r/w.
int open(const char *filename, int mode=0, int quiet=0)
Opens a bmp file for reading (mode = bmpReadOnly) or editing (mode = bmpReadWrite).
int writerow(int row)
Writes the current row from the memory to the file.
int * rownumber
The numbers of rows stored in the memory.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
int int32
Defines the type of 32-bit integers.
This namespace contains the entire CHomP library interface.
This file contains some useful functions related to the text input/output procedures.