[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [gef-dev] Is there a generic Surface/Canvas/... to 'draw' geometric objects to?
|
Thanks for the insight skia looks really cool!
I know its hard to have full support (especially for crippled ones like
SWT GC) but the goal would be to reuse at least as much as possible to
support e.g not only rendering to screen but direct rendering to PDF or
SVG as well!
And for example with charts or graphs there is not so much special that
can't be emulated if not available native (GEF e.g. uses AWT Transform
in the background) and that's okay as long as the drawing code does not
needs to mind and just could spill out some basic primitives like path,
rectangles and so on.
If I understand right, no such thing actually exits atm in GEF?
Am 05.01.21 um 17:08 schrieb Tom Schindl:
Hi,
The basic problem with direct drawing context is that if you want to
come up with a common API is that the feature-set of those is so
different that finding a common denominator is very hard (beside the
basics like stroking a shape and filling it with a solid color)
Some examples:
* SWT lacks fill options like gradients, ...
* JavaFX lacks font-metrics, blend-modes (beside the very basic ones)
* Swing/AWT is full blown I have no complains there ;-)
I would go another route and use Skia for rendering and integrating that
into all platforms. A month ago I sent a tweet with Skia integrating
into JavaFX [1] and just a few minutes ago SWT [2] (all this stuff is
hacked together in a few hours so far from production ready).
This is really really powerful and the JavaFX tweet shows the difference
rendering stuff on the GPU (in JavaFX we use texture sharing) and CPU
(where we use rendering to an off-heap buffer)
Tom
[1]https://twitter.com/tomsontom/status/1331923314768482305
[2]https://twitter.com/tomsontom/status/1346487668746686472
Am 05.01.21 um 16:27 schrieb Alexander Nyßen:
Well, Graphics2D is bound to an UI framework, as far as I understand…
The corresponding piece within the SWT universe is the GC. Using
IGeometry.toPath(), you can translate all GEF geometries into a path
abstraction, which can be converted to an SWT path using Geometry2SWT.
You could then use GC.drawPath() or GC.fillPath() to render the
geometries on SWT as you could use respective operations from
Graphics2D in the AWT universe. The following example should give you
a start:
https://github.com/eclipse/gef/blob/master/org.eclipse.gef.geometry.examples/src/org/eclipse/gef/geometry/examples/demos/CAGExample.java
<https://github.com/eclipse/gef/blob/master/org.eclipse.gef.geometry.examples/src/org/eclipse/gef/geometry/examples/demos/CAGExample.java>.
Am 05.01.2021 um 15:54 schrieb Christoph Läubrich
<laeubi@xxxxxxxxxxxxxx <mailto:laeubi@xxxxxxxxxxxxxx>>:
Thanks for the hint, but I'm more searching to a piece that allows me
to "draw to it", similar to a Graphics2D where I can draw/fill shapes
and that is not bound to any UI-Framework. I won't even expect any
interactive support from it just basic drawing operations in a
framework-independent manner.
Is there something similar in GEF? I could for sure create one but I
just don't want to reinvent the wheel :-)
My goal is to have some kind of abstraction between the drawing-code
and the actual "output-device" so the org.eclipse.gef.geometry seems
a good starting point.
Am 05.01.21 um 15:39 schrieb Alexander Nyßen:
GeometryNode
(https://github.com/eclipse/gef/blob/master/org.eclipse.gef.fx/src/org/eclipse/gef/fx/nodes/GeometryNode.java
<https://github.com/eclipse/gef/blob/master/org.eclipse.gef.fx/src/org/eclipse/gef/fx/nodes/GeometryNode.java>
<https://github.com/eclipse/gef/blob/master/org.eclipse.gef.fx/src/org/eclipse/gef/fx/nodes/GeometryNode.java
<https://github.com/eclipse/gef/blob/master/org.eclipse.gef.fx/src/org/eclipse/gef/fx/nodes/GeometryNode.java>>)
is what you are looking for. You can use it to render the geometries
via JavaFX (and through FXCanvas also on SWT).
Am 05.01.2021 um 15:36 schrieb Christoph Läubrich
<laeubi@xxxxxxxxxxxxxx <mailto:laeubi@xxxxxxxxxxxxxx>
<mailto:laeubi@xxxxxxxxxxxxxx <mailto:laeubi@xxxxxxxxxxxxxx>>>:
I like to create a control that shows some geometric opbjects (from
the org.eclipse.gef.geometry package).
Is there a generic abstraction Interface Surface/Canvas/... where
one can send geometric object, setting colors, fonts and such that
are then mapped to a concrete ui frameweork (fx, swt, awt, ...)?
I poked around in the source a bit but haven't found such a thing,
the examples seem to simply extend for example a swt canvas and
then use Geometry2x to directly draw to a GC/Graphics object.
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx <mailto:gef-dev@xxxxxxxxxxx>
<mailto:gef-dev@xxxxxxxxxxx <mailto:gef-dev@xxxxxxxxxxx>>
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/gef-dev
<https://www.eclipse.org/mailman/listinfo/gef-dev>
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx <mailto:gef-dev@xxxxxxxxxxx>
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/gef-dev
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx <mailto:gef-dev@xxxxxxxxxxx>
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/gef-dev
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/gef-dev
_______________________________________________
gef-dev mailing list
gef-dev@xxxxxxxxxxx
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/gef-dev