1 {
2 $Id: ImagingColors.pas 173 2009-09-04 17:05:52Z galfar $
3 Vampyre Imaging Library
4 by Marek Mauder
5 http://imaginglib.sourceforge.net
7 The contents of this file are used with permission, subject to the Mozilla
8 Public License Version 1.1 (the "License"); you may not use this file except
9 in compliance with the License. You may obtain a copy of the License at
10 http://www.mozilla.org/MPL/MPL-1.1.html
12 Software distributed under the License is distributed on an "AS IS" basis,
13 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
14 the specific language governing rights and limitations under the License.
16 Alternatively, the contents of this file may be used under the terms of the
17 GNU Lesser General Public License (the "LGPL License"), in which case the
18 provisions of the LGPL License are applicable instead of those above.
19 If you wish to allow use of your version of this file only under the terms
20 of the LGPL License and not to allow others to use your version of this file
21 under the MPL, indicate your decision by deleting the provisions above and
22 replace them with the notice and other provisions required by the LGPL
23 License. If you do not delete the provisions above, a recipient may use
24 your version of this file under either the MPL or the LGPL License.
26 For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html
27 }
29 { This unit contains functions for manipulating and converting color values.}
32 interface
34 {$I ImagingOptions.inc}
36 uses
39 { Converts RGB color to YUV.}
41 { Converts YIV to RGB color.}
44 { Converts RGB color to YCbCr as used in JPEG.}
46 { Converts YCbCr as used in JPEG to RGB color.}
48 { Converts RGB color to YCbCr as used in JPEG.}
50 { Converts YCbCr as used in JPEG to RGB color.}
53 { Converts RGB color to CMY.}
55 { Converts CMY to RGB color.}
57 { Converts RGB color to CMY.}
59 { Converts CMY to RGB color.}
62 { Converts RGB color to CMYK.}
64 { Converts CMYK to RGB color.}
66 { Converts RGB color to CMYK.}
68 { Converts CMYK to RGB color.}
71 { Converts RGB color to YCoCg.}
73 { Converts YCoCg to RGB color.}
77 implementation
80 begin
87 var
89 begin
99 begin
106 begin
113 begin
120 begin
127 begin
134 begin
141 begin
148 begin
155 begin
159 begin
163 end
164 else
165 begin
173 begin
180 begin
184 begin
188 end
189 else
190 begin
198 begin
205 begin
206 // C and Delphi's SHR behaviour differs for negative numbers, use div instead.
213 var
215 begin
223 {
224 File Notes:
226 -- TODOS ----------------------------------------------------
227 - nothing now
229 -- 0.26.3 Changes/Bug Fixes ---------------------------------
230 - Added RGB<>YCoCg conversion functions.
231 - Fixed RGB>>CMYK conversions.
233 -- 0.23 Changes/Bug Fixes -----------------------------------
234 - Added RGB<>CMY(K) converion functions for 16 bit channels
235 (needed by PSD loading code).
237 -- 0.21 Changes/Bug Fixes -----------------------------------
238 - Added some color space conversion functions and LUTs
239 (RGB/YUV/YCrCb/CMY/CMYK).
241 -- 0.17 Changes/Bug Fixes -----------------------------------
242 - unit created (empty!)
243 }