XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
color.h File Reference
#include <stdint.h>
#include <_xeneva.h>
#include "chitralekha.h"
Include dependency graph for color.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WHITE   0xFFFFFFFF
 Color codes.
 
#define SILVER   0xFFC0C0C0
 
#define GRAY   0xFF808080
 
#define BLACK   0xFF000000
 
#define RED   0xFFFF0000
 
#define MAROON   0xFF800000
 
#define YELLOW   0xFFFFFF00
 
#define OLIVE   0xFF808000
 
#define LIME   0xFF00FF00
 
#define GREEN   0xFF008000
 
#define AQUA   0xFF00FFFF
 
#define TEAL   0xFF008080
 
#define BLUE   0xFF0000FF
 
#define NAVY   0xFF000080
 
#define FUCHSIA   0xFFFF00FF
 
#define PURPLE   0xFF800080
 
#define DARKRED   0xFF8B0000
 more colors are needed!!
 
#define BROWN   0xFFA52A2A
 
#define FIREBRICK   0xFFB22222
 
#define CRIMSON   0xFFDC143C
 
#define TOMATO   0xFFFF6347
 
#define CORAL   0xFFFF7F50
 
#define INDIANRED   0xFFCD5C5C
 
#define LIGHTCORAL   0xFFF08080
 
#define DARKSALMON   0xFFE9967A
 
#define SALMON   0xFFFA8072
 
#define ORANGERED   0xFFFF4500
 
#define DARKORANGE   0xFFFF8C00
 
#define ORANGE   0xFFFFA500
 
#define GOLD   0xFFFFD700
 
#define DARKGOLDENROD   0xFFB8860B
 
#define GOLDENROD   0xFFDAA520
 
#define PALEGOLDENROD   0xFFEEE8AA
 
#define DARKKHAKI   0xFFBDB76B
 
#define KHAKI   0xFFF0E68C
 
#define DARKGREEN   0xFF006400
 
#define PALEGREEN   0xFF98FB98
 
#define LIGHTSILVER   0xFFD9D9D9
 
#define DESKBLUE   0xFF5B7492
 
#define MENUCLICKBLUE   0xFF6A7298
 
#define TITLEBAR_DARK   0xFF2F2F2F
 
#define LIGHTBLACK   0xFF3E3E3E
 
#define MAGENTA   0xFFFF00FF
 
#define CYAN   0xFF00FFFF
 
#define SET_ALPHA(color, alpha)   (((color << 8) >> 8) | ((alpha << 24) & 0xff000000))
 
#define _RED(color)   ((color & 0x00FF0000) / 0x10000)
 
#define _GRE(color)   ((color & 0x0000FF00) / 0x100)
 
#define _BLU(color)   ((color & 0x000000FF) / 0x1)
 
#define _ALP(color)   ((color & 0xFF000000) / 0x1000000)
 
#define GET_ALPHA(color)   ((color >> 24) & 0x000000FF)
 
#define GET_RED(color)   ((color >> 16) & 0x000000FF)
 
#define GET_GREEN(color)   ((color >> 8) & 0x000000FF)
 
#define GET_BLUE(color)   ((color >> 0) & 0x000000FF)
 

Functions

XE_LIB uint32_t ChColorAlphaBlend (uint32_t oldColor, uint32_t color2, double opacity)
 
XE_LIB uint32_t ChColorAlphaBlend2 (uint32_t color1, uint32_t color2)
 
XE_LIB void ChColorDrawVerticalGradient (ChCanvas *canv, int x, int y, int w, int h, uint32_t color1, uint32_t color2)
 
uint32_t make_col (uint8_t red, uint8_t green, uint8_t blue)
 
uint32_t make_col_a (uint8_t red, uint8_t green, uint8_t blue, uint8_t a)
 
XE_LIB void ChColorDrawHorizontalGradient (ChCanvas *canv, int x, int y, int w, int h, uint32_t color1, uint32_t color2)
 
XE_LIB double clamp (double x, double upper, double lower)
 
XE_LIB uint32_t ChColorRGBAtoBGRA (uint32_t col)
 
XE_LIB void ChDrawPixelRAW (ChCanvas *canvas, int x, int y, uint32_t color)
 ChDrawPixelRAW – draws a pixel to canvas buffer.
 

Macro Definition Documentation

◆ _ALP

#define _ALP (   color)    ((color & 0xFF000000) / 0x1000000)

◆ _BLU

#define _BLU (   color)    ((color & 0x000000FF) / 0x1)

◆ _GRE

#define _GRE (   color)    ((color & 0x0000FF00) / 0x100)

◆ _RED

#define _RED (   color)    ((color & 0x00FF0000) / 0x10000)

◆ AQUA

#define AQUA   0xFF00FFFF

◆ BLACK

#define BLACK   0xFF000000

◆ BLUE

#define BLUE   0xFF0000FF

◆ BROWN

#define BROWN   0xFFA52A2A

◆ CORAL

#define CORAL   0xFFFF7F50

◆ CRIMSON

