Skip navigation.
 
mlRe: NSImage lockFocus in DrawRect while printing
FROM : John C. Randolph
DATE : Wed Dec 15 20:42:02 2004

Sergey, What version of Mac OS X are you using? I seem to remember a
bug like this on Jaguar, but I thought we had it fixed by now.

-jcr


On Dec 15, 2004, at 1:22 AM, Sergey Mastykash wrote:


> 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 saveGraphicsState] [NSGraphicsContext
> restoreGraphicsState] 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_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

John C. Randolph <<email_removed>> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html

Related mailsAuthorDate
mlNSImage lockFocus in DrawRect while printing Sergey Mastykash Dec 15, 10:22
mlRe: NSImage lockFocus in DrawRect while printing John C. Randolph Dec 15, 20:42
mlRe: NSImage lockFocus in DrawRect while printing Sergey Mastykash Dec 16, 09:56