obtain a Windows DIB handle to a GIMP selection

View: New views
3 Messages — Rating Filter:   Alert me  

obtain a Windows DIB handle to a GIMP selection

by Lucian Sabo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I want to create a plugin for Windows only that makes use of a windows DLL.
The function from the DLL I need to call requires a DIB Handle as parameter and the original file name.
I did not found any method to get active selection as Windows DIB HANDLE.

If not familiar with Windows DIBs, here is a link
http://www.herdsoft.com/ti/davincie/imex3j8i.htm

Do you have a sample source code in C for this ? I assume there is a way to get a pointer to the RGBA pixel data with all layers combined.

Thank you
Lucian

_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: obtain a Windows DIB handle to a GIMP selection

by Martin Nordholts-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 10/06/2009 10:55 AM, Lucian Sabo wrote:
> Hello all,
>
> I want to create a plugin for Windows only that makes use of a windows DLL.
> The function from the DLL I need to call requires a DIB Handle as parameter and the original file name.
> I did not found any method to get active selection as Windows DIB HANDLE.

Hi,

Should work to get the active selection using gimp_image_get_selection() [1]
and then create a DIB from that using pixel data fetched with e.g.
GimpPixelRgn [2]

 / Martin

[1] http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpimage.html#gimp-image-get-selection
[2] http://developer.gimp.org/api/2.0/libgimp/libgimp-gimppixelrgn.html

--

My GIMP Blog:
http://www.chromecode.com/

_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Re: obtain a Windows DIB handle to a GIMP selection

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-10-06 at 11:55 +0300, Lucian Sabo wrote:
> Do you have a sample source code in C for this ? I assume there is a
> way to get a pointer to the RGBA pixel data with all layers combined.

If you need the data from all layers combined, then you can use
gimp_layer_new_from_visible () to create a temporary layer that your
plug-in can then read the pixel data from.

How to access pixel data from a plug-in is explained in
http://developer.gimp.org/writing-a-plug-in/2/


Sven


_______________________________________________
Gimp-developer mailing list
Gimp-developer@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer