Class: SDL::PixelFormat
- Inherits:
-
Object
- Object
- SDL::PixelFormat
- Defined in:
- ext/sdl/sdl.c
Instance Method Summary collapse
-
#get_rgba(pixel) ⇒ Object
// TODO: phase these out…
- #map_rgba(r, g, b, a) ⇒ Object
Instance Method Details
#get_rgba(pixel) ⇒ Object
// TODO: phase these out… move to renderer or top of SDL
391 392 393 394 395 396 397 398 |
# File 'ext/sdl/sdl.c', line 391
static VALUE PixelFormat_get_rgba(VALUE self, VALUE pixel) {
DEFINE_SELF(PixelFormat, format, self);
Uint8 r, g, b, a;
SDL_GetRGBA(NUM2UINT(pixel), format, &r, &g, &b, &a);
return rb_ary_new3(4, UINT2NUM(r), UINT2NUM(g), UINT2NUM(b), UINT2NUM(a));
}
|
#map_rgba(r, g, b, a) ⇒ Object
383 384 385 386 387 388 389 |
# File 'ext/sdl/sdl.c', line 383
static VALUE PixelFormat_map_rgba(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a) {
DEFINE_SELF(PixelFormat, format, self);
return UINT2NUM(SDL_MapRGBA(format,
NUM2UINT8(r), NUM2UINT8(g),
NUM2UINT8(b), NUM2UINT8(a)));
}
|