mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 13:11:55 +00:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5970 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
73b008871f
commit
6b5e33078b
3 changed files with 1184 additions and 881 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Feb 09 18:50:12 2000 Enrico Sersale <enrico@imago.ro>
|
||||||
|
|
||||||
|
* Source/NSBezierPath.m Headers/gnustep/gui/NSBezierPath.h :
|
||||||
|
Rewritten conforming to MacOS-X implementation details.
|
||||||
|
|
||||||
Tue Jan 25 14:52:27 2000 Nicola Pero <n.pero@mi.flashnet.it>
|
Tue Jan 25 14:52:27 2000 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
Contributed by Fred Kiefer:
|
Contributed by Fred Kiefer:
|
||||||
|
|
|
@ -24,43 +24,113 @@
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111 - 1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NSBEZIERPATH_H
|
#ifndef BEZIERPATH_H
|
||||||
#define NSBEZIERPATH_H
|
#define BEZIERPATH_H
|
||||||
|
|
||||||
#include <Foundation/NSArray.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include <AppKit/NSFont.h>
|
#import <AppKit/NSFont.h>
|
||||||
|
|
||||||
#define PMAX 10000
|
@class NSAffineTransform;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NSBezierPathElementMoveTo,
|
NSButtLineCapStyle = 0,
|
||||||
NSBezierPathElementLineTo,
|
NSRoundLineCapStyle = 1,
|
||||||
NSBezierPathElementCurveTo,
|
NSSquareLineCapStyle = 2
|
||||||
NSBezierPathElementClose
|
} NSLineCapStyle;
|
||||||
} NSBezierPathElementType;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NSWindingRuleNonZero,
|
NSMiterLineJoinStyle = 0,
|
||||||
NSWindingRuleEvenOdd
|
NSRoundLineJoinStyle = 1,
|
||||||
|
NSBevelLineJoinStyle = 2
|
||||||
|
} NSLineJoinStyle;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NSNonZeroWindingRule,
|
||||||
|
NSEvenOddWindingRule
|
||||||
} NSWindingRule;
|
} NSWindingRule;
|
||||||
|
|
||||||
@interface NSBezierPath : NSObject
|
typedef enum {
|
||||||
|
NSMoveToBezierPathElement,
|
||||||
|
NSLineToBezierPathElement,
|
||||||
|
NSCurveToBezierPathElement,
|
||||||
|
NSClosePathBezierPathElement
|
||||||
|
} NSBezierPathElement;
|
||||||
|
|
||||||
|
@interface NSBezierPath : NSObject <NSCopying, NSCoding>
|
||||||
{
|
{
|
||||||
NSMutableArray *pathElements;
|
@private
|
||||||
NSMutableArray *subPaths;
|
int _state;
|
||||||
NSPoint draftPolygon[PMAX];
|
int _segmentCount;
|
||||||
int pcount;
|
int _segmentMax;
|
||||||
NSPoint currentPoint;
|
// struct PATHSEGMENT *_head;
|
||||||
NSWindingRule windingRule;
|
int _lastSubpathIndex;
|
||||||
BOOL cachesBezierPath;
|
int _elementCount;
|
||||||
|
BOOL _isFlat;
|
||||||
|
NSWindingRule _windingRule;
|
||||||
|
NSLineCapStyle _lineCapStyle;
|
||||||
|
NSLineJoinStyle _lineJoinStyle;
|
||||||
|
float _lineWidth;
|
||||||
|
NSRect _bounds;
|
||||||
|
BOOL _shouldRecalculateBounds;
|
||||||
|
NSRect _controlPointBounds;
|
||||||
|
BOOL _shouldRecalculateControlPointBounds;
|
||||||
|
|
||||||
|
BOOL _cachesBezierPath;
|
||||||
|
BOOL _shouldRecacheUserPath;
|
||||||
|
// int _dpsUserPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Creating common paths
|
||||||
|
//
|
||||||
+ (NSBezierPath *)bezierPath;
|
+ (NSBezierPath *)bezierPath;
|
||||||
|
|
||||||
+ (NSBezierPath *)bezierPathWithRect:(NSRect)aRect;
|
+ (NSBezierPath *)bezierPathWithRect:(NSRect)aRect;
|
||||||
|
|
||||||
|
+ (NSBezierPath *)bezierPathWithOvalInRect:(NSRect)rect;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Contructing paths
|
// Immediate mode drawing of common paths
|
||||||
|
//
|
||||||
|
+ (void)fillRect:(NSRect)rect;
|
||||||
|
|
||||||
|
+ (void)strokeRect:(NSRect)rect;
|
||||||
|
|
||||||
|
+ (void)clipRect:(NSRect)rect;
|
||||||
|
|
||||||
|
+ (void)strokeLineFromPoint:(NSPoint)point1 toPoint:(NSPoint)point2;
|
||||||
|
|
||||||
|
+ (void)drawPackedGlyphs:(const char *)packedGlyphs atPoint:(NSPoint)point;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default path rendering parameters
|
||||||
|
//
|
||||||
|
+ (void)setDefaultMiterLimit:(float)limit;
|
||||||
|
|
||||||
|
+ (float)defaultMiterLimit;
|
||||||
|
|
||||||
|
+ (void)setDefaultFlatness:(float)flatness;
|
||||||
|
|
||||||
|
+ (float)defaultFlatness;
|
||||||
|
|
||||||
|
+ (void)setDefaultWindingRule:(NSWindingRule)windingRule;
|
||||||
|
|
||||||
|
+ (NSWindingRule)defaultWindingRule;
|
||||||
|
|
||||||
|
+ (void)setDefaultLineCapStyle:(NSLineCapStyle)lineCapStyle;
|
||||||
|
|
||||||
|
+ (NSLineCapStyle)defaultLineCapStyle;
|
||||||
|
|
||||||
|
+ (void)setDefaultLineJoinStyle:(NSLineJoinStyle)lineJoinStyle;
|
||||||
|
|
||||||
|
+ (NSLineJoinStyle)defaultLineJoinStyle;
|
||||||
|
|
||||||
|
+ (void)setDefaultLineWidth:(float)lineWidth;
|
||||||
|
|
||||||
|
+ (float)defaultLineWidth;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Path construction
|
||||||
//
|
//
|
||||||
- (void)moveToPoint:(NSPoint)aPoint;
|
- (void)moveToPoint:(NSPoint)aPoint;
|
||||||
|
|
||||||
|
@ -72,8 +142,11 @@ typedef enum {
|
||||||
|
|
||||||
- (void)closePath;
|
- (void)closePath;
|
||||||
|
|
||||||
- (void)reset;
|
- (void)removeAllPoints;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Relative path construction
|
||||||
|
//
|
||||||
- (void)relativeMoveToPoint:(NSPoint)aPoint;
|
- (void)relativeMoveToPoint:(NSPoint)aPoint;
|
||||||
|
|
||||||
- (void)relativeLineToPoint:(NSPoint)aPoint;
|
- (void)relativeLineToPoint:(NSPoint)aPoint;
|
||||||
|
@ -83,118 +156,117 @@ typedef enum {
|
||||||
controlPoint2:(NSPoint)controlPoint2;
|
controlPoint2:(NSPoint)controlPoint2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Appending paths and some common shapes
|
// Path rendering parameters
|
||||||
//
|
//
|
||||||
- (void)appendBezierPath:(NSBezierPath *)aPath;
|
- (float)lineWidth;
|
||||||
|
|
||||||
- (void)appendBezierPathWithPoints:(NSPoint *)points count:(int)count;
|
- (void)setLineWidth:(float)lineWidth;
|
||||||
|
|
||||||
- (void)appendBezierPathWithOvalInRect:(NSRect)aRect;
|
- (NSLineCapStyle)lineCapStyle;
|
||||||
|
|
||||||
- (void)appendBezierPathWithArcWithCenter:(NSPoint)center
|
- (void)setLineCapStyle:(NSLineCapStyle)lineCapStyle;
|
||||||
radius:(float)radius
|
|
||||||
startAngle:(float)startAngle
|
|
||||||
endAngle:(float)endAngle;
|
|
||||||
|
|
||||||
- (void)appendBezierPathWithGlyph:(NSGlyph)aGlyph inFont:(NSFont *)fontObj;
|
|
||||||
|
|
||||||
- (void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs
|
- (NSLineJoinStyle)lineJoinStyle;
|
||||||
count:(int)count
|
|
||||||
inFont:(NSFont *)fontObj;
|
|
||||||
|
|
||||||
- (void)appendBezierPathWithPackedGlyphs:(const char *)packedGlyphs;
|
- (void)setLineJoinStyle:(NSLineJoinStyle)lineJoinStyle;
|
||||||
|
|
||||||
//
|
|
||||||
// Setting attributes
|
|
||||||
//
|
|
||||||
- (void)setWindingRule:(NSWindingRule)aWindingRule;
|
|
||||||
|
|
||||||
- (NSWindingRule)windingRule;
|
- (NSWindingRule)windingRule;
|
||||||
|
|
||||||
+ (void)setLineCapStyle:(int)style;
|
- (void)setWindingRule:(NSWindingRule)windingRule;
|
||||||
|
|
||||||
+ (void)setLineJoinStyle:(int)style;
|
|
||||||
|
|
||||||
+ (void)setLineWidth:(float)width;
|
|
||||||
|
|
||||||
+ (void)setMiterLimit:(float)limit;
|
|
||||||
|
|
||||||
+ (void)setFlatness:(float)flatness;
|
|
||||||
|
|
||||||
+ (void)setHalftonePhase:(float)x : (float)y;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Drawing paths
|
// Path operations
|
||||||
//
|
//
|
||||||
- (void)stroke;
|
- (void)stroke;
|
||||||
|
|
||||||
- (void)fill;
|
- (void)fill;
|
||||||
|
|
||||||
+ (void)fillRect:(NSRect)aRect;
|
|
||||||
|
|
||||||
+ (void)strokeRect:(NSRect)aRect;
|
|
||||||
|
|
||||||
+ (void)strokeLineFromPoint:(NSPoint)point1 toPoint:(NSPoint)point2;
|
|
||||||
|
|
||||||
+ (void)drawPackedGlyphs:(const char *)packedGlyphs atPoint:(NSPoint)aPoint;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Clipping paths
|
|
||||||
//
|
|
||||||
- (void)addClip;
|
- (void)addClip;
|
||||||
|
|
||||||
- (void)setClip;
|
- (void)setClip;
|
||||||
|
|
||||||
+ (void)clipRect:(NSRect)aRect;
|
//
|
||||||
|
// Path modifications.
|
||||||
|
//
|
||||||
|
- (NSBezierPath *)bezierPathByFlatteningPath;
|
||||||
|
- (NSBezierPath *)bezierPathByReversingPath;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Applying transformations.
|
||||||
|
//
|
||||||
|
- (void)transformUsingAffineTransform:(NSAffineTransform *)transform;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Path info
|
||||||
|
//
|
||||||
|
- (BOOL)isEmpty;
|
||||||
|
|
||||||
|
- (NSPoint)currentPoint;
|
||||||
|
|
||||||
|
- (NSRect)controlPointBounds;
|
||||||
|
|
||||||
|
- (NSRect)bounds;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Elements
|
||||||
|
//
|
||||||
|
- (int)elementCount;
|
||||||
|
|
||||||
|
- (NSBezierPathElement)elementAtIndex:(int)index
|
||||||
|
associatedPoints:(NSPoint *)points;
|
||||||
|
|
||||||
|
//- (NSBezierPathElement)elementAtIndex:(int)index
|
||||||
|
// associatedPoints:(NSPointArray)points;
|
||||||
|
|
||||||
|
- (NSBezierPathElement)elementAtIndex:(int)index;
|
||||||
|
|
||||||
|
- (void)setAssociatedPoints:(NSPoint *)points atIndex:(int)index;
|
||||||
|
|
||||||
|
//- (void)setAssociatedPoints:(NSPointArray)points atIndex:(int)index;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Appending common paths
|
||||||
|
//
|
||||||
|
- (void)appendBezierPath:(NSBezierPath *)path;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithRect:(NSRect)rect;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithPoints:(NSPoint *)points count:(int)count;
|
||||||
|
|
||||||
|
//- (void)appendBezierPathWithPoints:(NSPointArray)points count:(int)count;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithOvalInRect:(NSRect)aRect;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithArcWithCenter:(NSPoint)center
|
||||||
|
radius:(float)radius
|
||||||
|
startAngle:(float)startAngle
|
||||||
|
endAngle:(float)endAngle
|
||||||
|
clockwise:(BOOL)clockwise;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithArcWithCenter:(NSPoint)center
|
||||||
|
radius:(float)radius
|
||||||
|
startAngle:(float)startAngle
|
||||||
|
endAngle:(float)endAngle;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithArcFromPoint:(NSPoint)point1
|
||||||
|
toPoint:(NSPoint)point2
|
||||||
|
radius:(float)radius;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithGlyph:(NSGlyph)glyph inFont:(NSFont *)font;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithGlyphs:(NSGlyph *)glyphs
|
||||||
|
count:(int)count
|
||||||
|
inFont:(NSFont *)font;
|
||||||
|
|
||||||
|
- (void)appendBezierPathWithPackedGlyphs:(const char *)packedGlyphs;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hit detection
|
// Hit detection
|
||||||
//
|
//
|
||||||
- (BOOL)isHitByPoint:(NSPoint)aPoint;
|
- (BOOL)containsPoint:(NSPoint)point;
|
||||||
|
|
||||||
- (BOOL)isHitByRect:(NSRect)aRect;
|
|
||||||
|
|
||||||
- (BOOL)isHitByPath:(NSBezierPath *)aBezierPath;
|
|
||||||
|
|
||||||
- (BOOL)isStrokeHitByPoint:(NSPoint)aPoint;
|
|
||||||
|
|
||||||
- (BOOL)isStrokeHitByRect:(NSRect)aRect;
|
|
||||||
|
|
||||||
- (BOOL)isStrokeHitByPath:(NSBezierPath *)aBezierPath;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Querying paths
|
// Caching
|
||||||
//
|
|
||||||
- (NSRect)bounds;
|
|
||||||
|
|
||||||
- (NSRect)controlPointBounds;
|
|
||||||
|
|
||||||
- (NSPoint)currentPoint;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Accessing elements of a path
|
|
||||||
//
|
|
||||||
- (int)elementCount;
|
|
||||||
|
|
||||||
- (NSBezierPathElementType)elementTypeAtIndex:(int)index;
|
|
||||||
|
|
||||||
- (NSBezierPathElementType)elementTypeAtIndex:(int)index
|
|
||||||
associatedPoints:(NSPoint *)points;
|
|
||||||
|
|
||||||
- (void)removeLastElement;
|
|
||||||
|
|
||||||
- (int)pointCount;
|
|
||||||
|
|
||||||
- (NSPoint)pointAtIndex:(int)index;
|
|
||||||
|
|
||||||
- (void)setPointAtIndex:(int)index toPoint:(NSPoint)aPoint;
|
|
||||||
|
|
||||||
- (int)pointIndexForPathElementIndex:(int)index;
|
|
||||||
|
|
||||||
- (int)pathElementIndexForPointIndex:(int)index;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Caching paths
|
|
||||||
//
|
//
|
||||||
- (BOOL)cachesBezierPath;
|
- (BOOL)cachesBezierPath;
|
||||||
|
|
||||||
|
@ -202,4 +274,4 @@ typedef enum {
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif // NSBEZIERPATH_H
|
#endif // BEZIERPATH_H
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue