mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 14:20:49 +00:00
Merge Source/NSBimapImageRep,GIF,JPEG,PNG files
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38662 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
630073e694
commit
6315d5f4b0
4 changed files with 59 additions and 29 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
<abstract>Bitmap image representation.</abstract>
|
||||
|
||||
Copyright (C) 1996, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
|
||||
Author: Adam Fedor <fedor@gnu.org>
|
||||
Date: Feb 1996
|
||||
|
@ -834,8 +834,8 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
all = ((1<<bit_width)-1) << shift;
|
||||
|
||||
if (byte1 != byte2)
|
||||
base[byte1] = (value >> 8) | (base[byte1] ^ (all >> 8));
|
||||
base[byte2] = (value & 255) | (base[byte2] ^ (all & 255));
|
||||
base[byte1] = (value >> 8) | (base[byte1] & ~(all >> 8));
|
||||
base[byte2] = (value & 255) | (base[byte2] & ~(all & 255));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1498,9 +1498,9 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
info.compression = [NSBitmapImageRep _localFromCompressionType: type];
|
||||
if (factor < 0)
|
||||
factor = 0;
|
||||
if (factor > 255)
|
||||
factor = 255;
|
||||
info.quality = (1 - ((float)factor)/255.0) * 100;
|
||||
if (factor > 1)
|
||||
factor = 1;
|
||||
info.quality = factor * 100;
|
||||
info.numImages = 1;
|
||||
info.error = 0;
|
||||
|
||||
|
@ -1685,8 +1685,8 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
/** Returns the receivers compression and compression factor, which is
|
||||
set either when the image is read in or by -setCompression:factor:.
|
||||
Factor is ignored in many compression schemes. For JPEG compression,
|
||||
factor can be any value from 0 to 255, with 255 being the maximum
|
||||
compression. */
|
||||
factor can be any value from 0 to 1, with 1 being the maximum
|
||||
quality. */
|
||||
- (void) getCompression: (NSTIFFCompression*)compression
|
||||
factor: (float*)factor
|
||||
{
|
||||
|
@ -1712,7 +1712,7 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
<term> NSImageCompressionMethod </term>
|
||||
<desc> NSNumber; automatically set when reading TIFF data; writing TIFF data </desc>
|
||||
<term> NSImageCompressionFactor </term>
|
||||
<desc> NSNumber 0.0 to 255.0; writing JPEG data
|
||||
<desc> NSNumber 0.0 to 1.0; writing JPEG data
|
||||
(GNUstep extension: JPEG-compressed TIFFs too) </desc>
|
||||
<term> NSImageProgressive </term>
|
||||
<desc> NSNumber boolean; automatically set when reading JPEG data; writing JPEG data.
|
||||
|
@ -1761,7 +1761,8 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
|
||||
copy = (NSBitmapImageRep*)[super copyWithZone: zone];
|
||||
|
||||
copy->_imageData = [_imageData copyWithZone: zone];
|
||||
copy->_properties = [_properties copyWithZone: zone];
|
||||
copy->_imageData = [_imageData mutableCopyWithZone: zone];
|
||||
copy->_imagePlanes = NSZoneMalloc(zone, sizeof(unsigned char*) * MAX_PLANES);
|
||||
if (_imageData == nil)
|
||||
{
|
||||
|
@ -1911,7 +1912,7 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
|||
bytesPerRow: 0
|
||||
bitsPerPixel: 0];
|
||||
_compression = [NSBitmapImageRep _compressionTypeFromLocal: info->compression];
|
||||
_comp_factor = 255 * (1 - ((float)info->quality)/100.0);
|
||||
_comp_factor = (((float)info->quality)/100.0);
|
||||
|
||||
// Note that Cocoa does not do this, even though the docs say it should
|
||||
[_properties setObject: [NSNumber numberWithUnsignedShort: _compression]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue