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 getPixel (unsigned x, unsigned y) const
 Returns the color at the specified position. More...
 
void setPixel (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 srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight)
 Inserts a portion of a bitmap at the given position. More...
 
const Colordata () const
 Direct access to the array of color values. More...
 
Colordata ()
 
GOSU_DEPRECATED void fill (Color c)
 
GOSU_DEPRECATED void replace (Color oldColor, Color newColor)
 

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 20 of file Bitmap.hpp.

Constructor & Destructor Documentation

Gosu::Bitmap::Bitmap ( )

Definition at line 26 of file Bitmap.hpp.

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

Definition at line 27 of file Bitmap.hpp.

Member Function Documentation

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

Direct access to the array of color values.

May be useful for optimized OpenGL operations.

Definition at line 57 of file Bitmap.hpp.

Color* Gosu::Bitmap::data ( )

Definition at line 58 of file Bitmap.hpp.

GOSU_DEPRECATED void Gosu::Bitmap::fill ( Color  c)
Color Gosu::Bitmap::getPixel ( unsigned  x,
unsigned  y 
) const

Returns the color at the specified position.

x and y must be on the bitmap.

Definition at line 38 of file Bitmap.hpp.

unsigned Gosu::Bitmap::height ( ) const

Definition at line 30 of file Bitmap.hpp.

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.

void Gosu::Bitmap::insert ( const Bitmap source,
int  x,
int  y,
unsigned  srcX,
unsigned  srcY,
unsigned  srcWidth,
unsigned  srcHeight 
)

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.

GOSU_DEPRECATED void Gosu::Bitmap::replace ( Color  oldColor,
Color  newColor 
)
void Gosu::Bitmap::resize ( unsigned  width,
unsigned  height,
Color  c = Color::NONE 
)
void Gosu::Bitmap::setPixel ( 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 42 of file Bitmap.hpp.

void Gosu::Bitmap::swap ( Bitmap other)
unsigned Gosu::Bitmap::width ( ) const

Definition at line 29 of file Bitmap.hpp.


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