mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:20:47 +00:00
Do all bitmap image drawing via GSDrawImage:: to allow better
implementations in backends. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25600 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2d16c15930
commit
b7699665db
5 changed files with 64 additions and 40 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2007-11-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSGraphics.h: Make NSDrawBitmap a real function.
|
||||||
|
* Source/Functions.m (NSDrawBitmap): Implement via
|
||||||
|
NSBitmapImageRep and GSDrawImage::.
|
||||||
|
* Source/NSGraphicsContext.m (-GSDrawImage::): Implement via
|
||||||
|
NSDrawBitmap::::::. To be subclassed in backends.
|
||||||
|
* Source/NSBitmapImageRep.m (-draw): Use GSDrawImage:: for drawing.
|
||||||
|
|
||||||
2007-11-11 Fred Kiefer <FredKiefer@gmx.de>
|
2007-11-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSCell.m (-initWithCoder:): Correct keyed decoding of
|
* Source/NSCell.m (-initWithCoder:): Correct keyed decoding of
|
||||||
|
|
|
@ -165,33 +165,17 @@ APPKIT_EXPORT void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect,
|
||||||
APPKIT_EXPORT void NSCopyBits(int srcGstate, NSRect srcRect,
|
APPKIT_EXPORT void NSCopyBits(int srcGstate, NSRect srcRect,
|
||||||
NSPoint destPoint);
|
NSPoint destPoint);
|
||||||
|
|
||||||
static inline void
|
APPKIT_EXPORT void NSDrawBitmap(NSRect rect,
|
||||||
NSDrawBitmap(NSRect rect,
|
int pixelsWide,
|
||||||
int pixelsWide,
|
int pixelsHigh,
|
||||||
int pixelsHigh,
|
int bitsPerSample,
|
||||||
int bitsPerSample,
|
int samplesPerPixel,
|
||||||
int samplesPerPixel,
|
int bitsPerPixel,
|
||||||
int bitsPerPixel,
|
int bytesPerRow,
|
||||||
int bytesPerRow,
|
BOOL isPlanar,
|
||||||
BOOL isPlanar,
|
BOOL hasAlpha,
|
||||||
BOOL hasAlpha,
|
NSString *colorSpaceName,
|
||||||
NSString *colorSpaceName,
|
const unsigned char *const data[5]);
|
||||||
const unsigned char *const data[5])
|
|
||||||
{
|
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
(ctxt->methods->NSDrawBitmap___________)
|
|
||||||
(ctxt, @selector(NSDrawBitmap: : : : : : : : : : :), rect,
|
|
||||||
pixelsWide,
|
|
||||||
pixelsHigh,
|
|
||||||
bitsPerSample,
|
|
||||||
samplesPerPixel,
|
|
||||||
bitsPerPixel,
|
|
||||||
bytesPerRow,
|
|
||||||
isPlanar,
|
|
||||||
hasAlpha,
|
|
||||||
colorSpaceName,
|
|
||||||
data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
NSBeep(void)
|
NSBeep(void)
|
||||||
|
|
|
@ -297,6 +297,37 @@ void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
|
||||||
NSCompositeCopy);
|
NSCompositeCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NSDrawBitmap(NSRect rect,
|
||||||
|
int pixelsWide,
|
||||||
|
int pixelsHigh,
|
||||||
|
int bitsPerSample,
|
||||||
|
int samplesPerPixel,
|
||||||
|
int bitsPerPixel,
|
||||||
|
int bytesPerRow,
|
||||||
|
BOOL isPlanar,
|
||||||
|
BOOL hasAlpha,
|
||||||
|
NSString *colorSpaceName,
|
||||||
|
const unsigned char *const data[5])
|
||||||
|
{
|
||||||
|
NSBitmapImageRep *bitmap;
|
||||||
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
|
bitmap = [[NSBitmapImageRep alloc]
|
||||||
|
initWithBitmapDataPlanes: data
|
||||||
|
pixelsWide: pixelsWide
|
||||||
|
pixelsHigh: pixelsHigh
|
||||||
|
bitsPerSample: bitsPerSample
|
||||||
|
samplesPerPixel: samplesPerPixel
|
||||||
|
hasAlpha: hasAlpha
|
||||||
|
isPlanar: isPlanar
|
||||||
|
colorSpaceName: colorSpaceName
|
||||||
|
bytesPerRow: bytesPerRow
|
||||||
|
bitsPerPixel: bitsPerPixel];
|
||||||
|
|
||||||
|
[ctxt GSDrawImage: rect : bitmap];
|
||||||
|
RELEASE(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rectangle Drawing
|
* Rectangle Drawing
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1071,18 +1071,9 @@
|
||||||
- (BOOL) draw
|
- (BOOL) draw
|
||||||
{
|
{
|
||||||
NSRect irect = NSMakeRect(0, 0, _size.width, _size.height);
|
NSRect irect = NSMakeRect(0, 0, _size.width, _size.height);
|
||||||
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
|
||||||
NSDrawBitmap(irect,
|
[ctxt GSDrawImage: irect : self];
|
||||||
_pixelsWide,
|
|
||||||
_pixelsHigh,
|
|
||||||
_bitsPerSample,
|
|
||||||
_numColors,
|
|
||||||
_bitsPerPixel,
|
|
||||||
_bytesPerRow,
|
|
||||||
_isPlanar,
|
|
||||||
_hasAlpha,
|
|
||||||
_colorSpace,
|
|
||||||
(const unsigned char **)_imagePlanes);
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1463,9 +1463,18 @@ NSGraphicsContext *GSCurrentContext(void)
|
||||||
/** Generic method to draw an image into a rect. The image is defined
|
/** Generic method to draw an image into a rect. The image is defined
|
||||||
by imageref, an opaque structure. Support for this method hasn't
|
by imageref, an opaque structure. Support for this method hasn't
|
||||||
been implemented yet, so it should not be used anywhere. */
|
been implemented yet, so it should not be used anywhere. */
|
||||||
- (void) GSDrawImage: (NSRect) rect: (void *) imageref
|
- (void) GSDrawImage: (NSRect)rect: (void *)imageref
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
NSBitmapImageRep *bitmap;
|
||||||
|
const unsigned char *data[5];
|
||||||
|
|
||||||
|
bitmap = (NSBitmapImageRep*)imageref;
|
||||||
|
[bitmap getBitmapDataPlanes: &data];
|
||||||
|
[self NSDrawBitmap: rect : [bitmap pixelsWide] : [bitmap pixelsHigh]
|
||||||
|
: [bitmap bitsPerSample] : [bitmap samplesPerPixel]
|
||||||
|
: [bitmap bitsPerPixel] : [bitmap bytesPerRow] : [bitmap isPlanar]
|
||||||
|
: [bitmap hasAlpha] : [bitmap colorSpaceName]
|
||||||
|
: data];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue