mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:51:02 +00:00
* Source/NSImage.m: Implement
-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33571 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
258333d209
commit
fe973031d4
3 changed files with 59 additions and 0 deletions
|
@ -1318,6 +1318,49 @@ Fallback for backends other than Cairo. */
|
|||
}
|
||||
}
|
||||
|
||||
- (void) drawInRect: (NSRect)dstRect
|
||||
fromRect: (NSRect)srcRect
|
||||
operation: (NSCompositingOperation)op
|
||||
fraction: (float)delta
|
||||
respectFlipped: (BOOL)respectFlipped
|
||||
hints: (NSDictionary*)hints
|
||||
{
|
||||
NSAffineTransform *backup = nil;
|
||||
NSGraphicsContext *ctx = GSCurrentContext();
|
||||
BOOL compensateForFlip = (respectFlipped && [ctx isFlipped]);
|
||||
|
||||
// FIXME: Hints are currently ignored
|
||||
|
||||
if (compensateForFlip)
|
||||
{
|
||||
CGFloat height;
|
||||
NSAffineTransform *newXform;
|
||||
|
||||
height = dstRect.size.height != 0 ?
|
||||
dstRect.size.height : [self size].height;
|
||||
|
||||
backup = [ctx GSCurrentCTM];
|
||||
|
||||
newXform = [backup copy];
|
||||
[newXform translateXBy: dstRect.origin.x yBy: dstRect.origin.y + height];
|
||||
[newXform scaleXBy: 1 yBy: -1];
|
||||
[ctx GSSetCTM: newXform];
|
||||
[newXform release];
|
||||
|
||||
dstRect.origin = NSMakePoint(0, 0);
|
||||
}
|
||||
|
||||
[self drawInRect: dstRect
|
||||
fromRect: srcRect
|
||||
operation: op
|
||||
fraction: delta];
|
||||
|
||||
if (compensateForFlip)
|
||||
{
|
||||
[ctx GSSetCTM: backup];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) addRepresentation: (NSImageRep *)imageRep
|
||||
{
|
||||
GSRepData *repd;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue