[Bf-committers] Accessing UV/Image Editor Image Data

patrick boelens p_boelens at msn.com
Wed Sep 19 19:19:45 CEST 2012


Hey Brecht,

Thanks for your reply. I did exactly as you said already; the infrastructure's all in place in that regard. I'm just not sure how to fill the NSData correctly so that other applications such as Gimp or Pixelmator would recognize it. I probably worded my question a bit clumsy, sorry about that. Basically I'm looking for an alternative to [NSData dataWithContentsOfFile:] so I can skip the weird "write to file, read from file" steps. I'll take a look at IMAGE_OT_invert regardless though, as well as scouring the Apple Reference Guide some more; maybe it'll push me in the right direction.

Thanks,
Patrick

> From: brechtvanlommel at pandora.be
> Date: Wed, 19 Sep 2012 18:16:24 +0200
> To: bf-committers at blender.org
> Subject: Re: [Bf-committers] Accessing UV/Image Editor Image Data
> 
> Hi,
> 
> I'd look at the text editor implementation of copy/paste and make it
> work similar. That is, make copy/paste operators in the image editor,
> have those call a new WM_clipboard_image_get/set function (like
> existing WM_clipboard_text_get/set), which will then call GHOST.
> 
> Probably you'd pass the pixels and width/height. For how to access the
> pixels in an image, you could look at the IMAGE_OT_invert operator in
> the image editor.
> 
> Brecht.
> 
> On Wed, Sep 19, 2012 at 5:04 PM, patrick boelens <p_boelens at msn.com> wrote:
> >
> > Hey all,
> >
> > I've recently been working on something that required me to do a lot of side-by-side comparisons of render results with existing images. Getting frustrated with having to save the result, open it in Pixelmator, making adjustments and repeating, I figured I'd code in a quick "copy to clipboard" operator.
> > I extended the putClipboard() function and everything is in place except for one little thing, accessing the active image data in a "pasteboard-ready" format.
> > I'm on OSX, so I'm working on the GHOST_SystemCocoa implementation. What I need is to get the image data ready to be put in an NSData object. A workaround would be to save the image to /tmp and then use
> >
> >
> > dataToCopy = [NSData dataWithContentsOfFile:@"/tmp/untitled.png"];
> > but I'm wondering if there's a more immediate way of going about this? Any help would be greatly appreciated. =)
> >
> > Thanks,
> > Patrick
> >
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
 		 	   		  


More information about the Bf-committers mailing list