• 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: Swapping NSBitmapImageRep bitmapData's
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swapping NSBitmapImageRep bitmapData's


  • Subject: Re: Swapping NSBitmapImageRep bitmapData's
  • From: "Dennis C. De Mars" <email@hidden>
  • Date: Mon, 11 Jun 2001 17:23:16 -0000

Ken Tabb <email@hidden> said:

> Hi,
> is there any way to swap the bitmapData array in an NSBitmapImageRep? I
> have some image processing code in which I would like to swap the array
> being pointed to by the NSBitmapImageRep. The 2 arrays are of the same
> length / pixel order / depth etc., just showing a different picture.
>
> Is this possible... the API docs only seem to suggest ways of getting an
> NSBitmapImageRep's bitmapData, rather than setting it.
>
> ... Or am I missing the fact that doing so would screw any NSImages which
> had formed from the NSBitmapImageRep? What would be the best way to
> 'rebuild' an NSImage from the (newly swapped) NSBitmapImageRep's
> bitmapData, rather than having to re-allocate memory etc.?

Well, one of the initialization routines, initWithBitmapDataPlanes, allows you to
specify a pointer to the buffer containing your bitmap. However, I don't think you can
change the buffer pointer once you've created the NSBitmapImageRep.

However, what you can do is create two NSBitmapImageRep objects, each one with a
pointer to one of your buffers. Then you can just switch the representation used by the
NSImage displaying your bitmap using -addRepresentation: and -removeRepresentation: .
This should achieve the same effect.

- Dennis D.


  • Prev by Date: Re: Copy and Paste of rows in a NSTableView
  • Next by Date: Re: Cocoa Calling Carbon Question
  • Previous by thread: Re: Swapping NSBitmapImageRep bitmapData's
  • Next by thread: Setting File Permissions for Classic apps
  • Index(es):
    • Date
    • Thread