• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: BitMap data format and autorelease
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BitMap data format and autorelease


  • Subject: Re: BitMap data format and autorelease
  • From: Trygve Inda <email@hidden>
  • Date: Wed, 12 Mar 2008 21:22:51 +0000
  • Thread-topic: BitMap data format and autorelease

Jens said:

> As I said, call -lockFocus on the imagerep. Then issue drawing
> commands (just as though you were in a view's -drawRect: method). Then
> calll -unlockFocus.

NSImageRep does not seem to allow lockFocus

With Adam's method... Is there any reason I might want an NSImage?

> [NSGraphicsContext saveGraphicsState];
> [NSGraphicsContext setCurrentContext:[NSGraphicsContext
> graphicsContextWithBitmapImageRep:imageRep]];
>
> // draw here
>
> [NSGraphicsContext restoreGraphicsState];
>
> which avoids creating an NSImage.

Also note that this is all happening in a background thread, though I
realize drawing may well need to be dispatched to the main thread.

This seems to suggest it is a good approach:

http://www.cocoabuilder.com/archive/message/cocoa/2007/11/15/193191

Thanks,

Trygve


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: BitMap data format and autorelease
      • From: Jens Alfke <email@hidden>
References: 
 >Re: BitMap data format and autorelease (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: memory warnings
  • Next by Date: Re: runtime error
  • Previous by thread: Re: BitMap data format and autorelease
  • Next by thread: Re: BitMap data format and autorelease
  • Index(es):
    • Date
    • Thread