FROM : paul webb
DATE : Tue Dec 21 19:17:28 2004
for offscreen you can use a
NSImage* theImage;
// make an instance with size you need (eg 100x100)
theImage=[[NSImage alloc] initWithSize:NSMakeSize(
100, 100)];
to draw to it...
[theImage lockFocus]; // need to lock focus
// do your drawing
[NSBezierPath fillRect:NSMakeRect(20,20,50,50)]; //
etc etc
[theImage unlockFocus]; // then unlock focus
then paste to view in the views drawRect method
[theImage drawAtPoint:NSMakePoint(0,0) fromRect:rect
operation:NSCompositeSourceOver fraction:1.0];
but as said, if you are redrawing everything from
scratch each time you need to draw it won't be anymore
efficient.
paul
--- Miguel Arroz <<email_removed>> wrote:
> Hi!
>
> On 21 de dez de 2004, at 4:16, Jim Thomason wrote:
>
> > There's no magic to it. Just use an appropriate
> offscreen item and
> > draw into that. an NSView that's not visible, or
> an NSImage, or
> > whatever else would be appropriate to you. You can
> then composite in
> > the whole thing.
>
> I still don't understand... imagine I have a
> class, MyView, that
> subclasses NSView. Where do I draw exactly?
>
> Thanks for the suggestions about the drawing
> rect, I'll look into
> that. I do a lot of text height and width
> calculations, and I will also
> try to cache those results, and only re-calculate
> them if needed.
>
> Yours
>
> Miguel Arroz
>
> "I felt like putting a bullet between
> the eyes of every Panda that wouldn't
> scr*w to save its species." -- Fight
> Club
>
> Miguel Arroz - <email_removed> -
> http://guiamac.com/bagos
>
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
=====
....................................................................................
http://www.fexia.com
http://www.robotsoftware.co.uk
http://www.nicetoanimals.org
.....................................................................................
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
DATE : Tue Dec 21 19:17:28 2004
for offscreen you can use a
NSImage* theImage;
// make an instance with size you need (eg 100x100)
theImage=[[NSImage alloc] initWithSize:NSMakeSize(
100, 100)];
to draw to it...
[theImage lockFocus]; // need to lock focus
// do your drawing
[NSBezierPath fillRect:NSMakeRect(20,20,50,50)]; //
etc etc
[theImage unlockFocus]; // then unlock focus
then paste to view in the views drawRect method
[theImage drawAtPoint:NSMakePoint(0,0) fromRect:rect
operation:NSCompositeSourceOver fraction:1.0];
but as said, if you are redrawing everything from
scratch each time you need to draw it won't be anymore
efficient.
paul
--- Miguel Arroz <<email_removed>> wrote:
> Hi!
>
> On 21 de dez de 2004, at 4:16, Jim Thomason wrote:
>
> > There's no magic to it. Just use an appropriate
> offscreen item and
> > draw into that. an NSView that's not visible, or
> an NSImage, or
> > whatever else would be appropriate to you. You can
> then composite in
> > the whole thing.
>
> I still don't understand... imagine I have a
> class, MyView, that
> subclasses NSView. Where do I draw exactly?
>
> Thanks for the suggestions about the drawing
> rect, I'll look into
> that. I do a lot of text height and width
> calculations, and I will also
> try to cache those results, and only re-calculate
> them if needed.
>
> Yours
>
> Miguel Arroz
>
> "I felt like putting a bullet between
> the eyes of every Panda that wouldn't
> scr*w to save its species." -- Fight
> Club
>
> Miguel Arroz - <email_removed> -
> http://guiamac.com/bagos
>
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
=====
....................................................................................
http://www.fexia.com
http://www.robotsoftware.co.uk
http://www.nicetoanimals.org
.....................................................................................
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
| Related mails | Author | Date |
|---|---|---|
| Miguel Arroz | Dec 21, 16:43 | |
| Jim Thomason | Dec 21, 17:16 | |
| Miguel Arroz | Dec 21, 18:28 | |
| paul webb | Dec 21, 19:17 | |
| Markus Hitter | Dec 21, 19:34 |






Cocoa mail archive

