• 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: Getting iPod icon, was Getting the network Machine Icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting iPod icon, was Getting the network Machine Icon


  • Subject: Re: Getting iPod icon, was Getting the network Machine Icon
  • From: Dave <email@hidden>
  • Date: Fri, 23 Jan 2009 18:53:02 +0000

Hi Jean,

Thank you so much for your help. I've almost got the code in place now. But please see below.

On 23 Jan 2009, at 17:33, Jean-Daniel Dupas wrote:





Also at this point, I'd like to get a pointer to the Pixel buffer in the CGContext and return this. The code I already have will write the JPEG file, all I need is a copy of the Pixel Data? Is there a way to do this?

myImageBufferPtr is the pixel buffer.

To create the image, you can also use an NSImage,

NSImage *img = [[NSImage alloc] initWithSize:NSMakeSize (myImageWidth, myImageHeight)];
[img lockFocus]
CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicPort];


// draw

[img unlockFocus]

And now, use NSImage function to save it as a JPEG. It's easier than dealing with all the bitmap stuff.

An other way may be to use CGBitmapContextCreateImage() to create a CGImageRef from your context, and then use ImageIO (CGImageDestinationRef) to export your image.

The requirement of the function I am writing has now changed because I found a different way of doing it that requires much less changes to the rest of the application. Basically there is a framework of sorts that calls my function (GetIconImage), all I have to do is to render the Icon into a BitMap/PixMap and then return a pointer to it from my function, e.g. the function that calls my function need to return a buffer that is width * height * 4 in size that contains the pixels and everything else will be taken care of!


So, I if change the bit that computes the Row Bytes value so it is (width * 4) and change the malloc to malloc(width * height * 4) then just return myImageBufferPtr, this should be ok?

Also, how to I free the memory allocated by myBitMapContextRef, myIconRef and myIconFamily Icon? I can't seem to find dispose/release functions for these objects.

Thanks again, you have been a great help!

All the Best
Dave


_______________________________________________

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: Getting iPod icon, was Getting the network Machine Icon
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >Getting the network Machine Icon (From: Sandro Noel <email@hidden>)
 >Getting iPod icon, was Getting the network Machine Icon (From: Dave <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Russell Hancox <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: "email@hidden" <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Dave <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Dave <email@hidden>)
 >Re: Getting iPod icon, was Getting the network Machine Icon (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Start traces with CrashReporter
  • Next by Date: Re: Log4Cocoa
  • Previous by thread: Re: Getting iPod icon, was Getting the network Machine Icon
  • Next by thread: Re: Getting iPod icon, was Getting the network Machine Icon
  • Index(es):
    • Date
    • Thread