NSImage lockFocus in DrawRect while printing
NSImage lockFocus in DrawRect while printing
- Subject: NSImage lockFocus in DrawRect while printing
- From: Sergey Mastykash <email@hidden>
- Date: Wed, 15 Dec 2004 11:22:29 +0200
hello.
I need to print into NSImage inside drawRect method of view that is used for printing.
But when I simply try to call [image lockFocus] and [image unlockFocus] happens something strange.
It seems that transformation matrix of current graphic context is broken.
Methods [
NSGraphicsContext <x-tad-bigger>saveGraphicsState</x-tad-bigger>] [
NSGraphicsContext <x-tad-bigger>restoreGraphicsState</x-tad-bigger>] has no effect.
The matrix is broken, and I print images in wrong place.
The interesting fact is that when I'm testing this code in NSView which draws on screen everything works fine!
But if I try to print the same to printer, problem occurs.
This is simple code that demonstrates problem:
- (void)drawRect:(NSRect)rect
{
NSImage* textImage = [[NSImage alloc] initWithSize: NSMakeSize(100, 10)];
[textImage lockFocus];
[textImage unlockFocus];
[textImage release];
/* Performing some drawings, everything is printed in wrong place */
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden