source: mainline/uspace/lib/c/include/io/pixel.h@ cd1e3fc0

Last change on this file since cd1e3fc0 was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 717 bytes
Line 
1/*
2 * SPDX-FileCopyrightText: 2011 Petr Koupy
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libc
8 * @{
9 */
10/**
11 * @file
12 */
13
14#ifndef _LIBC_IO_PIXEL_H_
15#define _LIBC_IO_PIXEL_H_
16
17#include <stdint.h>
18
19#define NARROW(channel, bits) \
20 ((channel) >> (8 - (bits)))
21
22#define INVERT(pixel) ((pixel) ^ 0x00ffffff)
23
24#define ALPHA(pixel) ((pixel) >> 24)
25#define RED(pixel) (((pixel) & 0x00ff0000) >> 16)
26#define GREEN(pixel) (((pixel) & 0x0000ff00) >> 8)
27#define BLUE(pixel) ((pixel) & 0x000000ff)
28
29#define PIXEL(a, r, g, b) \
30 ((((unsigned)(a) & 0xff) << 24) | (((unsigned)(r) & 0xff) << 16) | \
31 (((unsigned)(g) & 0xff) << 8) | ((unsigned)(b) & 0xff))
32
33typedef uint32_t pixel_t;
34
35#endif
36
37/** @}
38 */
Note: See TracBrowser for help on using the repository browser.