2. GEF 3.x / Zest 1.x
• Mature project with quite long history
• Base technology with lot's of users (direct & indirect through
GMF/Graphiti)
• Stable API, no breaking API changes since 2004 (GEF 3.0)
• Ready for CBI (migration to Git, Maven/Tycho completed)
• But API is organically evolved and there are ~400
bugzillas, out of which several require to break it
3. SomeTopics for a Renewal
• Re-thinking current componentization
• Support for the E4 application model
• Support for rotation and other transformations
• Support for curved connections
• Support for other rendering platforms than SWT
• Multi-touch gestures support
• Revision of the command framework
• Revision of connection handling (clipping container)
• Various renamings and restructurings on the detail level...
4. Zest 2 (since 2010)
• A provisional Zest 2 component was initiated in 2010, to
develop the next generation Zest API.
• Goal was to develop a new version of Zest in parallel to the
maintenance of Zest 1.x., with an - up to the final
graduation - provisional API
• Sources were intended to be placed in its own Zest2 Git
repository, results were published separately via Eclipse
Marketplace.
5. GEF4 (since 2011)
• GEF4 was initiated - in analogy to Zest 2 - to develop the next
generation Draw2d and GEF (MVC) API.
• Similar to Zest2, development was intended to take place in
parallel to maintenance of Draw2d / GEF (MVC) 3.x
• Initial plans (prior to 3.8):
• Create new double-precision Geometry API before Juno
release.
• Start to migrate the Draw2d and GEF (MVC) code base on a
step-by-step basis afterwards.
6. GEF4 + Zest 2 = GEF4
Modified plan:
Unification of both approaches after Juno!
7. GEF4 - A Unified Approach
• A unified approach with a shared code base and a
common namespace (org.eclipse.gef4) for all plug-ins.
• Advantages:
• Clear distinction between GEF proper as the production
component and GEF4 as the provisional one
• Chance to not only refactor GEF components but the
componentization itself, which is only "historically" justified.
8. GEF4 - Status Quo
• GEF4 Geometry component was initiated in 2011, work has been
finalized with the Juno release:
• Functionally complete (at least for now)
• 344 JUnit tests, ~77% instruction coverage
• GEF4 Graphics component was initiated directly after Juno and is
currently under work:
• Functionally nearly complete for SWT/AWT, intended JavaFX adoption
about to start
• Still limited tests and quite a bit of adjustment needed w.r.t. "platform-
specific" issues of SWT
9. GEF4 - Status Quo (continued)
• GEF4 Zest was transferred to Git repository (and update-
site) but not yet adopted:
• Zest2 plug-ins were renamed to org.eclipse.gef4.zest.*
• Dependencies on Draw2d 3.x still have to be factored out
10. GEF4 Geometry
• No distinction in low and high precision, but just a single double-precision
API (with built-in imprecision for comparisons).
• Different geometric abstractions for different purposes:
• Euclidean (Vector, Straight,Angle)
• Projective (Vector3D, Straight3D)
• Planar (Point, Dimension, Line, QuadraticCurve, CubicCurve,
BezierCurve, Polyline, PolyBezier, Ellipse, Rectangle, Pie,Arc, Polygon,
CurvedPolygon, RoundedRectangle, Ring, Region, Path)
• Conversions to/from AWT and SWT (and between them)
11. GEF4 Planar Geometry - Features
• Support for "non-standard" geometries:
• Arbitrary Bezier curves, curved polygons
• Approximation via BezierCurves & Interpolation via PolyBeziers
• Characteristics-related core abstractions (IGeometry, ICurve, IShape,
IMultiShape)
• Construction-related base-classes (AbstractRectangleBased-
Geometry,AbstractPointListBasedGeometry,...)
• Direct support for affine transformations (ITranslatable, IScalable,
IRotatable)
• No direct SWT dependencies (SWT-related conversions bundled in
optional plug-in)
16. GEF4 Geometry - Sample Code
// Bezier approximation of curves
BezierCurve[] fromCurve = curve.toBezier();
BezierCurve[] fromShape = shape.getOutline().toBezier();
ICurve[] fromPolyShape = polyShape.getOutlineSegments();
List<BezierCurve> beziers = new ArrayList<BezierCurve>();
for (ICurve c : fromPolyShape)
beziers.addAll(Arrays.asList(c.toBezier()));
// PolyBezier interpolation
PolyBezier interpolation = PolyBezier.interpolateCubic(p0, p1, p2, p3, ...);
// support for affine transformations
Polygon rhomb = new Rectangle(10, 10, 10, 10).getRotatedCCW(Angle.fromDeg(45));
PolyBezier slanted = new Ellipse(100, 100, 100, 50).getRotatedCCW(Angle.fromDeg(30));
Ring rotatedClippingArea = region.getRotatedCCW(Angle.fromDeg(300));
17. GEF4 Graphics
• Support for rendering (planar) geometries, images, and text
on an underlying Canvas/Graphics
• Key abstractions (Font, Image, Color) and transparent
support for multiple widget toolkits (SWT,AWT, JavaFX*)
• Save push/pop/restore and get/set of graphics state
• Combinations of advanced graphics features like xor-mode,
patterns (color, gradient, image), affine transformations, etc.
• Extensible image processing support (Pixel-Filter, Channel-
Filter, Convolution-Filter)
*) Graphics based on JavaFX Canvas API already prototyped byTom Schindl
21. GEF4 Graphics - Sample Code
// prepare geometries
final Ellipse ellipse = new Ellipse(50, 50, 350, 200);
final Rectangle rectangle = new Rectangle(100, 160, 125, 220);
final Polygon triangle = new Polygon(260, 170, 190, 300, 330, 300);
// prepare colors
final Color red = new Color(255, 0, 0);
final Color darkRed = new Color(128, 0, 0);
final Color blue = new Color(0, 0, 255);
final Color green = new Color(0, 255, 0);
final Color darkGreen = new Color(0, 128, 0);
g.setLineWidth(4);
g.pushState(); // save the current set of properties on the stack
g.setFill(red).setDraw(darkRed).setDashArray(25, 10);
g.fill(ellipse).draw(ellipse.getOutline());
g.restoreState(); // restore the previously saved properties
g.setFill(blue).setLineJoin(LineJoin.ROUND).setLineCap(LineCap.ROUND);
g.fill(rectangle).draw(rectangle.getOutline());
g.popState(); // removes the previously saved properties from the stack
// and enables the properties that were set in advance
g.setFill(green).setDraw(darkGreen).setLineJoin(LineJoin.MITER);
g.fill(triangle).draw(triangle.getOutline());
22. GEF4 Graphics - More Sample Code
• Java2D:
• GEF4 Graphics (Java2D & SWT):
g2d.translate(50, 50);
g2d.setPaint(new RadialGradientPaint(new Point(50, 50), 50, new Point(
40, 40), new float[] { 0, .5f, 1 }, new Color[] {
new Color(255, 255, 255), new Color(255, 0, 0),
new Color(0, 0, 0) }, CycleMethod.REFLECT));
g2d.fill(new Rectangle(0, 0, 200, 200));
g.translate(50, 50);
Ellipse ellipse = new Ellipse(0, 0, 100, 100);
g.setFill(new Gradient.Radial(ellipse, ellipse
.getCenter().translate(-10, -10), CycleMode.REFLECT)
.addStop(0.0, new Color(255, 255, 255))
.addStop(0.5, new Color(255, 0, 0))
.addStop(1.0, new Color(0, 0, 0)));
g.fill(new Rectangle(0, 0, 200, 200));
23. GEF4 - Outlook (Mid-Term)
• GEF4 Layouts is planned:
• Data model for layout computations (based on Draw2d/
Zest DirectedGraphLayout)
• Set of layout algorithms based on it (Draw2d & Zest)
• GEF4 'Glyphs' is planned:
• Figures/Shapes abstractions inspired by Draw2d, SVG, and
JavaFX (SceneGraph)
• Intended as replacement of Draw2d 'core'
24. GEF4 - Outlook (Long-Term)
• Adoption of migrated Zest components to new GEF4
Geometry, Graphics, Canvas, Layouts components
• Migration of remaining Draw2d/GEF (MVC) code base,
including re-modularization and adoption
25. Share & Enjoy - Please get involved!
• Evaluate and Provide Feedback!
• Try out early snapshots!
• Report bugs, report enhancement requests!
• Contribute!
• Participate in discussions (bugzilla, mailing list)
• Supply patches