• 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: Advice on offscreen drawing.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on offscreen drawing.


  • Subject: Re: Advice on offscreen drawing.
  • From: Oscar Morales Vivó <email@hidden>
  • Date: Thu, 14 Mar 2002 12:37:13 +0100

On Thursday, March 14, 2002, at 02:47 AM, Erik M. Buck wrote:

Draw directly into a suitably configured bitmap image rep
See NSImageRep and -lockFocus
You can also just allocate a buffer for your image. Draw into the buffer
using standard pointer math to set pixel data. Then initialize an image rep
from your data.


Hmmm... the raw pixel matrix idea attracts me, as it's not particularly complex and is directly multiplatform code, just needing to create a function for each platform to pass the pixel matrix to whatever the platform uses. However, looking the documentation hasn't been too helpful. I assume I should create a NSImage containing a NSBitmapImageRep with an NSData object created from my pixel matrix, and set the pixel width and height to be those of the view I'm drawing.

Unfortunately, as I've already said, apple's documentation is quite scarce when it comes to initializing an NSImage with raw data, and although I have a few ideas of how it could be done, I'm not really sure.

So, if someone could post a snippet of code completing the following declaration (which I assume isn't that hard) I'd be eternally grateful.

- (NSImage*)imageFromPixmap:(UInt32*)pixmapData width:(int)pixmapWidth height:(int)pixmapHeight
{
}


Thanks a lot in advance!

Oscar Morales.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Advice on offscreen drawing.
      • From: Dennis De Mars <email@hidden>
References: 
 >Re: Advice on offscreen drawing. (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: Undo grouping question
  • Next by Date: Image capture from USB digital cameras?
  • Previous by thread: Re: Advice on offscreen drawing.
  • Next by thread: Re: Advice on offscreen drawing.
  • Index(es):
    • Date
    • Thread