mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:30:37 +00:00
Image drawing improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5331 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
906da5937b
commit
eacf057f16
3 changed files with 53 additions and 0 deletions
|
@ -36,6 +36,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
|
||||
#include <AppKit/NSCachedImageRep.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
|
||||
@interface GSCacheW : NSWindow
|
||||
|
@ -104,6 +105,11 @@
|
|||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
[self setSize: _rect.size];
|
||||
[self setAlpha: NO]; /* FIXME - when we have alpha in windows */
|
||||
[self setOpaque: YES];
|
||||
[self setPixelsHigh: _rect.size.height];
|
||||
[self setPixelsWide: _rect.size.width];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -130,6 +136,40 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) drawAtPoint: (NSPoint)aPoint
|
||||
{
|
||||
NSGraphicsContext *ctxt;
|
||||
|
||||
if (size.width == 0 && size.height == 0)
|
||||
return NO;
|
||||
|
||||
NSDebugLLog(@"NSImage", @"Drawing at point %f %f\n", aPoint.x, aPoint.y);
|
||||
ctxt = GSCurrentContext();
|
||||
if (aPoint.x != 0 || aPoint.y != 0)
|
||||
{
|
||||
if ([[ctxt focusView] isFlipped])
|
||||
aPoint.y -= size.height;
|
||||
}
|
||||
NSCopyBits([_window gState], _rect, aPoint);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) drawInRect: (NSRect)aRect
|
||||
{
|
||||
NSGraphicsContext *ctxt;
|
||||
|
||||
NSDebugLLog(@"NSImage", @"Drawing in rect (%f %f %f %f)\n",
|
||||
NSMinX(aRect), NSMinY(aRect), NSWidth(aRect), NSHeight(aRect));
|
||||
if (size.width == 0 && size.height == 0)
|
||||
return NO;
|
||||
|
||||
ctxt = GSCurrentContext();
|
||||
if ([[ctxt focusView] isFlipped])
|
||||
aRect.origin.y -= NSHeight(aRect);
|
||||
NSCopyBits([_window gState], _rect, aRect.origin);
|
||||
return NO;
|
||||
}
|
||||
|
||||
// NSCoding protocol
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue