Skip to main content

[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?

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.

Am 05.01.2021 um 15:54 schrieb Christoph Läubrich <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>) 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>>:

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>
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

Attachment: signature.asc
Description: Message signed with OpenPGP


Back to the top