Interface FloatGraphics

  • All Known Implementing Classes:
    RasterFloatGraphics

    public interface FloatGraphics
    Represents a simple 2D floating point graphics API, for drawing lines and filling polygons of a constant color.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Paints the current clip area with the current color.
      void drawLine​(double x0, double y0, double x1, double y1)
      Draws a line segment between two endpoints, namely (x0,y0) and (x1,y1).
      void drawPoint​(double x, double y)
      Draws a point, which can be thought of as a specific case of a line, where both end points of line [segment] are the same.
      void fillPolygon​(double[] xPts, double[] yPts, int offset, int numPts)
      Fills in the interior of the polygon defined by the vertices given.
      ClipRectangle getClip()
      The return value of this method is not necessarily equal to the clip previously set by setClip(); the clip returned here is no larger than the entire area that is visible by this graphics context.
      FloatColor getColor()
      Returns the color that was previously set via setColor().
      void setClip​(ClipRectangle clip)
      The clip determines how much of an object [to be rendered] is visible.
      void setColor​(FloatColor color)
      For drawing points, drawing lines, and filling polygons, how non-opaque colors are handled is up to the implementation of this interface.
    • Method Detail

      • setColor

        void setColor​(FloatColor color)
        For drawing points, drawing lines, and filling polygons, how non-opaque colors are handled is up to the implementation of this interface.
      • getColor

        FloatColor getColor()
        Returns the color that was previously set via setColor().
      • drawPoint

        void drawPoint​(double x,
                       double y)
        Draws a point, which can be thought of as a specific case of a line, where both end points of line [segment] are the same.
      • drawLine

        void drawLine​(double x0,
                      double y0,
                      double x1,
                      double y1)
        Draws a line segment between two endpoints, namely (x0,y0) and (x1,y1).
      • fillPolygon

        void fillPolygon​(double[] xPts,
                         double[] yPts,
                         int offset,
                         int numPts)
        Fills in the interior of the polygon defined by the vertices given. The interior of a polygon may be defined in different ways for self-intersecting polygons; for example, an even-odd rule or a non-zero-winding-number rule may be used to define the interior of a self-intersecting polygon.
      • setClip

        void setClip​(ClipRectangle clip)
        The clip determines how much of an object [to be rendered] is visible. The clip does not necessarily force objects to be clipped against it before they are rendered; rather, you can think of objects being rendered onto an infinite [blank] canvas, with the clip being applied to the canvas to determine how much of the object is visible; the visible portion would then be actually painted. This principle is important for objects such as lines, for example, which are represented by an infinitely thin concept but may, when rendered, have some thickness.

        setClip(null) sets the clip to the maximum possible area that is visible by this context.

      • getClip

        ClipRectangle getClip()
        The return value of this method is not necessarily equal to the clip previously set by setClip(); the clip returned here is no larger than the entire area that is visible by this graphics context.

        For example, to find out the maximum possible area that is visible by this context, first setClip(null) and then inspect the return value of this method.

        This method never returns null.

      • clear

        void clear()
        Paints the current clip area with the current color. This is not necessarily equivalent to filling a rectangle of clip area because clear() is required to clobber all visual information in the current clip, whereas filling a polygon may handle transparent or translucent colors in a special way.