mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
When requesting a tiff representation for an image where there is no
bitmap representation, create one. Idea by Renaud Molla <renaud.molla@wanadoo.fr>. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24820 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f8969f62c9
commit
210c327204
2 changed files with 49 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSImage.m (-TIFFRepresentation,
|
||||
-TIFFRepresentationUsingCompression:factor:): If there is no
|
||||
bitmap representation create one and store it.
|
||||
Idea by Renaud Molla <renaud.molla@wanadoo.fr>.
|
||||
|
||||
2007-03-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSDocument.m
|
||||
|
|
|
@ -1421,15 +1421,55 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
// Producing TIFF Data for the Image
|
||||
- (NSData *) TIFFRepresentation
|
||||
{
|
||||
return [bitmapClass TIFFRepresentationOfImageRepsInArray: [self representations]];
|
||||
NSData *data;
|
||||
|
||||
// As a result of using bitmap representations, new drawing wont show on the tiff data.
|
||||
data = [bitmapClass TIFFRepresentationOfImageRepsInArray: [self representations]];
|
||||
|
||||
if (!data)
|
||||
{
|
||||
NSBitmapImageRep *rep;
|
||||
NSSize size = [self size];
|
||||
|
||||
// If there isn't a bitmap representation to output, create one and store it.
|
||||
[self lockFocus];
|
||||
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
|
||||
NSMakeRect(0.0, 0.0, size.width, size.height)];
|
||||
[self unlockFocus];
|
||||
[self addRepresentation: rep];
|
||||
data = [rep TIFFRepresentation];
|
||||
RELEASE(rep);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSData *) TIFFRepresentationUsingCompression: (NSTIFFCompression)comp
|
||||
factor: (float)aFloat
|
||||
{
|
||||
return [bitmapClass TIFFRepresentationOfImageRepsInArray: [self representations]
|
||||
NSData *data;
|
||||
|
||||
// As a result of using bitmap representations, new drawing wont show on the tiff data.
|
||||
data = [bitmapClass TIFFRepresentationOfImageRepsInArray: [self representations]
|
||||
usingCompression: comp
|
||||
factor: aFloat];
|
||||
|
||||
if (!data)
|
||||
{
|
||||
NSBitmapImageRep *rep;
|
||||
NSSize size = [self size];
|
||||
|
||||
// If there isn't a bitmap representation to output, create one and store it.
|
||||
[self lockFocus];
|
||||
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:
|
||||
NSMakeRect(0.0, 0.0, size.width, size.height)];
|
||||
[self unlockFocus];
|
||||
[self addRepresentation: rep];
|
||||
data = [rep TIFFRepresentationUsingCompression: comp factor: aFloat];
|
||||
RELEASE(rep);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// NSCoding
|
||||
|
|
Loading…
Reference in a new issue