#define CRIMSON   0xFFDC143C

◆ CYAN

#define CYAN   0xFF00FFFF

◆ DARKGOLDENROD

#define DARKGOLDENROD   0xFFB8860B

◆ DARKGREEN

#define DARKGREEN   0xFF006400

◆ DARKKHAKI

#define DARKKHAKI   0xFFBDB76B

◆ DARKORANGE

#define DARKORANGE   0xFFFF8C00

◆ DARKRED

#define DARKRED   0xFF8B0000

more colors are needed!!

◆ DARKSALMON

#define DARKSALMON   0xFFE9967A

◆ DESKBLUE

#define DESKBLUE   0xFF5B7492

◆ FIREBRICK

#define FIREBRICK   0xFFB22222

◆ FUCHSIA

#define FUCHSIA   0xFFFF00FF

◆ GET_ALPHA

#define GET_ALPHA (   color)    ((color >> 24) & 0x000000FF)

◆ GET_BLUE

#define GET_BLUE (   color)    ((color >> 0) & 0x000000FF)

◆ GET_GREEN

#define GET_GREEN (   color)    ((color >> 8) & 0x000000FF)

◆ GET_RED

#define GET_RED (   color)    ((color >> 16) & 0x000000FF)

◆ GOLD

#define GOLD   0xFFFFD700

◆ GOLDENROD

#define GOLDENROD   0xFFDAA520

◆ GRAY

#define GRAY   0xFF808080

◆ GREEN

#define GREEN   0xFF008000

◆ INDIANRED

#define INDIANRED   0xFFCD5C5C

◆ KHAKI

#define KHAKI   0xFFF0E68C

◆ LIGHTBLACK

#define LIGHTBLACK   0xFF3E3E3E

◆ LIGHTCORAL

#define LIGHTCORAL   0xFFF08080

◆ LIGHTSILVER

#define LIGHTSILVER   0xFFD9D9D9

◆ LIME

#define LIME   0xFF00FF00

◆ MAGENTA

#define MAGENTA   0xFFFF00FF

◆ MAROON

#define MAROON   0xFF800000

◆ MENUCLICKBLUE

#define MENUCLICKBLUE   0xFF6A7298

◆ NAVY

#define NAVY   0xFF000080

◆ OLIVE

#define OLIVE   0xFF808000

◆ ORANGE

#define ORANGE   0xFFFFA500

◆ ORANGERED

#define ORANGERED   0xFFFF4500

◆ PALEGOLDENROD

#define PALEGOLDENROD   0xFFEEE8AA

◆ PALEGREEN

#define PALEGREEN   0xFF98FB98

◆ PURPLE

#define PURPLE   0xFF800080

◆ RED

#define RED   0xFFFF0000

◆ SALMON

#define SALMON   0xFFFA8072

◆ SET_ALPHA

#define SET_ALPHA (   color,
  alpha 
)    (((color << 8) >> 8) | ((alpha << 24) & 0xff000000))

◆ SILVER

#define SILVER   0xFFC0C0C0

◆ TEAL

#define TEAL   0xFF008080

◆ TITLEBAR_DARK

#define TITLEBAR_DARK   0xFF2F2F2F

◆ TOMATO

#define TOMATO   0xFFFF6347

◆ WHITE

#define WHITE   0xFFFFFFFF

Color codes.

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ YELLOW

#define YELLOW   0xFFFFFF00

Function Documentation

◆ ChColorAlphaBlend()

XE_LIB uint32_t ChColorAlphaBlend ( uint32_t  oldColor,
uint32_t  color2,
double  opacity 
)

◆ ChColorAlphaBlend2()

XE_LIB uint32_t ChColorAlphaBlend2 ( uint32_t  color1,
uint32_t  color2 
)

◆ ChColorDrawHorizontalGradient()

XE_LIB void ChColorDrawHorizontalGradient ( ChCanvas canv,
int  x,
int  y,
int  w,
int  h,
uint32_t  color1,
uint32_t  color2 
)

◆ ChColorDrawVerticalGradient()

XE_LIB void ChColorDrawVerticalGradient ( ChCanvas canv,
int  x,
int  y,
int  w,
int  h,
uint32_t  color1,
uint32_t  color2 
)

◆ ChColorRGBAtoBGRA()

XE_LIB uint32_t ChColorRGBAtoBGRA ( uint32_t  col)

◆ ChDrawPixelRAW()

XE_LIB void ChDrawPixelRAW ( ChCanvas canvas,
int  x,
int  y,
uint32_t  color 
)

ChDrawPixelRAW – draws a pixel to canvas buffer.

Parameters
canvas– pointer to canvas
x– x position
y– y position
color– color of the pixel

◆ clamp()

XE_LIB double clamp ( double  x,
double  upper,
double  lower 
)

◆ make_col()

uint32_t make_col ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)
extern

◆ make_col_a()

uint32_t make_col_a ( uint8_t  red,
uint8_t  green,
uint8_t  blue,
uint8_t  a 
)
extern