[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSGraphicsContext graphicsContextWithBitmapImageRep:
From: |
Stefan Urbanek |
Subject: |
NSGraphicsContext graphicsContextWithBitmapImageRep: |
Date: |
Mon, 20 Feb 2006 14:20:32 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.2.2 |
Hi,
I am still trying to draw into a bitmap without using a NSView. I was inspired
by:
http://www.cocoabuilder.com/archive/message/cocoa/2002/7/3/51400
... and I have tried this:
rep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: nil
pixelsWide: size.width pixelsHigh: size.height
bitsPerSample: 8 samplesPerPixel: 3
hasAlpha: NO isPlanar: NO
colorSpaceName: NSCalibratedRGBColorSpace
bytesPerRow: 0 bitsPerPixel: 24];
then:
dict = [NSMutableDictionary dictionary];
[dict setObject:rep
forKey:NSGraphicsContextDestinationAttributeName];
context = [NSGraphicsContext graphicsContextWithAttributes: dict];
and draw using:
[NSGraphicsContext setCurrentContext:context];
[[NSColor blueColor] set];
[NSBezierPath fillRect:NSMakeRect(10,10,80,80)];
[context flushGraphics];
No result. Only this time the TIFF image was valid and viewable under windows -
it is a black square.
And [NSGraphicsContext graphicsContextWithBitmapImageRep:] seems not to be
present in GNUstep...
Is there a way in GNUstep how to draw into the NSBitmapImageRep using standard
drawing methods without using views and windows? If not, is there any plan for
having them implemented?
Thanks,
Stefan
--
http://stefan.agentfarms.net
First they ignore you, then they laugh at you, then they fight you, then
you win.
- Mahatma Gandhi
- NSGraphicsContext graphicsContextWithBitmapImageRep:,
Stefan Urbanek <=