ftp.nice.ch/pub/next/developer/languages/smalltalk/smalltalk.1.2.alpha5.s.tar.gz#/smalltalk-1.2.alpha5/objc/objclib/Color.h

This is Color.h in view mode; [Download] [Up]

//
//	MiscColor.h -- a wrapper class around the NXColor functions
//		Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This object is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	

#import <appkit/appkit.h>

@interface Color : Object
{
	NXColor theColor;
	id delegate;
}

+ (BOOL)canInitFromPasteboard:(Pasteboard *)pasteboard;
+ newFromPasteBoard:(Pasteboard *)pasteboard;
+ newColor:(NXColor)color;

- init;
- initColor:(NXColor)color; // designated initializer!
- initFromPasteBoard:(Pasteboard *)pasteboard;
- initColorFromPixel:(NXPoint *)location;

// putting the color on a pasteboard
// Note that we can put both an NXColor and/or our whole object
// on the pasteboard, so that a subclass that is drag/dropped can
// retain it's full richness, while still being compatabile with
// NEXTSTEP drag and drop into other applications and NEXTSTEP objects.

- writeToPasteBoard:(Pasteboard *)pasteboard;
- readFromPasteBoard:(Pasteboard *)pasteboard;
- setFromPasteBoard:(Pasteboard *)pasteboard;

// change a color component:  should be in range 0.0 to 1.0
- setRedComponent:(float)red;
- setGreenComponent:(float)green;
- setBlueComponent:(float)blue;
- setCyanComponent:(float)cyan;
- setMagentaComponent:(float)magenta;
- setYellowComponent:(float)yellow;
- setBlackComponent:(float)black;
- setHueComponent:(float)hue;
- setSaturationComponent:(float)saturation;
- setBrightnessComponent:(float)brightness;
- setGrayComponent:(float)gray;
- setAlphaComponent:(float)alpha; // NX_NOALPHA to remove alpha

// change/access color directly
- setColor:(NXColor)color;
- setColorFromObject:object;
- setColorFromPixel:(NXPoint *)location;
- (NXColor)color; // our displayable color (passed thru filter)
- (NXColor)actualColor; // the color before filtering
- (NXColor)filterColor:(NXColor)input; // subclasses can filter color for printing

- display;	// sends color to PS interpreter via -setColor below.
- (BOOL)setColor;	// send color to postscript interpreter, NO returned if not set

// getting values for a particular colorspace, will return 0.0 to 1.0
//		(or, on alpha methods, NO_ALPHA if no alpha)
- getGray:(float *)gray;
- getGray:(float *)gray alpha:(float *)alpha;
- getRed:(float *)red green:(float *)green blue:(float *)blue;
- getRed:(float *)red green:(float *)green blue:(float *)blue
		alpha:(float *)alpha;
- getHue:(float *)hue saturation:(float *)saturation
		brightness:(float *)brightness;
- getHue:(float *)hue saturation:(float *)saturation
		brightness:(float *)brightness alpha:(float *)alpha;
- getCyan:(float *)cyan magenta:(float *)magenta yellow:(float *)yellow
		black:(float *)black;
- getCyan:(float *)cyan magenta:(float *)magenta yellow:(float *)yellow
		black:(float *)black alpha:(float *)alpha;

// keep args in 0.0 to 1.0 range, or NX_NOALPHA for alpha value
- setGray:(float)gray;
- setGray:(float)gray alpha:(float)alpha;
- setRed:(float)red green:(float)green blue:(float)blue;
- setRed:(float)red green:(float)green blue:(float)blue alpha:(float)alpha;
- setHue:(float)hue saturation:(float)saturation
		brightness:(float)brightness;
- setHue:(float)hue saturation:(float)saturation
		brightness:(float)brightness alpha:(float)alpha;
- setCyan:(float)cyan magenta:(float)magenta yellow:(float)yellow
		black:(float)black;
- setCyan:(float)cyan magenta:(float)magenta yellow:(float)yellow
		black:(float)black alpha:(float)alpha;

- (BOOL)isEqualColor:anObject;	// checks only -color method's return
- (BOOL)isEqualToColor:(NXColor)color;	// if same color...
- (BOOL)isEqual:anObject;		// must be of same class

- read:(NXTypedStream *)stream;
- write:(NXTypedStream *)stream;

// Interface Builder support
- (const char *)getInspectorClassName;
- (NXImage *)getIBImage;

// getting individual color components
- (float)redComponent;
- (float)greenComponent;
- (float)blueComponent;
- (float)cyanComponent;
- (float)magentaComponent;
- (float)yellowComponent;
- (float)blackComponent;
- (float)hueComponent;
- (float)saturationComponent;
- (float)brightnessComponent;
- (float)grayComponent;
- (float)alphaComponent;

// dealing with persistently named colors
+ findColorNamed:(const char *)aName inList:(const char *)aListName;
- (const char *)colorName; // different than the object's name
- (const char *)colorListName; // name of originating color list, if there is one

- delegate;
- setDelegate:anObject;

// delegate methods:  (allows delegate to change the color, so that, say
//		you intercept color setting in your app to handle color separations...)
//- (NXColor)willSendColorToPS:(NXColor)color shouldPrint:(BOOL *)printOK;
		// returns color you should set, set printOK to NO if you don't want any
		// color sent to the PS interpreter.
//- didSendColorToPS:(NXColor)color;

@end

// The method prototypes allow us to compile without warnings
@interface Color(delegate)
- (NXColor)willSendColorToPS:(NXColor)color shouldPrint:(BOOL *)printOK;
- didSendColorToPS:(NXColor)color;
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.