mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:00:48 +00:00
opaqueness check
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5636 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
745d515d38
commit
593a51a67d
2 changed files with 30 additions and 0 deletions
|
@ -1,5 +1,9 @@
|
||||||
1999-12-28 Adam Fedor <fedor@gnu.org>
|
1999-12-28 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSBitmapImageRep.m ([NSBitmapImageRep
|
||||||
|
-initWithBitmapDataPlanes:...]): Move check for opaqueness to here
|
||||||
|
from backend.
|
||||||
|
|
||||||
* Headers/gnustep/gui/DPSOperators.h: New operators colorimage
|
* Headers/gnustep/gui/DPSOperators.h: New operators colorimage
|
||||||
and alphaimage.
|
and alphaimage.
|
||||||
* Headers/gnustep/gui/NSGraphicsContext.h: Likewise.
|
* Headers/gnustep/gui/NSGraphicsContext.h: Likewise.
|
||||||
|
|
|
@ -211,6 +211,32 @@
|
||||||
for (i = 0; i < ((_isPlanar) ? numColors : 1); i++)
|
for (i = 0; i < ((_isPlanar) ? numColors : 1); i++)
|
||||||
imagePlanes[i] = planes[i];
|
imagePlanes[i] = planes[i];
|
||||||
}
|
}
|
||||||
|
if (alpha)
|
||||||
|
{
|
||||||
|
unsigned char *bData = (unsigned char*)[self bitmapData];
|
||||||
|
BOOL allOpaque = YES;
|
||||||
|
unsigned offset = numColors - 1;
|
||||||
|
unsigned limit = size.height * size.width;
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
for (i = 0; i < limit; i++)
|
||||||
|
{
|
||||||
|
unsigned a;
|
||||||
|
|
||||||
|
bData += offset;
|
||||||
|
a = *bData++;
|
||||||
|
if (a != 255)
|
||||||
|
{
|
||||||
|
allOpaque = NO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[self setOpaque: allOpaque];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self setOpaque: YES];
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue