mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Apply patch by Eric Wasylishen to correct the orientation of colorAtX:y:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29120 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
288ce81a3b
commit
b712698565
3 changed files with 27 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2009-12-12 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSBitmapImageRep.m:
|
||||||
|
* Source/GSThemeTools.m:
|
||||||
|
Change the colorAtX:y: and related methods in NSBitmapImageRep
|
||||||
|
to use flipped coordinates, matching OS X. colorAtX:0 y:0 now
|
||||||
|
returns the top-left pixel instead of the bottom left.
|
||||||
|
|
||||||
2009-12-12 Fred Kiefer <FredKiefer@gmx.de>
|
2009-12-12 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSApplication (-setWindowsMenu:): Only add windows that
|
* Source/NSApplication (-setWindowsMenu:): Only add windows that
|
||||||
|
|
|
@ -791,7 +791,7 @@ withRepeatedImage: (NSImage*)image
|
||||||
|
|
||||||
for (i = 0; i < s.width; i++)
|
for (i = 0; i < s.width; i++)
|
||||||
{
|
{
|
||||||
NSColor *pixelColor = [rep colorAtX: i y: s.height - 1];
|
NSColor *pixelColor = [rep colorAtX: i y: 0];
|
||||||
|
|
||||||
[pixelColor getRed: &r green: &g blue: &b alpha: &a];
|
[pixelColor getRed: &r green: &g blue: &b alpha: &a];
|
||||||
if (a > 0 && x1 == -1)
|
if (a > 0 && x1 == -1)
|
||||||
|
|
|
@ -756,6 +756,10 @@ _get_bit_value(unsigned char *base, long msb_off, int bit_width)
|
||||||
return value & ((1<<bit_width)-1);
|
return value & ((1<<bit_width)-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the values of the components of pixel (x,y), where (0,0) is the
|
||||||
|
* top-left pixel in the image, by storing them in the array pixelData.
|
||||||
|
*/
|
||||||
- (void) getPixel: (unsigned int[])pixelData atX: (int)x y: (int)y
|
- (void) getPixel: (unsigned int[])pixelData atX: (int)x y: (int)y
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -768,9 +772,7 @@ _get_bit_value(unsigned char *base, long msb_off, int bit_width)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: The y value is taken from the bottom of the image.
|
line_offset = _bytesPerRow * y;
|
||||||
// Not sure if this is correct.
|
|
||||||
line_offset = _bytesPerRow * (_pixelsHigh - 1 - y);
|
|
||||||
if (_isPlanar)
|
if (_isPlanar)
|
||||||
{
|
{
|
||||||
if (_bitsPerSample == 8)
|
if (_bitsPerSample == 8)
|
||||||
|
@ -847,6 +849,10 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
||||||
base[byte2] = (value & 255) | (base[byte2] ^ (all & 255));
|
base[byte2] = (value & 255) | (base[byte2] ^ (all & 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the components of pixel (x,y), where (0,0) is the top-left pixel in
|
||||||
|
* the image, to the given array of pixel components.
|
||||||
|
*/
|
||||||
- (void) setPixel: (unsigned int[])pixelData atX: (int)x y: (int)y
|
- (void) setPixel: (unsigned int[])pixelData atX: (int)x y: (int)y
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -865,9 +871,7 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
||||||
[self bitmapData];
|
[self bitmapData];
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: The y value is taken from the bottom of the image.
|
line_offset = _bytesPerRow * y;
|
||||||
// Not sure if this is correct.
|
|
||||||
line_offset = _bytesPerRow * (_pixelsHigh - 1 - y);
|
|
||||||
if(_isPlanar)
|
if(_isPlanar)
|
||||||
{
|
{
|
||||||
if (_bitsPerSample == 8)
|
if (_bitsPerSample == 8)
|
||||||
|
@ -911,6 +915,10 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an NSColor object representing the color of the pixel (x,y), where
|
||||||
|
* (0,0) is the top-left pixel in the image.
|
||||||
|
*/
|
||||||
- (NSColor*) colorAtX: (int)x y: (int)y
|
- (NSColor*) colorAtX: (int)x y: (int)y
|
||||||
{
|
{
|
||||||
unsigned int pixelData[5];
|
unsigned int pixelData[5];
|
||||||
|
@ -1159,6 +1167,10 @@ _set_bit_value(unsigned char *base, long msb_off, int bit_width,
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color of pixel (x,y), where (0,0) is the top-left pixel in the
|
||||||
|
* image.
|
||||||
|
*/
|
||||||
- (void) setColor: (NSColor*)color atX: (int)x y: (int)y
|
- (void) setColor: (NSColor*)color atX: (int)x y: (int)y
|
||||||
{
|
{
|
||||||
unsigned int pixelData[5];
|
unsigned int pixelData[5];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue