1  //  PXCanvas.h
2  //  Pixen
3  //
4  //  Created by Joe Osborn on Sat Sep 13 2003.
5  //  Copyright (c) 2003 Open Sword Group. All rights reserved.
6  //
7 
8 #import <AppKit/AppKit.h>
9 
10 extern NSString * PXCanvasSizeChangedNotificationName;
11 extern NSString * PXCanvasChangedNotificationName;
12 extern NSString * PXCanvasSelectionChangedNotificationName;
13 extern NSString * PXCanvasLayersChangedNotificationName;
14 
15 @class PXImage;
16 
17 @interface PXCanvas : NSObject <NSCoding>{
18     id layers;
19 	id activeLayer;
20 	id lastActiveLayer;
21     id mainBackgroundName, alternateBackgroundName;
22 
23 	NSSize gridUnitSize;
24 	id gridColor;
25 	BOOL gridShouldDraw;
26 
27 	NSSize previewSize;
28 	id palette;
29 
30 	NSPoint lastDrawnPoint;
31 }
32 + withContentsOfFile:aFile;
33 - initWithContentsOfFile:aFile;
34 - undoManager;
35 
36 - palette;
37 
38 - (BOOL)canDrawAtPoint:(NSPoint)point;
39 - colorAtPoint:(NSPoint)aPoint;
40 - (void)setColor:aColor atPoint:(NSPoint)aPoint;
41 - (void)setColor:aColor atPoints:(NSArray *)points;
42 
43 - activeLayer;
44 - (void)activateLayer:aLayer;
45 - layers;
46 - (int)indexOfLayer:aLayer;
47 - (void)setLayers:newLayers;
48 - (void)addLayer:aLayer;
49 - (void)insertLayer:aLayer atIndex:(int)index;
50 - (void)removeLayer:aLayer;
51 - (void)removeLayerAtIndex:(int)index;
52 - (void)moveLayer:aLayer toIndex:(int)anIndex;
53 - (void)setLayers:layers fromLayers:oldLayers;
54 - lastActiveLayer;
55 - (void)restoreActivateLayer:aLayer lastActiveLayer:lastLayer;
56 
57 - (NSSize)size;
58 - (void)setSize:(NSSize)newSize withOrigin:(NSPoint)origin backgroundColor:(NSColor *)color;
59 - (void)setSize:(NSSize)aSize;
60 - (void)drawRect:(NSRect)rect fixBug:(BOOL)fixBug;
61 - (void)changedInRect:(NSRect)rect;
62 - (void)layersChanged;
63 - (void)canvasShouldRedraw:aNotification;
64 - (NSPoint)correct:(NSPoint)aPoint;
65 - (BOOL)containsPoint:(NSPoint)aPoint;
66 
67 - (NSSize)previewSize;
68 - (void)setPreviewSize:(NSSize)size;
69 
70 - mainBackgroundName;
71 - (void)setMainBackgroundName:aName;
72 - alternateBackgroundName;
73 - (void)setAlternateBackgroundName:aName;
74 
75 - (void)replacePixelsOfColor:oldColor withColor:newColor;
76 
77 - (NSSize)gridUnitSize;
78 - (void)setGridUnitSize:(NSSize)newGridUnitSize;
79 - gridColor;
80 - (void)setGridColor:newGridColor;
81 - (BOOL)gridShouldDraw;
82 - (void)setGridShouldDraw:(BOOL)newGridShouldDraw;
83 
84 - (BOOL)hasImage:anImage;
85 - (BOOL)hasSelection;
86 - (void)promoteSelection;
87 - (void)finalizeSelection;
88 - (void)deselect;
89 - (void)deselectPixelAtPoint:(NSPoint)point;
90 - (void)selectPixelAtPoint:(NSPoint)point;
91 - (BOOL)pointIsSelected:(NSPoint)point;
92 - (void)selectAll;
93 - (NSRect)selectedRect;
94 
95 - (void)pasteFromPasteboard:board type:type;
96 - (NSData *)selectionData;
97 - (void)deleteSelection;
98 
99 - imageDataWithType:(NSBitmapImageFileType)storageType properties:(NSDictionary *)properties;
100 - initWithImage:(NSImage *)anImage;
101 - initWithPSDData:(NSData *)data;
102 - PICTData;
103 
104 - (void)setDefaultGridParameters;
105 - (void)applyImage:anImage toLayer:aLayer;
106 
107 - (void)setLastDrawnPoint:(NSPoint)point;
108 - (NSPoint)lastDrawnPoint;
109 
110 @end
111