|
|
1.1 ! root 1: #if 0 ! 2: ! 3: Brush.h -- Pressure sensitive paint brush ! 4: ! 5: by Peter Graffagnino, NeXT Computer Inc. ! 6: ! 7: You may freely copy, distribute, and reuse the code in this example. ! 8: NeXT disclaims any warranty of any kind, expressed or implied, as to its ! 9: fitness for any particular use. ! 10: ! 11: #endif ! 12: ! 13: ! 14: #import <objc/Object.h> ! 15: ! 16: /* ! 17: * A pressure sensitive brush whose size is governed by: ! 18: * minSize + pressureCoefficient*(inputPressure^pressureExponent) ! 19: */ ! 20: ! 21: @interface Brush : Object ! 22: { ! 23: NXColor brushColor; ! 24: float pressureExponent; ! 25: float minSize; ! 26: float pressureCoefficient; ! 27: double lastx, lasty, lastsize; /* last point drawn (for connecting ! 28: * strokes) ! 29: */ ! 30: } ! 31: ! 32: /* drawing the brush */ ! 33: - brushMoveTo:(float)x :(float)y withPressure:(float) pressure ! 34: dirtyRect: (NXRect *) dirty; ! 35: - brushLineTo:(float)x :(float)y withPressure:(float) pressure ! 36: dirtyRect: (NXRect *) dirty; ! 37: ! 38: /* target/action & outlet-setting methods */ ! 39: - setMinSize: sender; ! 40: - setPressureExponent: sender; ! 41: - setBrushColor: sender; ! 42: - setPressureCoefficient: sender; ! 43: ! 44: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.