-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPrintablePath.m
More file actions
executable file
·67 lines (55 loc) · 1.21 KB
/
Copy pathPrintablePath.m
File metadata and controls
executable file
·67 lines (55 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// PrintablePath.m
// Atari800MacX
//
// Created by Mark Grebe on Fri Apr 22 2005.
// Copyright (c) 2005 __MyCompanyName__. All rights reserved.
//
#import "PrintablePath.h"
@implementation PrintablePath
-(void) setLocation:(NSPoint)location
{
}
-(void) setColor:(NSColor *)pathColor
{
color = pathColor;
}
-(void)print:(NSRect)rect:(float)offset
{
float origY, origSizeY;
NSBezierPath *outputPath;
static float lastOffset = 0.0;
static NSAffineTransform *transform;
if (offset == 0.0)
outputPath = self;
else
{
if (offset != lastOffset)
{
[transform release];
transform = [NSAffineTransform transform];
[transform retain];
// Translate the glyph the apporpriate amount
[transform translateXBy:0.0 yBy:offset];
}
outputPath = [transform transformBezierPath:self];
}
lastOffset = offset;
origY = [outputPath bounds].origin.y;
origSizeY = origY + [outputPath bounds].size.height;
if (!(origY > rect.origin.y + rect.size.height ||
origSizeY < rect.origin.y))
{
[color set];
[outputPath stroke];
}
}
-(float)getYLocation
{
return ([self bounds].origin.y + [self bounds].size.height);
}
-(float)getMinYLocation
{
return ([self bounds].origin.y);
}
@end