Re: GtkImageView and gtk+-3

Hi Jeff.

Answers inline ...

On Fri, Jan 5, 2018 at 5:04 AM, Jeff <jffry posteo net> wrote:

Hi all,

Some ten years ago various people on this list helped me write Perl
bindings for GtkImageView.

Now I am trying to migrate gscan2pdf to gtk+-3.0. Having enjoyed the
widget for the last ten years, I would like to continue to use it.
Unfortunately, there is no gtk3+-3 version and upstream is dead.

I attempted to compile GtkImageView against gtk+-3.0. This failed,
mostly due to types like GtkDrawable and GtkGC not being in gtk+-3,
which seems to have replaced such things with Cairo.

I see that the GTK people have their own version of GtkImageView in

The code looks completely different to the gtk+-2 code. I haven't tested
it, but it doesn't seem to offer the ability to select regions of the
image, either.

I think it's too early to start porting things to gtk+4 just yet.
Now I am trying to decide how to create the functionality of the widget
in gtk+-3. I see a couple of options:

1. Start with the gtk+-2 code and replace the deprecated types.

I'm no expert with Cairo, and I don't know whether that allows me to
throw away all the caching code that makes GtkImageView efficient.
I guess it depends what kind of operations you're doing. In my powercom utilities ( energy monitoring app - ) I'm able to render a graph with 5 series, with about 2,000 points each, very quickly - in fact fast enough to draw a crosshair-type thing under the mouse, and some vertical & horizontal bars ... these follow the mouse in real-time, and there is no apparent lag on my laptop. My arm server ( Cubox i4 pro - a quad-core 1Ghz arm v7 ) doesn't like it so much - there is noticeable lag. If I wanted to improve things, then I guess I'd pre-render the things that don't change ( ie the graph series ), and then just render the things that do change ( the horizontal & vertical bars ), and composite the 2 when the mouse moves.

2. Start with the gtk+-4.0 code and try to backport it to gtk+-3.0

I don't know how hard this is, and how difficult it is then to implement
stuff like region selection on top

3. Do something basic in Perl. Is region selection even possible in pure

I know enough C to write Perl bindings and be generally dangerous, but I
am no expert, so I have started with #3, but I have no idea how to
implement the region selection functionality.

Any insights would be most welcome.


Jeff Ratcliffe

Regarding selecting a region ...

I've recently added mouse handling to my powercom utilities - specifically so I could select a region of a graph. Check out the code related mouse events at:

This is using a GtkDrawingArea, but I assume you can do the same with pretty much any widget ( you may have to call $widget->add_events() ).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]