Skip to content

Commit

Permalink
feat(color): added helper to get color space and color pixel format
Browse files Browse the repository at this point in the history
  • Loading branch information
Icarus113 committed Oct 30, 2023
1 parent 7efcf06 commit 16d8b7d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/hal/include/hal/color_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,14 @@ typedef enum {
/*---------------------------------------------------------------
Color Space Struct Type
---------------------------------------------------------------*/
#define COLOR_PIXEL_FORMAT_BITWIDTH 24 ///< Bitwidth of the `color_space_format_t:pixel_format` field
#define COLOR_SPACE_BITWIDTH 8 ///< Bitwidth of the `color_space_format_t:color_space` field
///< Bitwidth of the `color_space_format_t:color_space` field
#define COLOR_SPACE_BITWIDTH 8
///< Bitwidth of the `color_space_format_t:pixel_format` field
#define COLOR_PIXEL_FORMAT_BITWIDTH 24
///< Helper to get `color_space_format_t:color_space` from its `color_space_pixel_format_t:color_type_id`
#define COLOR_SPACE_TYPE(color_type_id) (((color_type_id) >> COLOR_PIXEL_FORMAT_BITWIDTH) & ((1 << COLOR_SPACE_BITWIDTH) - 1))
///< Helper to get `color_space_format_t:pixel_format` from its `color_space_pixel_format_t:color_type_id`
#define COLOR_PIXEL_FORMAT(color_type_id) ((color_type_id) & ((1 << COLOR_PIXEL_FORMAT_BITWIDTH) - 1))

/**
* @brief Color Space Info Structure
Expand Down

0 comments on commit 16d8b7d

Please sign in to comment.