P4Image

A class that provides the ability to work with color images in P4 format. NB: The format is raw binary.

Note: This class supports indexing and assigning values ​​to specific pixels via 1D or 2D indexing, and provides P4 file loading/saving capabilities. According to the accepted convention, in the original description of the format inside the Netpbm package, the extension of these files should be *.pbm.

Typical usage:

// create empty P4 image
auto img = new P4Image; 
// load from file 					
img.load(`Lenna.pbm`);   					
// set pixel at (10; 10) as white
img[10, 10] = new RGBColor(255, 255, 255); 	
// get 11th pixel
img[10].writeln;							
// save to file
img.save(`Lenna2.pbm`);						

// new P4 image, size is 10x10, all pixels black
auto img2 = new P4Image(10, 10, new RGBColor(0, 0, 0)); 
// increase two times
img2[10] = img2[10] * 2; 									
// save as pbm file
img2.save(`test.pbm`);

Members

Functions

clearBit
auto clearBit(int value, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
getBit
auto getBit(int value, int n)
Undocumented in source. Be warned that the author may not have intended to support it.
loader
void loader()
Undocumented in source. Be warned that the author may not have intended to support it.
saver
void saver()
Undocumented in source. Be warned that the author may not have intended to support it.
setBit
auto setBit(int value, int n)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin addConstructor!(PixMapFormat.PBM_BINARY)
Undocumented in source.

Variables

BLACK
auto BLACK;
Undocumented in source.
WHITE
auto WHITE;
Undocumented in source.

Inherited Members

From PixMapFile

_file
File _file;
Undocumented in source.
_header
PixMapFormat _header;
Undocumented in source.
loader
void loader()
Undocumented in source.
saver
void saver()
Undocumented in source.
load
void load(string filename)

Basic file loading procedure

save
void save(string filename)

Basic file saving procedure

isBinaryFormat
bool isBinaryFormat()

Is raw format ?

isTextFormat
bool isTextFormat()

Is text format ?

image
PixMapImage image()

Get image object as PixMapImage object

image
void image(PixMapImage image)

Set image object as PixMapImage object

Meta