• 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: Editing Graphics
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing Graphics


  • Subject: Re: Editing Graphics
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Fri, 10 Oct 2003 09:46:06 +0100

On Thursday, October 9, 2003, at 10:53 pm, Geoffrey H Wathen wrote:

Hello everyone,
I'm new to developing in Cocoa, project builder, etc. I have some experience with C programming, but I'm having some issues.
I'm trying to be able to read and change the color of a specified pixel of an image map. I've been unable to locate information on how to do this. Ideally, I have an image file, and I simply specify the x, y coordinate of the pixel I'm after, and I can read and write the color code of the pixel. Can anyone help me with this? Thanks.

It depends exactly what you want to do. You could use NSImage to load the file (using -initWithContentsOfFile:), then -lockFocus on the NSImage, draw using the AppKit or even directly using Core Graphics, then -unlockFocus again. Alternatively, if you want to directly access the image data from your code, you might be better off using NSImageRep to load the image, then using the -bitmapData or -getBitmapDataPlanes: method to obtain pointers to the image planes.

(BTW, to read a pixel from the currently locked view or image, you can use NSReadPixel()).

Take a look at chapters 13 and 14 of Cocoa Programming, if you have it; it gives a pretty thorough explanation of this area of the AppKit.

Kind regards,

Alastair.
_______________________________________________
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.

References: 
 >Editing Graphics (From: Geoffrey H Wathen <email@hidden>)

  • Prev by Date: Re: DO: Setting Protocol before leaving server...
  • Next by Date: Re: launching 2 same applications
  • Previous by thread: Editing Graphics
  • Next by thread: Power Management
  • Index(es):
    • Date
    • Thread