ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Pixel Class Reference

#include <pixel.h>

Public Member Functions

 Pixel () ROLAND_DELETE~Pixel() ROLAND_DELETE inline static const Color get(SDL_Surface *surface
 
 SDL_LockSurface (surface)
 
 switch (bpp)
 
 SDL_GetRGBA (color, surface->format,&r,&g,&b,&a)
 
 SDL_UnlockSurface (surface)
 
return Color (r, g, b, a)
 

Static Public Member Functions

static void put (SDL_Surface *surface, Sint32 x, Sint32 y, const Color &color)
 
static Uint32 alpha32 (Uint32 src, Uint32 dst, Uint8 a)
 
static Uint16 alpha16 (Uint16 src, Uint16 dst, Uint8 a, const SDL_PixelFormat *f)
 
static void putAlpha (SDL_Surface *surface, Sint32 x, Sint32 y, const Color &color)
 

Public Attributes

Sint16 x
 
Sint16 Sint16 y
 
Uint8 * p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp
 
Uint32 color = 0
 
Uint8 r
 
Uint8 g
 
Uint8 b
 
Uint8 a
 

Constructor & Destructor Documentation

Pixel ( ) const

Checks a pixels color of an SDL_Surface.

Parameters
surfacean SDL_Surface where to check for a pixel color.
xthe x coordinate on the surface.
ythe y coordinate on the surface.
Returns
a color of a pixel.

Member Function Documentation

static Uint16 alpha16 ( Uint16  src,
Uint16  dst,
Uint8  a,
const SDL_PixelFormat *  f 
)
inlinestatic

Blends two 16 bit colors together.

Parameters
srcthe source color.
dstthe destination color.
aalpha.

References Pixel::a, Pixel::b, Pixel::g, and Pixel::r.

Referenced by Pixel::putAlpha().

static Uint32 alpha32 ( Uint32  src,
Uint32  dst,
Uint8  a 
)
inlinestatic

Blends two 32 bit colors together.

Parameters
srcthe source color.
dstthe destination color.
aalpha.

References Pixel::a, Pixel::b, Pixel::g, and Pixel::r.

Referenced by CanvasStd::hLine(), Pixel::putAlpha(), and CanvasStd::vLine().

return Color ( r  ,
g  ,
b  ,
a   
)
static void put ( SDL_Surface *  surface,
Sint32  x,
Sint32  y,
const Color color 
)
inlinestatic

Puts a pixel on an SDL_Surface.

Parameters
xthe x coordinate on the surface.
ythe y coordinate on the surface.
colorthe color the pixel should be in.

References Color::b(), Color::g(), Pixel::p, Color::r(), Pixel::SDL_LockSurface(), and Pixel::SDL_UnlockSurface().

Referenced by CanvasStd::clearClipRect(), Image::genTexture(), and CanvasStd::line().

static void putAlpha ( SDL_Surface *  surface,
Sint32  x,
Sint32  y,
const Color color 
)
inlinestatic

Puts a pixel on an SDL_Surface with alpha

Parameters
xthe x coordinate on the surface.
ythe y coordinate on the surface.
colorthe color the pixel should be in.

References Color::a(), Pixel::alpha16(), Pixel::alpha32(), Color::b(), Pixel::b, Color::g(), Pixel::g, Pixel::p, Color::r(), Pixel::r, Pixel::SDL_LockSurface(), and Pixel::SDL_UnlockSurface().

Referenced by CanvasStd::clearClipRect(), and CanvasStd::line().

SDL_GetRGBA ( color  ,
surface->  format,
r,
g,
b,
a 
)
SDL_LockSurface ( surface  )

Referenced by Pixel::put(), and Pixel::putAlpha().

SDL_UnlockSurface ( surface  )

Referenced by Pixel::put(), and Pixel::putAlpha().

switch ( bpp  )
inline

References Pixel::color, and Pixel::p.

Member Data Documentation

Uint8 a

Referenced by Pixel::alpha16(), and Pixel::alpha32().

Uint8 b
Uint32 color = 0

Referenced by Pixel::switch().

Uint8 g
Uint8* p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp
Uint8 r
Sint16 x
Sint16 Sint16 y
Initial value:
{
Sint32 bpp = surface->format->BytesPerPixel

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