Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Instance Methods | Protected Attributes
Image Class Reference

#import "Image.h"

Inheritance diagram for Image:
[legend]
Collaboration diagram for Image:
[legend]

Instance Methods

(id) - init
 
(id) - displayImage
 
(id) - drawSelf::
 
(id) - free
 
(id) - saveAsTiff:usingCompression:
 
(id) - saveAsEPS:
 
(id) - windowWillClose:
 
() - return(self) [implementation]
 

Protected Attributes

id thiswindow
 
id thisview
 
id tiffimage
 
int xsize
 
int ysize
 
void * rmap
 
void * gmap
 
void * bmap
 
void * amap
 
unsigned char * r
 
unsigned char * g
 
unsigned char * b
 
unsigned char * a
 
NXZone * newZone
 
char fileName [1024]
 
char windowIconName [1024]
 
int numColors
 
NXRect temprect
 

Detailed Description

Definition at line 26 of file Image.m.

Method Documentation

- (id) displayImage

Definition at line 36 of file Image.m.

References a, b, fileName, g, r, thiswindow, and windowIconName.

Referenced by RASF::open:, and RLE::open:.

37 {
38 
39  unsigned char *planes[4];
40 
41  NXSetRect(&temprect, 150.0, (800.0 - (double)ysize),(double)xsize, (double)ysize);
42 
43  thiswindow = [[Window allocFromZone:newZone]
44  initContent:&temprect
45  style:NX_TITLEDSTYLE
46  backing:NX_RETAINED
47  buttonMask:NX_CLOSEBUTTONMASK | NX_MINIATURIZEBUTTONMASK | NX_RESIZEBUTTONMASK
48  defer:NO];
49 
50  [thiswindow setDelegate:self];
51  [thiswindow setFreeWhenClosed:YES];
52  [thiswindow setTitleAsFilename:fileName];
53  if (windowIconName[0]){
54  [thiswindow setMiniwindowIcon:(const char *)windowIconName];
55  }
56 
57  [thiswindow makeKeyAndOrderFront:nil];
58  [thiswindow display];
59  NXPing();
60 
61  if (r == NULL){ // Check if there is anything to display if there isn't
62  return self; // just return
63  }
64 
65  planes[0] = r;
66  planes[1] = g;
67  planes[2] = b;
68  planes[3] = a;
69 
70  tiffimage = [[NXBitmapImageRep allocFromZone:newZone]
71  initDataPlanes: planes
72  pixelsWide: xsize
73  pixelsHigh: ysize
74  bitsPerSample: 8
75  samplesPerPixel: numColors
76  hasAlpha: (numColors == 4 ? YES: NO )
77  isPlanar: (numColors == 1 ? NO : YES)
78  colorSpace: (numColors >= 3 ? NX_RGBColorSpace : NX_OneIsWhiteColorSpace)
79  bytesPerRow: xsize*8
80  bitsPerPixel: 8];
81 
82  [thiswindow setContentView:self];
83  [thiswindow display];
84  return(self);
85 }
unsigned char * g
Definition: Image.h:20
unsigned char * r
Definition: Image.h:20
unsigned char * a
Definition: Image.h:20
unsigned char * b
Definition: Image.h:20
NXRect temprect
Definition: Image.h:25
int ysize
Definition: Image.h:18
int xsize
Definition: Image.h:18
id thiswindow
Definition: Image.h:16
id tiffimage
Definition: Image.h:17
char windowIconName[1024]
Definition: Image.h:23

Here is the caller graph for this function:

