Class: SDL2::PixelFormat
- Inherits:
-
Object
- Object
- SDL2::PixelFormat
- Defined in:
- video.c
Constant Summary
- FORMATS =
Array of all available formats
-
- UNKNOWN =
PixelFormat: Unused - reserved by SDL
-
- INDEX1LSB =
format
- INDEX1MSB =
format
- INDEX4LSB =
format
- INDEX4MSB =
format
- INDEX8 =
format
- RGB332 =
format
- RGB444 =
format
- RGB555 =
format
- BGR555 =
format
- ARGB4444 =
format
- RGBA4444 =
format
- ABGR4444 =
format
- BGRA4444 =
format
- ARGB1555 =
format
- RGBA5551 =
format
- ABGR1555 =
format
- BGRA5551 =
format
- RGB565 =
format
- BGR565 =
format
- RGB24 =
format
- BGR24 =
format
- RGB888 =
format
- RGBX8888 =
format
- BGR888 =
format
- BGRX8888 =
format
- ARGB8888 =
format
- RGBA8888 =
format
- ABGR8888 =
format
- BGRA8888 =
format
- ARGB2101010 =
format
- YV12 =
format
- IYUV =
format
- YUY2 =
format
- UYVY =
format
- YVYU =
format
Instance Attribute Summary (collapse)
- - (Object) format readonly
Instance Method Summary (collapse)
-
- (boolean) ==(other)
Return true if two pixel format is the same format.
-
- (Boolean) alpha?
Return true if the pixel format have an alpha channel.
-
- (Integer) bits_per_pixel
(also: #bpp)
Get the number of bits per pixel.
-
- (Integer) bytes_per_pixel
Get the number of bytes per pixel.
-
- (Boolean) fourcc?
Return true if the pixel format is not indexed, and not RGB(A), for example, the pixel format is YUV.
-
- (Boolean) indexed?
Return true if the pixel format have a palette.
- - (Object) initialize constructor
-
- (String) inspect
Inspection string.
-
- (Integer) layout
Get the channel bit pattern of the pixel format.
-
- (String) name
Get the human readable name of the pixel format.
-
- (Integer) order
Get the ordering of channels or bits in the pixel format.
- - (Object) type
Constructor Details
- (Object) initialize
2477 2478 2479 2480 2481 |
# File 'video.c', line 2477
static VALUE PixelForamt_initialize(VALUE self, VALUE format)
{
rb_iv_set(self, "@format", format);
return Qnil;
}
|
Instance Attribute Details
- (Object) format (readonly)
Instance Method Details
- (boolean) ==(other)
2573 2574 2575 2576 2577 2578 2579 |
# File 'video.c', line 2573
static VALUE PixelFormat_eq(VALUE self, VALUE other)
{
if (!rb_obj_is_kind_of(other, cPixelFormat))
return Qfalse;
return INT2BOOL(rb_iv_get(self, "@format") == rb_iv_get(other, "@format"));
}
|
- (Boolean) alpha?
Return true if the pixel format have an alpha channel.
2553 2554 2555 2556 |
# File 'video.c', line 2553
static VALUE PixelFormat_alpha_p(VALUE self)
{
return INT2BOOL(SDL_ISPIXELFORMAT_ALPHA(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Integer) bits_per_pixel Also known as: bpp
Get the number of bits per pixel.
2527 2528 2529 2530 |
# File 'video.c', line 2527
static VALUE PixelFormat_bits_per_pixel(VALUE self)
{
return INT2NUM(SDL_BITSPERPIXEL(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Integer) bytes_per_pixel
Get the number of bytes per pixel.
2537 2538 2539 2540 |
# File 'video.c', line 2537
static VALUE PixelFormat_bytes_per_pixel(VALUE self)
{
return INT2NUM(SDL_BYTESPERPIXEL(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Boolean) fourcc?
Return true if the pixel format is not indexed, and not RGB(A), for example, the pixel format is YUV.
2562 2563 2564 2565 |
# File 'video.c', line 2562
static VALUE PixelFormat_fourcc_p(VALUE self)
{
return INT2BOOL(SDL_ISPIXELFORMAT_FOURCC(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Boolean) indexed?
Return true if the pixel format have a palette.
2545 2546 2547 2548 |
# File 'video.c', line 2545
static VALUE PixelFormat_indexed_p(VALUE self)
{
return INT2BOOL(SDL_ISPIXELFORMAT_INDEXED(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (String) inspect
Returns inspection string
2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 |
# File 'video.c', line 2582
static VALUE PixelFormat_inspect(VALUE self)
{
Uint32 format = NUM2UINT(rb_iv_get(self, "@format"));
return rb_sprintf("<%s: %s type=%d order=%d layout=%d"
" bits=%d bytes=%d indexed=%s alpha=%s fourcc=%s>",
rb_obj_classname(self),
SDL_GetPixelFormatName(format),
SDL_PIXELTYPE(format), SDL_PIXELORDER(format), SDL_PIXELLAYOUT(format),
SDL_BITSPERPIXEL(format), SDL_BYTESPERPIXEL(format),
INT2BOOLCSTR(SDL_ISPIXELFORMAT_INDEXED(format)),
INT2BOOLCSTR(SDL_ISPIXELFORMAT_ALPHA(format)),
INT2BOOLCSTR(SDL_ISPIXELFORMAT_FOURCC(format)));
}
|
- (Integer) layout
Get the channel bit pattern of the pixel format.
2517 2518 2519 2520 |
# File 'video.c', line 2517
static VALUE PixelFormat_layout(VALUE self)
{
return UINT2NUM(SDL_PIXELLAYOUT(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (String) name
Get the human readable name of the pixel format
2497 2498 2499 2500 |
# File 'video.c', line 2497
static VALUE PixelFormat_name(VALUE self)
{
return utf8str_new_cstr(SDL_GetPixelFormatName(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Integer) order
Get the ordering of channels or bits in the pixel format.
2507 2508 2509 2510 |
# File 'video.c', line 2507
static VALUE PixelFormat_order(VALUE self)
{
return UINT2NUM(SDL_PIXELORDER(NUM2UINT(rb_iv_get(self, "@format"))));
};
|
- (Object) type
2483 2484 2485 2486 |
# File 'video.c', line 2483
static VALUE PixelFormat_type(VALUE self)
{
return UINT2NUM(SDL_PIXELTYPE(NUM2UINT(rb_iv_get(self, "@format"))));
}
|