Gosu
Public Member Functions | List of all members
Gosu::Bitmap Class Reference

Rectangular area of pixels, each represented by a Color value. More...

Public Member Functions

 Bitmap ()
 
 Bitmap (unsigned w, unsigned h, Color c=Color::NONE)
 
unsigned width () const
 
unsigned height () const
 
void swap (Bitmap &other)
 
void resize (unsigned width, unsigned height, Color c=Color::NONE)
 
Color get_pixel (unsigned x, unsigned y) const
 Returns the color at the specified position. More...
 
void set_pixel (unsigned x, unsigned y, Color c)
 Sets the pixel at the specified position to a color. More...
 
void insert (const Bitmap &source, int x, int y)
 Inserts a bitmap at the given position. More...
 
void insert (const Bitmap &source, int x, int y, unsigned src_x, unsigned src_y, unsigned src_width, unsigned src_height)
 Inserts a portion of a bitmap at the given position. More...
 
const Colordata () const
 Direct access to the array of color values. More...
 
Colordata ()
 

Detailed Description

Rectangular area of pixels, each represented by a Color value.

Provides minimal drawing functionality and serves as a temporary holder for graphical resources which are usually turned into Images later. Has (expensive) value semantics.

Definition at line 19 of file Bitmap.hpp.

Constructor & Destructor Documentation

◆ Bitmap() [1/2]

Gosu::Bitmap::Bitmap ( )

Definition at line 25 of file Bitmap.hpp.

◆ Bitmap() [2/2]

Gosu::Bitmap::Bitmap ( unsigned  w,
unsigned  h,
Color  c = Color::NONE 
)

Definition at line 30 of file Bitmap.hpp.

Member Function Documentation

◆ data() [1/2]

const Color* Gosu::Bitmap::data ( ) const

Direct access to the array of color values.

May be useful for optimized OpenGL operations.

Definition at line 76 of file Bitmap.hpp.

◆ data() [2/2]

Color* Gosu::Bitmap::data ( )

◆ get_pixel()

Color Gosu::Bitmap::get_pixel ( unsigned  x,
unsigned  y 
) const

Returns the color at the specified position.

x and y must be on the bitmap.

Definition at line 51 of file Bitmap.hpp.

◆ height()

unsigned Gosu::Bitmap::height ( ) const

Definition at line 40 of file Bitmap.hpp.

References Gosu::Color::NONE, resize(), swap(), and width().

◆ insert() [1/2]

void Gosu::Bitmap::insert ( const Bitmap source,
int  x,
int  y 
)

Inserts a bitmap at the given position.

Parts of the inserted bitmap that would be outside of the target bitmap will be clipped away.

Referenced by set_pixel().

◆ insert() [2/2]

void Gosu::Bitmap::insert ( const Bitmap source,
int  x,
int  y,
unsigned  src_x,
unsigned  src_y,
unsigned  src_width,
unsigned  src_height 
)

Inserts a portion of a bitmap at the given position.

Parts of the inserted bitmap that would be outside of the target bitmap will be clipped away.

◆ resize()

void Gosu::Bitmap::resize ( unsigned  width,
unsigned  height,
Color  c = Color::NONE 
)

Referenced by height().

◆ set_pixel()

void Gosu::Bitmap::set_pixel ( unsigned  x,
unsigned  y,
Color  c 
)

Sets the pixel at the specified position to a color.

x and y must be on the bitmap.

Definition at line 58 of file Bitmap.hpp.

References insert().

◆ swap()

void Gosu::Bitmap::swap ( Bitmap other)

Referenced by height().

◆ width()

unsigned Gosu::Bitmap::width ( ) const

Definition at line 35 of file Bitmap.hpp.

Referenced by height().


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