Top | ![]() |
![]() |
![]() |
![]() |
#define | oil_min() |
#define | oil_max() |
#define | oil_divide_255() |
#define | oil_argb() |
#define | oil_argb_noclamp() |
#define | oil_argb_A() |
#define | oil_argb_G() |
#define | oil_argb_B() |
#define | oil_argb_R() |
#define | oil_muldiv_255() |
#define | oil_clamp_255() |
#define | OIL_GET() |
#define | OIL_OFFSET() |
#define | OIL_INCREMENT() |
#define oil_divide_255(x) ((((x)+128) + (((x)+128)>>8))>>8)
Divides x
by 255 in a way that is compatible with the pixel
operations in Liboil. The number 65025 is 255*255.
Evaluates to x
divided by 255.
#define oil_argb(a,r,g,b)
Creates a Liboil ARGB value from individual components. Clamps each component to [0,255].
Evaluates to the ARGB value
#define oil_argb_noclamp(a,r,g,b)
Creates a Liboil ARGB value from individual components. Does not clamp components.
Evaluates to the ARGB value
#define oil_argb_A(color) (((color)>>24)&0xff)
Extracts the alpha component from color
.
Evaluates to the alpha component
#define oil_argb_G(color) (((color)>>8)&0xff)
Extracts the green component from color
.
Evaluates to the green component
#define oil_argb_B(color) (((color)>>0)&0xff)
Extracts the blue component from color
.
Evaluates to the blue component
#define oil_argb_R(color) (((color)>>16)&0xff)
Extracts the red component from color
.
Evaluates to the red component
#define oil_muldiv_255(a,b) oil_divide_255((a)*(b))
Multiplies a
and b
and divides the result by 255 in a way that
is compatible with the pixel operations in Liboil.
Evaluates to the result.
#define oil_clamp_255(x) oil_max(0,oil_min((x),255))
Clamps x
to the range [0,255].
Evaluates to the clamped value.
#define OIL_GET(ptr, offset, type) (*(type *)((uint8_t *)(ptr) + (offset)) )
Offsets ptr
by offset
number of bytes, and dereferences it
as type type
. Note that the offset is in bytes, and not in
the size of the pointer type.
#define OIL_OFFSET(ptr, offset) ((void *)((uint8_t *)(ptr) + (offset)) )
Add offset
bytes to the pointer ptr
.