Skip to content

vg: make Canvas and Path APIs use vg.Points

Sebastien Binet requested to merge sbinet-gonum:vg-canvas-iface into master
  • improve vg.Canvas interface to use vg.Point where it makes sense:
type Canvas interface {
    // Translate applies a translational transform
    // to the context.
-   Translate(x, y Length)
+   Translate(pt Point)

    // Scale applies a scaling transform to the
    // context.
 @@ -73,7 +73,7 @@ type Canvas interface {

    // FillString fills in text at the specified
    // location using the given font.
-   FillString(f Font, x, y Length, text string)
+   FillString(f Font, pt Point, text string)
}
  • also improved vg.Path and vg.PathComp to use vg.Point:
@@ -147,11 +146,11 @@ type PathComp struct {
    // be meaningless.
    Type int

-   // The X and Y fields are used as the destination
-   // of a MoveComp or LineComp and are the center
-   // point of an ArcComp.  They are not used in
+   // The Pos field is used as the destination
+   // of a MoveComp or LineComp and is the center
+   // point of an ArcComp.  It is not used in
    // the CloseComp.
-   X, Y Length
+   Pos Point

I can split the 2 changes into 2 PRs if deemed preferable.

Needs #261

Merge request reports

Loading