Liboil Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#define oil_min (x,y) #define oil_max (x,y) #define oil_divide_255 (x) #define oil_argb (a,r,g,b) #define oil_argb_noclamp (a,r,g,b) #define oil_argb_A (color) #define oil_argb_G (color) #define oil_argb_B (color) #define oil_argb_R (color) #define oil_muldiv_255 (a,b) #define oil_clamp_255 (x) #define OIL_GET (ptr, offset, type) #define OIL_OFFSET (ptr, offset) #define OIL_INCREMENT (ptr, offset)
#define oil_min(x,y) ((x)<(y)?(x):(y))
Evaluates to the minimum of x
and y
.
|
a value |
|
a value |
#define oil_max(x,y) ((x)>(y)?(x):(y))
Evaluates to the maximum of x
and y
.
|
a value |
|
a value |
#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.
|
a value in the range [0,65025] |
#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
|
alpha component |
|
red component |
|
green component |
|
blue component |
#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
|
alpha component |
|
red component |
|
green component |
|
blue component |
#define oil_argb_A(color) (((color)>>24)&0xff)
Extracts the alpha component from color
.
Evaluates to the alpha component
|
an ARGB value |
#define oil_argb_G(color) (((color)>>8)&0xff)
Extracts the green component from color
.
Evaluates to the green component
|
an ARGB value |
#define oil_argb_B(color) (((color)>>0)&0xff)
Extracts the blue component from color
.
Evaluates to the blue component
|
an ARGB value |
#define oil_argb_R(color) (((color)>>16)&0xff)
Extracts the red component from color
.
Evaluates to the red component
|
an ARGB value |
#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.
|
a value in the range [0,255] |
|
a value in the range [0,255] |
#define oil_clamp_255(x) oil_max(0,oil_min((x),255))
Clamps x
to the range [0,255].
Evaluates to the clamped value.
|
a 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
.
|
|
|