- (id) drawSelf: (const NXRect *)  rects
: (int rectCount 

Definition at line 87 of file Image.m.

87  :(const NXRect *)rects :(int)rectCount
88 {
89  [self getFrame:&temprect];
90  temprect.origin.x = 0.0;
91  temprect.origin.y = 0.0;
92 
93  [self lockFocus];
94  [tiffimage drawIn:&temprect];
95  [self unlockFocus];
96  return self;
97 }
NXRect temprect
Definition: Image.h:25
- (id) free

Definition at line 99 of file Image.m.

References a, b, g, and r.

100 {
101  NX_FREE(a);
102  NX_FREE(r);
103  NX_FREE(g);
104  NX_FREE(b);
105  [super free];
106  return(self);
107 }
unsigned char * g
Definition: Image.h:20
unsigned char * r
Definition: Image.h:20
unsigned char * a
Definition: Image.h:20
unsigned char * b
Definition: Image.h:20
- (id) init

Implemented in RLE, and RASF.

- (return(self))
implementation

Implemented in RLE, and RASF.

- (id) saveAsEPS: (const char *)  filename

Definition at line 124 of file Image.m.

124  :(const char *)filename
125 {
126  int fd;
127  NXStream *stream;
128 
129  if ( (fd = open(filename,(O_RDWR|O_CREAT),0600)) < 0){
130  return(self);
131  }
132  stream = NXOpenFile(fd,NX_READWRITE);
133  [self copyPSCodeInside:&temprect to:stream];
134  NXClose(stream);
135  close(fd);
136  return(self);
137 }
FILE * fd
Definition: getfb.h:18
- (id) saveAsTiff: (const char *)  filename
usingCompression: (int compression 

Definition at line 109 of file Image.m.

109  :(const char *)filename usingCompression:(int)compression
110 {
111  int fd;
112  NXStream *stream;
113 
114  if ( (fd = open(filename,(O_RDWR|O_CREAT),0600)) < 0){
115  return(self);
116  }
117  stream = NXOpenFile(fd,NX_READWRITE);
118  [tiffimage writeTIFF:stream usingCompression:compression];
119  NXClose(stream);
120  close(fd);
121  return(self);
122 }
static unsigned short compression
Definition: rletotiff.c:48
FILE * fd
Definition: getfb.h:18
- (id) windowWillClose: (id)  sender

Definition at line 140 of file Image.m.

References a, b, g, and r.

140  :sender
141 {
142  NX_FREE(a); // Free the alpha,red,green, and blue buffers
143  NX_FREE(r);
144  NX_FREE(g);
145  NX_FREE(b);
146  return(self);
147 }
unsigned char * g
Definition: Image.h:20
unsigned char * r
Definition: Image.h:20
unsigned char * a
Definition: Image.h:20
unsigned char * b
Definition: Image.h:20

Field Documentation

- (unsigned char *) a
protected

Definition at line 20 of file Image.h.

Referenced by displayImage, free, RLE::open:, and windowWillClose:.

- (void *) amap
protected

Definition at line 19 of file Image.h.

- (unsigned char *) b
protected

Definition at line 20 of file Image.h.

Referenced by displayImage, free, RASF::open:, RLE::open:, and windowWillClose:.

- (void *) bmap
protected

Definition at line 19 of file Image.h.

- (char fileName[1024])
protected

Definition at line 22 of file Image.h.

Referenced by displayImage, RLE::open:, and RASF::open:.

- (unsigned char *) g
protected

Definition at line 20 of file Image.h.

Referenced by displayImage, free, RASF::open:, RLE::open:, and windowWillClose:.

- (void *) gmap
protected

Definition at line 19 of file Image.h.

- (NXZone*) newZone
protected

Definition at line 21 of file Image.h.

- (int) numColors
protected

Definition at line 24 of file Image.h.

Referenced by RASF::open:, and RLE::open:.

- (unsigned char*) r
protected

Definition at line 20 of file Image.h.

Referenced by displayImage, free, RASF::open:, RLE::open:, and windowWillClose:.

- (void*) rmap
protected

Definition at line 19 of file Image.h.

Referenced by RASF::open:, and RLE::open:.

- (NXRect) temprect
protected

Definition at line 25 of file Image.h.

- (id) thisview
protected

Definition at line 16 of file Image.h.

Referenced by RASF::open:, and RLE::open:.

- (id) thiswindow
protected

Definition at line 16 of file Image.h.

Referenced by displayImage.

- (id) tiffimage
protected

Definition at line 17 of file Image.h.

- (char windowIconName[1024])
protected

Definition at line 23 of file Image.h.

Referenced by displayImage.

- (int) xsize
protected

Definition at line 18 of file Image.h.

Referenced by RASF::open:, and RLE::open:.

- (int) ysize
protected

Definition at line 18 of file Image.h.

Referenced by RASF::open:, and RLE::open:.


The documentation for this class was generated from the following files: