Additional NSImage and NSBitmapImageRep work.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2074 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Scott Christley 1997-01-31 20:14:40 +00:00
parent c3a77368f8
commit bd72fe90c1
4 changed files with 52 additions and 18 deletions

View file

@ -1,20 +1,28 @@
Fri Jan 31 05:30:40 1997 Scott Christley <scottc@net-community.com>
* Move and install resources to a more appropriate place.
* gnustep/gui/resource: Remove directory and files.
* Images: New directory.
* Images/README: New file.
* Images/Makefile.in: New file.
* Makefile.in: Clean up code.
* configure.in: Update ftp messages; add Images directory.
* configure: Regenerate based upon configure.in changes.
* Headers/gnustep/gui/NSCell.h (support): Remove instance variable.
(cell_image, cell_font): New instance variables.
* gnustep/gui/resource: Remove directory and files; these resources
have been moved elsewhere like the new Images directory.
* Source/Makefile.in (GNUSTEP_RESOURCE, install-resource): Remove.
(GNUSTEP_INSTALL_LIBDIR): Add definition.
Correct some minor errors.
* Source/NSButtonCell.m: Modify for NSCell instance variables changes.
* Source/NSCell.m: Likewise.
* Source/NSTextFieldCell.m: Likewise.
* Headers/gnustep/gui/NSBitmapImageRep.h (back_end_reserved):
New instance variable for backend use.
* Source/NSImage.m (NSImage_PATH): Default path for where NSImage
tries to find system image resources.
(-_displayEraseRect:view:color:): Eliminate method.
(-_doImageCache): Remove drawing code and place in proper methods.
Thu Jan 30 12:34:30 1997 Scott Christley <scottc@net-community.com>

View file

@ -45,6 +45,9 @@
BOOL _isPlanar;
unsigned char** imagePlanes;
NSMutableData* imageData;
// Reserved for back-end use
void *back_end_reserved;
}
//

View file

@ -248,7 +248,9 @@
return [NSArray arrayWithObjects: NSTIFFPboardType, nil];
}
//
// Getting Information about the Image
//
- (int) bitsPerPixel
{
return bitsPerPixel;
@ -279,7 +281,9 @@
return bytesPerRow;
}
//
// Getting Image Data
//
- (unsigned char *) bitmapData
{
unsigned char *planes[MAX_PLANES];
@ -324,11 +328,12 @@
- (BOOL) draw
{
[self bitmapData];
return NO;
}
//
// Producing a TIFF Representation of the Image
//
+ (NSData *) TIFFRepresentationOfImageRepsInArray: (NSArray *)anArray
{
[self notImplemented: _cmd];
@ -356,8 +361,9 @@
return nil;
}
//
// Setting and Checking Compression Types
//
+ (void) getTIFFCompressionTypes: (const NSTIFFCompression **)list
count: (int *)numTypes
{
@ -388,8 +394,9 @@
[self notImplemented: _cmd];
}
//
// NSCoding protocol
//
- (void) encodeWithCoder: aCoder
{
[self notImplemented: _cmd];

View file

@ -50,10 +50,6 @@
/* Backend protocol - methods that must be implemented by the backend to
complete the class */
@protocol NSImageBackend
- (void) _displayEraseRect: (NSRect)bounds view: (NSView *)view
color: (NSColor *)color;
// Info: This Backend function needs to erase the "view" area
// defined by "rect" to the color "color".
- (void) compositeToPoint: (NSPoint)point fromRect: (NSRect)rect
operation: (NSCompositingOperation)op;
- (void) dissolveToPoint: (NSPoint)point fromRect: (NSRect)rect
@ -502,16 +498,19 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
// a cache and no cache exists, create one and draw the representation in it
// If a cache exists, but is not valid, redraw the cache from the original
// image (if there is one).
- _doImageCache
- (NSImageRep *)_doImageCache
{
NSImageRep *rep;
NSImageRep *rep = nil;
rep_data_t repd;
repd = repd_for_rep(_reps, [self bestRepresentationForDevice: nil]);
rep = repd.rep;
if (repd.cache)
rep = repd.cache;
if (![rep isKindOfClass: [NSCachedImageRep class]])
{
#if 0
[self lockFocus];
{
rep_data_t cached;
@ -519,21 +518,19 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
_lockedView = [NSView focusView];
bounds = [_lockedView bounds];
[self _displayEraseRect: bounds view: _lockedView color: _color];
[self drawRepresentation: rep
inRect: NSMakeRect(0, 0, _size.width, _size.height)];
[self unlockFocus];
#if 0
[[_reps lastObject] getValue: &cached];
cached.original = rep;
cached.validCache = YES;
[_reps removeLastObject];
[_reps addObject:
[NSValue value: &cached withObjCType: @encode(rep_data_t)]];
#endif
}
#endif
}
else if (!repd.validCache)
{
#if 0
[self lockFocusOnRepresentation: rep];
{
NSRect bounds;
@ -546,9 +543,10 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
repd.validCache = YES;
set_repd_for_rep(_reps, repd.rep, &repd);
}
#endif
}
return self;
return rep;
}
// Using the Image
@ -564,7 +562,16 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
- (void) compositeToPoint: (NSPoint)aPoint fromRect: (NSRect)aRect
operation: (NSCompositingOperation)op;
{
[self _doImageCache];
NSImageRep *rep;
NSRect rect = NSMakeRect(aPoint.x, aPoint.y, _size.width, _size.height);
// xxx If fromRect specifies something other than full image
// then we need to construct a subimage to draw
rep = [self _doImageCache];
[self lockFocusOnRepresentation: rep];
[self drawRepresentation: rep inRect: rect];
[self unlockFocus];
}
- (void) dissolveToPoint: (NSPoint)aPoint fraction: (float)aFloat;
@ -578,7 +585,16 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
- (void) dissolveToPoint: (NSPoint)aPoint fromRect: (NSRect)aRect
fraction: (float)aFloat;
{
[self _doImageCache];
NSImageRep *rep;
NSRect rect = NSMakeRect(aPoint.x, aPoint.y, _size.width, _size.height);
// xxx If fromRect specifies something other than full image
// then we need to construct a subimage to draw
rep = [self _doImageCache];
[self lockFocusOnRepresentation: rep];
[self drawRepresentation: rep inRect: rect];
[self unlockFocus];
}
- (BOOL)drawRepresentation: (NSImageRep *)imageRep inRect: (NSRect)rect