Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

GtkOffscreenWindow? #33

Closed
mdimec4 opened this issue Jan 10, 2014 · 14 comments
Closed

GtkOffscreenWindow? #33

mdimec4 opened this issue Jan 10, 2014 · 14 comments

Comments

@mdimec4
Copy link

mdimec4 commented Jan 10, 2014

Hello

This is a great gtk port, but I am currently missing one thing in it.
I am talking about GtkOffscreenWindow implementation.
Functions to create offscreen window and functions ti access window image.
I am asking if there is any plan to implement this in the near future?
Or if I can tray to implement it to be then merged with master branch?
Best

Miha

@mdimec4
Copy link
Author

mdimec4 commented Jan 10, 2014

Gtk Documentation about feature.
https://developer.gnome.org/gtk3/stable/GtkOffscreenWindow.html

@jrick
Copy link
Member

jrick commented Jan 10, 2014

The GtkOffscreenWindow bindings themselves are simple to add, but we have neither GdkPixbuf nor any cairo bindings which would be necessary to get a snapshot of the offscreen window. Which were you planning to use?

@jrick
Copy link
Member

jrick commented Jan 10, 2014

There is a GtkPixbuf implementation in a pull request (#12), so I think first attempting to merge some or all of that in is the first step here.

@mdimec4
Copy link
Author

mdimec4 commented Jan 10, 2014

OK tnx
I assume implementing cairo would also be easy because bindings for cairo already exist.
https://github.com/ungerik/go-cairo

I assume there are still some issues with GdkPixbuf implementation if it is not merget to the master.

@jrick
Copy link
Member

jrick commented Jan 10, 2014

FYI, those cario bindings you mentioned are dual licensed as LGPL/MPL so I won't depend on them from gotk3 code since we would be statically linking against them.

@jrick
Copy link
Member

jrick commented Jan 10, 2014

Actually I might consider it, MPL should allow static linking.

@weberc2
Copy link
Contributor

weberc2 commented Jan 10, 2014

If the license becomes an issue, it's probably worth contacting the author and asking if he would mind changing the license. Just throwing it out there. Keep up the good work. :)

@jrick
Copy link
Member

jrick commented Jan 12, 2014

@mdimec4, I saw you started on this using those cairo bindings. I just threw together some GdkPixbuf bindings as well which OffscreenWindow will definitely use when added to gotk3. Would you mind testing them out and see if they work for this? Patch is here: http://sprunge.us/HKMH

edit: maybe I'm going crazy. thought I saw you had worked on them and now I can't find it.

edit 2: Here's a better version: http://sprunge.us/jHEj I changed the GetPixels function to create and return a go byte slice rather than a uintptr that you must manually add offsets for and use getters/setters to dereference the pointer. No more offsets past the valid portion of the data! (and if you try, you'll hit a Go panic rather than undefined behavior)

@mdimec4
Copy link
Author

mdimec4 commented Jan 12, 2014

Ok
Thank you relay. I will try them tomorrow. My bad I haven’t checked the licence. May be it is better if we just stick with Pixbuff.
Actualy I am new to gtk programming so any suggestion is helpful.

Here is my brunch which is a brunch of a little outdated branch of your work that is bundled with go-webkit2.
https://github.com/visionect/gotk3

@mdimec4
Copy link
Author

mdimec4 commented Jan 14, 2014

Ok I have tested it. It works. :)
I have also added very basic Cairo functionality (no external bindings) and of course GtkOfscreenWindow bindings.
Here is the patch:
http://pastebin.com/DjeDcHLP

I hope there will not be to much problems made by me working in different branch. Import paths are defenetly different.

@jrick
Copy link
Member

jrick commented Jan 15, 2014

Thanks for the patch. I'll review it when I get a chance.

@mdimec4
Copy link
Author

mdimec4 commented Jan 15, 2014

Ok
I am happy to contribute to this great library.
Best
Miha

2014/1/15 Josh Rickmar [email protected]

Thanks for the patch. I'll review it when I get a chance.


Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-32362800
.

@jrick
Copy link
Member

jrick commented Jan 18, 2014

Taking a look at this now. I'm unfamilar with the cairo library, so I've been looking through the documentation and have some thoughts about how you implemented this:

First, I think the cairo stuff should be its own package (like glib, gdk, and gtk are) so GTK code dealing with cairo surfaces would be using a *cairo.Surface. It also seems that the cairo context should be implemented as its own type rather than adding it as a member of the Surface struct.

I've committed the GdkPixbuf code to master, btw.

jrick added a commit that referenced this issue Jan 19, 2014
This change adds a new gotk3 package for Cairo bindings.  Currently,
there exists support for Surface (cairo_surface_t) and Context
(cairo_t).

Symbols used have been limited to Cairo 1.10 and not the latest 1.12
because I don't feel like adding yet another build tag to complicate
the build process.

This is a step towards completing #33.
@jrick jrick closed this as completed in 09f2a34 Jan 19, 2014
@mdimec4
Copy link
Author

mdimec4 commented Jan 21, 2014

Ok nice work.
Thank you I will dig into when I will have some time.
Thank you
Best

andre-hub added a commit to andre-hub/gotk3 that referenced this issue Feb 13, 2016
Add lots of window functions, and move all window functions into its …
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants