Color-565 Library: Unterschied zwischen den Versionen
Aus ProjectWiki
Mat (Diskussion | Beiträge) K (Created page with "== Overview == Contains functions to map colors from 24-Bit RGB space to 16-Bit RGB space and vice versa and a list of 500+ named colors. == How to use == Include the library. ...") |
Mat (Diskussion | Beiträge) K (→Donate) |
||
(2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
== Overview == | == Overview == | ||
Contains functions to map colors from 24-Bit RGB space to 16-Bit RGB space and vice versa and a list of 500+ named colors. | Contains functions to map colors from 24-Bit RGB space to 16-Bit RGB space and vice versa and a list of 500+ named colors. | ||
+ | |||
+ | |||
+ | [http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12891 Forum thread] | ||
Zeile 14: | Zeile 17: | ||
<pre>Dim R As Byte, G As Byte, B As Byte | <pre>Dim R As Byte, G As Byte, B As Byte | ||
Color16to24 [16 Bit color], R, G, B</pre> | Color16to24 [16 Bit color], R, G, B</pre> | ||
+ | |||
+ | Alpha blending of 2 16 Bit colors | ||
+ | <pre>Dim Color1 As Word, Color2 As Word | ||
+ | Dim Mixedcolor As Word | ||
+ | Mixedcolor = Color16alpha(Color1, Color2, [Alpha 0 (Color1) - 31 (Color2)])</pre> | ||
Included is a list of constants with 500+ named colors, which are also listed in the corresponding Excel-sheet and an example how to define custom color constants: | Included is a list of constants with 500+ named colors, which are also listed in the corresponding Excel-sheet and an example how to define custom color constants: | ||
<pre>Const Color_custom =(((RED_8bit * 249) + 1014) And &HF800) + (Int(((GREEN_8bit * 253) + 505) / 32) And &H07E0) + Int(((BLUE_8bit * 249) + 1014) / 2048)</pre> | <pre>Const Color_custom =(((RED_8bit * 249) + 1014) And &HF800) + (Int(((GREEN_8bit * 253) + 505) / 32) And &H07E0) + Int(((BLUE_8bit * 249) + 1014) / 2048)</pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Download == | == Download == | ||
* [http://www.braunecker.at/downloads/Color565.zip 24/16 Bit Color Conversion Library 1.0] | * [http://www.braunecker.at/downloads/Color565.zip 24/16 Bit Color Conversion Library 1.0] |
Aktuelle Version vom 31. August 2017, 03:20 Uhr
Overview
Contains functions to map colors from 24-Bit RGB space to 16-Bit RGB space and vice versa and a list of 500+ named colors.
How to use
Include the library.
$include "Colors565.inc"
Convert 24-Bit RGB (8 Bit each) to 16 Bit (R: 5 Bit, G: 6 Bit, B: 5 Bit)
Dim Color As Word Color = Color24to16([R], [G], [B])
Convert 16 Bit back to 24 Bit colors
Dim R As Byte, G As Byte, B As Byte Color16to24 [16 Bit color], R, G, B
Alpha blending of 2 16 Bit colors
Dim Color1 As Word, Color2 As Word Dim Mixedcolor As Word Mixedcolor = Color16alpha(Color1, Color2, [Alpha 0 (Color1) - 31 (Color2)])
Included is a list of constants with 500+ named colors, which are also listed in the corresponding Excel-sheet and an example how to define custom color constants:
Const Color_custom =(((RED_8bit * 249) + 1014) And &HF800) + (Int(((GREEN_8bit * 253) + 505) / 32) And &H07E0) + Int(((BLUE_8bit * 249) + 1014) / 2048)