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

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Sep 19 18:16:24 CEST 2012


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


More information about the Bf-committers mailing list