mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:10:47 +00:00
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:
parent
470eb5e9d1
commit
1049f1f10f
4 changed files with 52 additions and 18 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,20 +1,28 @@
|
||||||
Fri Jan 31 05:30:40 1997 Scott Christley <scottc@net-community.com>
|
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.
|
* Makefile.in: Clean up code.
|
||||||
* configure.in: Update ftp messages; add Images directory.
|
* configure.in: Update ftp messages; add Images directory.
|
||||||
* configure: Regenerate based upon configure.in changes.
|
* configure: Regenerate based upon configure.in changes.
|
||||||
* Headers/gnustep/gui/NSCell.h (support): Remove instance variable.
|
* Headers/gnustep/gui/NSCell.h (support): Remove instance variable.
|
||||||
(cell_image, cell_font): New instance variables.
|
(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.
|
* Source/Makefile.in (GNUSTEP_RESOURCE, install-resource): Remove.
|
||||||
(GNUSTEP_INSTALL_LIBDIR): Add definition.
|
(GNUSTEP_INSTALL_LIBDIR): Add definition.
|
||||||
Correct some minor errors.
|
Correct some minor errors.
|
||||||
* Source/NSButtonCell.m: Modify for NSCell instance variables changes.
|
* Source/NSButtonCell.m: Modify for NSCell instance variables changes.
|
||||||
* Source/NSCell.m: Likewise.
|
* Source/NSCell.m: Likewise.
|
||||||
* Source/NSTextFieldCell.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
|
* Source/NSImage.m (NSImage_PATH): Default path for where NSImage
|
||||||
tries to find system image resources.
|
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>
|
Thu Jan 30 12:34:30 1997 Scott Christley <scottc@net-community.com>
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@
|
||||||
BOOL _isPlanar;
|
BOOL _isPlanar;
|
||||||
unsigned char** imagePlanes;
|
unsigned char** imagePlanes;
|
||||||
NSMutableData* imageData;
|
NSMutableData* imageData;
|
||||||
|
|
||||||
|
// Reserved for back-end use
|
||||||
|
void *back_end_reserved;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -248,7 +248,9 @@
|
||||||
return [NSArray arrayWithObjects: NSTIFFPboardType, nil];
|
return [NSArray arrayWithObjects: NSTIFFPboardType, nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Getting Information about the Image
|
// Getting Information about the Image
|
||||||
|
//
|
||||||
- (int) bitsPerPixel
|
- (int) bitsPerPixel
|
||||||
{
|
{
|
||||||
return bitsPerPixel;
|
return bitsPerPixel;
|
||||||
|
@ -279,7 +281,9 @@
|
||||||
return bytesPerRow;
|
return bytesPerRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Getting Image Data
|
// Getting Image Data
|
||||||
|
//
|
||||||
- (unsigned char *) bitmapData
|
- (unsigned char *) bitmapData
|
||||||
{
|
{
|
||||||
unsigned char *planes[MAX_PLANES];
|
unsigned char *planes[MAX_PLANES];
|
||||||
|
@ -324,11 +328,12 @@
|
||||||
|
|
||||||
- (BOOL) draw
|
- (BOOL) draw
|
||||||
{
|
{
|
||||||
[self bitmapData];
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Producing a TIFF Representation of the Image
|
// Producing a TIFF Representation of the Image
|
||||||
|
//
|
||||||
+ (NSData *) TIFFRepresentationOfImageRepsInArray: (NSArray *)anArray
|
+ (NSData *) TIFFRepresentationOfImageRepsInArray: (NSArray *)anArray
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
|
@ -356,8 +361,9 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// Setting and Checking Compression Types
|
// Setting and Checking Compression Types
|
||||||
|
//
|
||||||
+ (void) getTIFFCompressionTypes: (const NSTIFFCompression **)list
|
+ (void) getTIFFCompressionTypes: (const NSTIFFCompression **)list
|
||||||
count: (int *)numTypes
|
count: (int *)numTypes
|
||||||
{
|
{
|
||||||
|
@ -388,8 +394,9 @@
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
// NSCoding protocol
|
// NSCoding protocol
|
||||||
|
//
|
||||||
- (void) encodeWithCoder: aCoder
|
- (void) encodeWithCoder: aCoder
|
||||||
{
|
{
|
||||||
[self notImplemented: _cmd];
|
[self notImplemented: _cmd];
|
||||||
|
|
|
@ -50,10 +50,6 @@
|
||||||
/* Backend protocol - methods that must be implemented by the backend to
|
/* Backend protocol - methods that must be implemented by the backend to
|
||||||
complete the class */
|
complete the class */
|
||||||
@protocol NSImageBackend
|
@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
|
- (void) compositeToPoint: (NSPoint)point fromRect: (NSRect)rect
|
||||||
operation: (NSCompositingOperation)op;
|
operation: (NSCompositingOperation)op;
|
||||||
- (void) dissolveToPoint: (NSPoint)point fromRect: (NSRect)rect
|
- (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
|
// 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
|
// If a cache exists, but is not valid, redraw the cache from the original
|
||||||
// image (if there is one).
|
// image (if there is one).
|
||||||
- _doImageCache
|
- (NSImageRep *)_doImageCache
|
||||||
{
|
{
|
||||||
NSImageRep *rep;
|
NSImageRep *rep = nil;
|
||||||
rep_data_t repd;
|
rep_data_t repd;
|
||||||
|
|
||||||
repd = repd_for_rep(_reps, [self bestRepresentationForDevice: nil]);
|
repd = repd_for_rep(_reps, [self bestRepresentationForDevice: nil]);
|
||||||
rep = repd.rep;
|
rep = repd.rep;
|
||||||
if (repd.cache)
|
if (repd.cache)
|
||||||
rep = repd.cache;
|
rep = repd.cache;
|
||||||
|
|
||||||
if (![rep isKindOfClass: [NSCachedImageRep class]])
|
if (![rep isKindOfClass: [NSCachedImageRep class]])
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
[self lockFocus];
|
[self lockFocus];
|
||||||
{
|
{
|
||||||
rep_data_t cached;
|
rep_data_t cached;
|
||||||
|
@ -519,21 +518,19 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
|
||||||
_lockedView = [NSView focusView];
|
_lockedView = [NSView focusView];
|
||||||
bounds = [_lockedView bounds];
|
bounds = [_lockedView bounds];
|
||||||
[self _displayEraseRect: bounds view: _lockedView color: _color];
|
[self _displayEraseRect: bounds view: _lockedView color: _color];
|
||||||
[self drawRepresentation: rep
|
|
||||||
inRect: NSMakeRect(0, 0, _size.width, _size.height)];
|
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
#if 0
|
|
||||||
[[_reps lastObject] getValue: &cached];
|
[[_reps lastObject] getValue: &cached];
|
||||||
cached.original = rep;
|
cached.original = rep;
|
||||||
cached.validCache = YES;
|
cached.validCache = YES;
|
||||||
[_reps removeLastObject];
|
[_reps removeLastObject];
|
||||||
[_reps addObject:
|
[_reps addObject:
|
||||||
[NSValue value: &cached withObjCType: @encode(rep_data_t)]];
|
[NSValue value: &cached withObjCType: @encode(rep_data_t)]];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (!repd.validCache)
|
else if (!repd.validCache)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
[self lockFocusOnRepresentation: rep];
|
[self lockFocusOnRepresentation: rep];
|
||||||
{
|
{
|
||||||
NSRect bounds;
|
NSRect bounds;
|
||||||
|
@ -546,9 +543,10 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
|
||||||
repd.validCache = YES;
|
repd.validCache = YES;
|
||||||
set_repd_for_rep(_reps, repd.rep, &repd);
|
set_repd_for_rep(_reps, repd.rep, &repd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using the Image
|
// 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
|
- (void) compositeToPoint: (NSPoint)aPoint fromRect: (NSRect)aRect
|
||||||
operation: (NSCompositingOperation)op;
|
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;
|
- (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
|
- (void) dissolveToPoint: (NSPoint)aPoint fromRect: (NSRect)aRect
|
||||||
fraction: (float)aFloat;
|
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
|
- (BOOL)drawRepresentation: (NSImageRep *)imageRep inRect: (NSRect)rect
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue