LevelS C++ support library  3.83
Public Member Functions | List of all members
LS_Image Class Reference

#include <ls_image.h>

Public Member Functions

 LS_Image (int xres, int yres)
 
void fill (const Colour &col)
 
void set_font (const MP_Font &fnt)
 
void annotate (int xpos, int ypos, const Colour &col, const std::string &text, int scale=1)
 
void annotate_centered (int xpos, int ypos, const Colour &col, const std::string &text, int scale=1)
 
void put_pixel (tsize i, tsize j, const Colour &col)
 
Colour8 get_pixel (tsize i, tsize j)
 
void write_TGA (const std::string &file) const
 
void write_TGA_rle (const std::string &file) const
 
void write_PPM (const std::string &file) const
 

Detailed Description

Class for creating and storing image files.

Definition at line 103 of file ls_image.h.

Constructor & Destructor Documentation

◆ LS_Image()

LS_Image::LS_Image ( int  xres,
int  yres 
)

Creates an image object with a resolution of xres by yres.

Definition at line 134 of file ls_image.cc.

Member Function Documentation

◆ fill()

void LS_Image::fill ( const Colour &  col)
inline

Fills the entire image with colour col.

Definition at line 121 of file ls_image.h.

◆ set_font()

void LS_Image::set_font ( const MP_Font &  fnt)

Sets the font used for annotations to fnt.

Definition at line 152 of file ls_image.cc.

◆ annotate()

void LS_Image::annotate ( int  xpos,
int  ypos,
const Colour &  col,
const std::string &  text,
int  scale = 1 
)

Outputs the string text in colour col. xpos, ypos is the lower left corner; the font is scaled by scale.

Definition at line 137 of file ls_image.cc.

◆ annotate_centered()

void LS_Image::annotate_centered ( int  xpos,
int  ypos,
const Colour &  col,
const std::string &  text,
int  scale = 1 
)

Outputs the string text centered at position xpos, ypos in colour col. The font is scaled by scale.

Definition at line 144 of file ls_image.cc.

◆ put_pixel()

void LS_Image::put_pixel ( tsize  i,
tsize  j,
const Colour &  col 
)
inline

Sets the pixel i, j, to the colour col.

Definition at line 134 of file ls_image.h.

◆ get_pixel()

Colour8 LS_Image::get_pixel ( tsize  i,
tsize  j 
)
inline

Returns the colour of the pixel i, j, or black if the pixel lies outside of the image.

Definition at line 141 of file ls_image.h.

◆ write_TGA()

void LS_Image::write_TGA ( const std::string &  file) const

Writes the image to file in uncompressed TGA format.

Definition at line 155 of file ls_image.cc.

◆ write_TGA_rle()

void LS_Image::write_TGA_rle ( const std::string &  file) const

Writes the image to file in run-length encoded TGA format.

Definition at line 215 of file ls_image.cc.

◆ write_PPM()

void LS_Image::write_PPM ( const std::string &  file) const

Writes the image to file in binary PPM format.

Definition at line 265 of file ls_image.cc.


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

Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library