Comments (8)
I'd recommend to keep library interfaces (like Gtk, cairo etc.) 'clean'.
Your code works on top of a library and is a first step into a new toolkit, so thinking about putting it into a package of its own might make some sense.
btw: Is there no support for rubberband selection in Gtk?
from gtk.jl.
Realistically, the cairo.jl
file is the only part that isn't just a simple ('clean') interface to the Gtk library. I would also like to expose the draw
event for user code, which should greatly simplify the implementation of rubberbanding code -- and perhaps make it reasonable to include in base Gtk (providing additional Gtk-dependent packages is also reasonable, esp. as the internal API here starts to stabilize).
from gtk.jl.
btw: Is there no support for rubberband selection in Gtk?
I can't find one. I even found a similar python file.
from gtk.jl.
Now that Gtk has matured considerably, what are the thoughts about this? I now see at least two areas, rubberbanding and hit-testing for objects on a Canvas, that would likely be of common interest. Here, or in an extensions package?
from gtk.jl.
I still believe in modularization -> a lightweight (small, only interface to gtk+ and cairo) package.
Something like hit-testing of objects and arranging objects onto a canvas seems to sail under the name of scene graph. In the gnome world clutter is to be used for that, but some development of a GTK scene graph toolkit started:
http://www.bassi.io/articles/2014/07/29/guadec-2014-gsk/
Also i'm still wondering, why the click-and-hit internals of gtk are not accessible, are they?
from gtk.jl.
There's no rubberband built into Gtk that I can find, but feel free to do your own search. You will quickly find several examples of people implementing this themselves.
Cairo has some built-in facility for hit-testing (see the second code-listing in http://cairographics.org/hittestpython/). It's not yet clear to me if Cairo offers all the facilities we'd need; for example what about closest point in a scatter plot? But my plan would be to look into exploiting it. No matter how you do this, it's a little tricky because you have to plan ahead for this when you first create the path.
from gtk.jl.
I was not clear enough:
Both hit-testing and rubberband doesn't exist in plain Gtk (and Gtk+). Cairo has some means to test pixel coordinates against the current path, but only the current path. Gtk should have some internals to do something like hit-testing for non rectangular widgets but there is no access. X11 (!) has support for non rectangular windows and could be used for that.
For my display/visualize project on pygtk, pycairo i use a dedicated click map (pixelmap) that is filled with an ID for the respective object that is drawn on screen. So, i paint a flower to the screen with cairo and an ID of 75 to the click-map in the background, also with cairo but something special on setting the color and you have to turn off antialiasing to have clear pixels etc... If i get a event.onpress with button=1 i use the event coordinates and look up in my click map what ID is there. Apart from the effort for drawing everything twice and the memory for the click map, this is efficient and fast.
As an alternative i was looking at a BSP-tree for having fast tests on coordinates, but that was beyond my reach to iteratively update the tree if you paint new things additionally on screen, OR if you change the zoom (pan is not an issue here).
I think the cleanest solution would be an internal geometric representation that can be searched for inside-near-outside tests.
However, on a click map you could (if you hit ID=empty) search the surrounding for the next non-empty ID...
But back to your original question; about putting it into Gtk.jl or having something external?
I'm still in favour of having library interfaces like Gtk.jl 'clean' so only having the interfacing code and additional functionality in a package on top.
from gtk.jl.
I'm fine with putting this in a CanvasExtras.jl package.
from gtk.jl.
Related Issues (20)
- Julia Crash on GTK combo HOT 2
- Connecting event to calendar HOT 4
- CssProviderLeaf performance HOT 2
- Where is gdk library HOT 1
- Julia aborts from a Scale on mac HOT 8
- When CSS on screen has effect?
- In Ubuntu open_dialog() does not close after completing its action
- Crash on load with version 1.2.3 or 1.3.0 on Windows HOT 3
- Error in running finalizer
- issues with headless machine precompile HOT 1
- ComboBoxText no longer working under Julia 1.8.5 HOT 3
- Segfault with showall on trivial glade file on M1 Mac
- Is there a Julia binding to the GtkLayout container?
- circular dependency with libtiff_jll 4.5 HOT 1
- Apple silicon M2 Gtkscale error
- GtkSpinButton MethodError
- race conditions in finalizers HOT 1
- sigatomic_end called in non-sigatomic region HOT 1
- Gtk not working on MacOS Sonoma 14.4 or 14.4.1 HOT 1
- Canβt get to Glade
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gtk.jl.