microui  14.5.5
microui
Macros
ui_color.h File Reference

Provides macros to manipulate the color channels of the ARGB8888 pixel format. More...

Go to the source code of this file.

Macros

#define COLOR_ARGB8888_CHANNEL_SIZE   8
 Mask of a channel in ARGB8888 format.
 
#define COLOR_ARGB8888_CHANNEL_MASK    ((1 << COLOR_ARGB8888_CHANNEL_SIZE) - 1)
 Mask of a channel in ARGB8888 format.
 
#define COLOR_CHANNEL_MASK(format, channel)    ((1 << COLOR_CHANNEL_SIZE(format, channel)) - 1)
 Mask of a channel. More...
 
#define COLOR_CHANNEL_SIZE(format, channel)    COLOR_ ## format ## _ ## channel ## _SIZE
 Size of a channel. More...
 
#define COLOR_CHANNEL_OFFSET(format, channel)    COLOR_ ## format ## _ ## channel ## _OFFSET
 Offset of a channel. More...
 
#define COLOR_ARGB8888_ALPHA_SIZE   COLOR_ARGB8888_CHANNEL_SIZE
 Alpha channel size for ARGB8888 format.
 
#define COLOR_ARGB8888_ALPHA_OFFSET   24
 Alpha channel offset for ARGB8888 format.
 
#define COLOR_ARGB8888_ALPHA_MASK    COLOR_CHANNEL_MASK(ARGB8888, ALPHA)
 Alpha channel mask for ARGB8888 format.
 
#define COLOR_ARGB8888_RED_SIZE   COLOR_ARGB8888_CHANNEL_SIZE
 Red channel size for ARGB8888 format.
 
#define COLOR_ARGB8888_RED_OFFSET   16
 Red channel offset for ARGB8888 format.
 
#define COLOR_ARGB8888_RED_MASK    COLOR_CHANNEL_MASK(ARGB8888, RED)
 Red channel mask for ARGB8888 format.
 
#define COLOR_ARGB8888_GREEN_SIZE   COLOR_ARGB8888_CHANNEL_SIZE
 Green channel size for ARGB8888 format.
 
#define COLOR_ARGB8888_GREEN_OFFSET   8
 Green channel offset for ARGB8888 format.
 
#define COLOR_ARGB8888_GREEN_MASK    COLOR_CHANNEL_MASK(ARGB8888, GREEN)
 Green channel mask for ARGB8888 format.
 
#define COLOR_ARGB8888_BLUE_SIZE   COLOR_ARGB8888_CHANNEL_SIZE
 Blue channel size for ARGB8888 format.
 
#define COLOR_ARGB8888_BLUE_OFFSET   0
 Blue channel offset for ARGB8888 format.
 
#define COLOR_ARGB8888_BLUE_MASK    COLOR_CHANNEL_MASK(ARGB8888, BLUE)
 Blue channel mask for ARGB8888 format.
 
#define COLOR_GET_CHANNEL(color, format, channel)
 Gets a channel value from a color. More...
 
#define COLOR_SET_COLOR(alpha, red, green, blue, format)
 Sets a color. More...
 

Detailed Description

Provides macros to manipulate the color channels of the ARGB8888 pixel format.

Author
MicroEJ Developer Team
Version
14.5.5

Definition in file ui_color.h.

Macro Definition Documentation

◆ COLOR_CHANNEL_MASK

#define COLOR_CHANNEL_MASK (   format,
  channel 
)     ((1 << COLOR_CHANNEL_SIZE(format, channel)) - 1)

Mask of a channel.

Parameters
[in]formatThe color format
[in]channelThe channel

Definition at line 43 of file ui_color.h.

◆ COLOR_CHANNEL_OFFSET

#define COLOR_CHANNEL_OFFSET (   format,
  channel 
)     COLOR_ ## format ## _ ## channel ## _OFFSET

Offset of a channel.

Parameters
[in]formatThe color format
[in]channelThe channel

Definition at line 61 of file ui_color.h.

◆ COLOR_CHANNEL_SIZE

#define COLOR_CHANNEL_SIZE (   format,
  channel 
)     COLOR_ ## format ## _ ## channel ## _SIZE

Size of a channel.

Parameters
[in]formatThe color format
[in]channelThe channel

Definition at line 52 of file ui_color.h.

◆ COLOR_GET_CHANNEL

#define COLOR_GET_CHANNEL (   color,
  format,
  channel 
)
Value:
(uint8_t)( \
((color) >> COLOR_CHANNEL_OFFSET(format, channel)) \
&COLOR_CHANNEL_MASK(format, channel) \
)
#define COLOR_CHANNEL_MASK(format, channel)
Mask of a channel.
Definition: ui_color.h:43
#define COLOR_CHANNEL_OFFSET(format, channel)
Offset of a channel.
Definition: ui_color.h:61

Gets a channel value from a color.

param color: The color from which to retrieve a channel param format: The color format (i.e. ARGB8888, etc...)

Definition at line 134 of file ui_color.h.

◆ COLOR_SET_COLOR

#define COLOR_SET_COLOR (   alpha,
  red,
  green,
  blue,
  format 
)
Value:
(uint32_t)(0 \
| (((alpha)&COLOR_ ## format ## _ALPHA_MASK) \
<< (COLOR_ ## format ## _ALPHA_OFFSET)) \
| (((red)&COLOR_ ## format ## _RED_MASK) \
<< (COLOR_ ## format ## _RED_OFFSET)) \
| (((green)&COLOR_ ## format ## _GREEN_MASK) \
<< (COLOR_ ## format ## _GREEN_OFFSET)) \
| (((blue)&COLOR_ ## format ## _BLUE_MASK) \
<< (COLOR_ ## format ## _BLUE_OFFSET)) \
)

Sets a color.

param alpha: The alpha channel value param red: The red channel value param green: The green channel value param blue: The blue channel value param format: The color format (i.e. ARGB8888, etc...)

Definition at line 149 of file ui_color.h.