• 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: "Adam R. Maxwell" <email@hidden>
  • Date: Wed, 12 Mar 2008 13:58:12 -0700

On Wednesday, March 12, 2008, at 01:26PM, "Trygve Inda" <email@hidden> wrote:
>>
>Is there a benefit to calling:
>
>image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
>[image addRepresentation:imageRep];
>
>Then using:
>
>[image lockFocusOnRepresentation:imageRep];
>
>[image unlockFocus];
>
>This would give me an NSImage which uses my bitmap. Any pros/cons here?

I'd use something like this (typed in Mail):

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep]];

// draw here

[NSGraphicsContext restoreGraphicsState];

which avoids creating an NSImage.

--
adam
_______________________________________________

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: Trygve Inda <email@hidden>
References: 
 >Re: BitMap data format and autorelease (From: Trygve Inda <email@hidden>)

  • Prev by Date: NSTimer and seg faults
  • Next by Date: Re: NSTimer and seg faults
  • Previous by thread: Re: BitMap data format and autorelease
  • Next by thread: Re: BitMap data format and autorelease
  • Index(es):
    • Date
    • Thread