This is MiscColorMerge.rtf in view mode; [Download] [Up]
Copyright © 1997 by Mark Probst. All Rights Reserved. MiscColorMerge Inherits From: View : Responder : Object Declared In: MiscColorMerge.h Class Description MiscColorMerge objects allow the user to view and change color spreads. By dragging colors into or out of the MiscColorMerge, it is possible to adjust the spread to the needs of the task at hand. The colors that are dragged into the spread (the pure colors) are blended into each other by interpolating the colors between them. The interpolation can either be a simple linear interpolation between the respective RGB-values or a more sophisticated Catmull-Rom spline, which is laid through the colors, represented as points in the RGB-cube, giving a more 'natural' look. Pure and blended colors can also be set and queried programatically. Pure and blended colors have positions, ranging from 0.0 (the lower end of the View) to 1.0 (the upper end). Pure colors do also have indexes, starting with 0 for the lowermost pure color. Defined Types SYNOPSIS MiscColorMergeMode typedef enum { MergeModeLinear = 1, MergeModeCatmullRom = 2 } MiscColorMergeMode; DESCRIPTION Used for specifying the interpolation method. SYNOPSIS MiscColorAtPosition typedef struct _MiscColorAtPosition { NXColor color; double position; struct _ColorAtPosition *next; } MiscColorAtPosition; DESCRIPTION Used to internally store the pure colors along with their positions Instance Variables id delegate; MiscColorMergeMode mergeMode; MiscColorAtPosition *firstColor; int numColors; Vector3D *vertices; int numAllocedVertices; int dragOperation; NXPoint draggingStart; int draggedColorIndex; int oldEventMask; NXEvent mouseDownEvent; NXBitmapImageRep *bufferedLine; float bufferedLinePos; delegate The object that is notified when the MiscColorMerge is changed. mergeMode The interpolation method used. firstColor A pointer to the first pure color. numColors The number of pure colors. vertices An array of vectors, representing the colors in the RGB-cube. numAllocedVertices The size of the array. dragOperation The currently performed drag operation. draggingStart The position where the user started dragging. draggedColorIndex The index of the dragged color. oldEventMask The old event mask of the window. mouseDownEvent The event that started dragging. bufferedLine The currently buffered line. bufferedLinePos The y-position of that line. Method Types Creating and freeing instances - initFrame: - free Assigning a delegate - delegate - setDelegate: Setting the interpolation method - mergeMode - setMergeMode: Setting and getting pure colors - numPureColors - addColor:atPosition: - getColor:andPosition:atIndex: - removeColorAtIndex: - removeAllColors Calculating blended colors - calcColor:atPosition: - calcArray:ofNumColors: Drawing - drawSelf:: Event handling - acceptsFirstMouse - mouseDown: - mouseDragged: - mouseUp: Archiving - read: - write: Instance Methods acceptsFirstMouse - (BOOL)acceptsFirstMouse Returns YES. addColor:atPosition: - addColor:(NXColor)theColor atPosition:(double)thePosition Adds the pure color theColor to the position thePosition. Returns self if 0.0 <= thePosition <= 1.0, nil otherwise. calcArray:ofNumColors: - calcArray:(NXColor*)colors ofNumColors:(int)arraySize Calculates an array of arraySize NXColor's representing the whole color spread. colors must point to an array of at least arraySize NXColor's. This method is to be preferred over calcColor:atPosition: if applicable, since it may be optimized in the future (presently it is not faster than the respective sequence of calls to calcColor:atPosition:). Returns self. calcColor:atPosition: - calcColor:(NXColor*)theColor atPosition:(double)thePosition Calculates the blended color at position thePosition. Returns self. delegate - delegate Returns the MiscColorMerge object's delegate. drawSelf:: - drawSelf:(const NXRect*)rects :(int)numRects Draws the MiscColorMerge and returns self. free - free Frees the MiscColorMerge instance. getColor:andPosition:atIndex: - getColor:(NXColor*)theColor andPosition:(double*)thePosition atIndex:(int)theIndex Gets the pure color and its position at index theIndex. Returns self if theIndex is valid, nil otherwise. initFrame: - initFrame:(const NXRect*)frameRect Initializes the MiscColorMerge object and sets the interpolation method to Catmull-Rom. This is the designated initializer for MiscColorMerge. mergeMode - (MiscColorMergeMode)mergeMode Returns the merge mode currently in use. mouseDown: - mouseDown:(NXEvent*)theEvent Responds to mouse-down events. Returns self. mouseDragged: - mouseDragged:(NXEvent*)theEvent Responds to mouse-dragged events and initiates a drag-operation if appropriate. Returns self. mouseUp: - mouseUp:(NXEvent*)theEvent Responds to mouse-up events. Returns self. numPureColors - (int)numPureColors Returns the number of pure colors. read: - read:(NXTypedStream*)theStream Reads the MiscColorMerge object in from the typed stream theStream. Returns self. removeAllColors - removeAllColors No method description. removeColorAtIndex: - removeColorAtIndex:(int)index Removes the pure color at index. Returns self if index is valid, nil otherwise. setDelegate: - setDelegate:newDelegate Sets the MiscColorMerge object's delegate to newDelegate. Returns self. setMergeMode: - setMergeMode:(MiscColorMergeMode)aMergeMode Sets the merge mode to aMergeMode and updates itself. Returns self. write: - write:(NXTypedStream*)theStream Writes the MiscColorMerge object to the typed stream theStream. Returns self. Methods Implemented by the Delegate colorMergeDidChange: - colorMergeDidChange:sender This message is sent every time the color merge is changed by the user.
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.