PageRenderTime 29ms CodeModel.GetById 22ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/AppKit/GTMLinearRGBShading.h

http://macfuse.googlecode.com/
C++ Header | 76 lines | 18 code | 7 blank | 51 comment | 0 complexity | 792bd005a3ff8eeb1cfa6268c9c00a58 MD5 | raw file
 1//
 2//  GTMLinearRGBShading.h
 3//
 4//  Copyright 2006-2008 Google Inc.
 5//
 6//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7//  use this file except in compliance with the License.  You may obtain a copy
 8//  of the License at
 9// 
10//  http://www.apache.org/licenses/LICENSE-2.0
11// 
12//  Unless required by applicable law or agreed to in writing, software
13//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15//  License for the specific language governing permissions and limitations under
16//  the License.
17//
18
19#import <Cocoa/Cocoa.h>
20#import "GTMShading.h"
21#import "GTMCalculatedRange.h"
22
23///  A shading that does returns smooth linear values for RGB.
24//
25///  Thus if you create a shading from 0.0->red to 1.0->blue you will get
26///  \verbatim
27///    - 0.5->purple
28///    - 0.75->eggplant
29///    - 0.25->magenta
30/// \endverbatim
31
32@interface GTMLinearRGBShading : GTMCalculatedRange <GTMShading> {
33@private
34  CGFunctionRef function_;  // function used to calculated shading (STRONG)
35  CGColorSpaceRef colorSpace_; // colorspace used for shading (STRONG)
36  BOOL isCalibrated_;  // are we using calibrated or device RGB.
37  CGFloat colorValue_[4];  // the RGBA color values
38}
39
40///  Generate a shading with color |begin| at position 0.0 and color |end| at 1.0.
41//
42//  Args: 
43//    begin: color at beginning of range
44//    end: color at end of range
45//    colorSpaceName: name of colorspace to draw into must be either
46//                    NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace
47//
48//  Returns:
49//    a GTMLinearRGBShading
50+ (id)shadingFromColor:(NSColor *)begin toColor:(NSColor *)end 
51        fromSpaceNamed:(NSString*)colorSpaceName;
52
53///  Generate a shading with a collection of colors at various positions.
54//
55//  Args:
56//    colors: a C style array containg the colors we are adding
57//    colorSpaceName: name of colorspace to draw into must be either
58//                    NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace
59//    positions: a C style array containg the positions we want to 
60//              add the colors at
61//    numberOfColors: how many colors/positions we are adding
62//
63//  Returns:
64//    a GTMLinearRGBShading
65+ (id)shadingWithColors:(NSColor **)colors
66         fromSpaceNamed:(NSString*)colorSpaceName
67            atPositions:(CGFloat *)positions 
68                  count:(NSUInteger)numberOfColors;
69
70/// Designated initializer
71//  Args:
72//    colorSpaceName - name of the colorspace to use must be either
73//                     NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace
74- (id)initWithColorSpaceName:(NSString*)colorSpaceName;
75
76@end