1 {
2 Vampyre Imaging Library
3 by Marek Mauder
4 http://imaginglib.sourceforge.net
6 The contents of this file are used with permission, subject to the Mozilla
7 Public License Version 1.1 (the "License"); you may not use this file except
8 in compliance with the License. You may obtain a copy of the License at
9 http://www.mozilla.org/MPL/MPL-1.1.html
11 Software distributed under the License is distributed on an "AS IS" basis,
12 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
13 the specific language governing rights and limitations under the License.
15 Alternatively, the contents of this file may be used under the terms of the
16 GNU Lesser General Public License (the "LGPL License"), in which case the
17 provisions of the LGPL License are applicable instead of those above.
18 If you wish to allow use of your version of this file only under the terms
19 of the LGPL License and not to allow others to use your version of this file
20 under the MPL, indicate your decision by deleting the provisions above and
21 replace them with the notice and other provisions required by the LGPL
22 License. If you do not delete the provisions above, a recipient may use
23 your version of this file under either the MPL or the LGPL License.
25 For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
26 }
28 { This unit contains functions for manipulating and converting color values.}
31 interface
33 {$I ImagingOptions.inc}
35 uses
38 { Converts RGB color to YUV.}
40 { Converts YIV to RGB color.}
43 { Converts RGB color to YCbCr as used in JPEG.}
45 { Converts YCbCr as used in JPEG to RGB color.}
47 { Converts RGB color to YCbCr as used in JPEG.}
49 { Converts YCbCr as used in JPEG to RGB color.}
52 { Converts RGB color to CMY.}
54 { Converts CMY to RGB color.}
56 { Converts RGB color to CMY.}
58 { Converts CMY to RGB color.}
61 { Converts RGB color to CMYK.}
63 { Converts CMYK to RGB color.}
65 { Converts RGB color to CMYK.}
67 { Converts CMYK to RGB color.}
70 { Converts RGB color to YCoCg.}
72 { Converts YCoCg to RGB color.}
75 //procedure RGBToHSL(R, G, B: Byte; var H, S, L: Byte);
76 //procedure HSLToRGB(H, S, L: Byte; var R, G, B: Byte);
78 implementation
81 begin
88 var
90 begin
100 begin
107 begin
114 begin
121 begin
128 begin
135 begin
142 begin
149 begin
156 begin
160 begin
164 end
165 else
166 begin
174 begin
181 begin
185 begin
189 end
190 else
191 begin
199 begin
206 begin
207 // C and Delphi's SHR behaviour differs for negative numbers, use div instead.
214 var
216 begin
224 {
225 File Notes:
227 -- TODOS ----------------------------------------------------
228 - nothing now
230 -- 0.26.3 Changes/Bug Fixes ---------------------------------
231 - Added RGB<>YCoCg conversion functions.
232 - Fixed RGB>>CMYK conversions.
234 -- 0.23 Changes/Bug Fixes -----------------------------------
235 - Added RGB<>CMY(K) converion functions for 16 bit channels
236 (needed by PSD loading code).
238 -- 0.21 Changes/Bug Fixes -----------------------------------
239 - Added some color space conversion functions and LUTs
240 (RGB/YUV/YCrCb/CMY/CMYK).
242 -- 0.17 Changes/Bug Fixes -----------------------------------
243 - unit created (empty!)
244 }