API Review RT:17407 Canvas Node

Dr. Michael Paus mp at jugs.org
Fri Apr 20 02:39:25 PDT 2012


Am 20.04.2012 02:09, schrieb Jim Graham:
> Some targeted questions I'd like to see more reactions on (we made a 
> preliminary prototype based on the HTML5 flavors in most cases, but 
> we've done APIs that go either way in the past so we are flexible here):
>
> Canvas.getGC() only keeps one instance and keeps returning it - good/bad?
That's OK for me.
>
> Constructing a path in the GC vs. separate Path object?
Not having to create Path objects is one of the main motivations to
use a direct mode graphics interface. The assumption is that all
information that is needed to create the path is already stored
somewhere in your own model and having to create a Path object
is just an unnecessary duplication of that information.
>
> drawFoo() vs. strokeFoo() for drawing the outline of something?
I don't have any clear preference for this but people are probably more 
used to drawFoo().
>
>             ...jim
>
> On 4/18/12 3:36 PM, joe andresen wrote:
>> Hello Everyone,
>>
>> We propose to add a Canvas node and GraphicsContext to a new
>> javafx.scene.canvas package for JavaFX 2.2. The javafx.scene.canvas
>> package provides a pair of classes for an immediate mode style API for
>> rendering. Canvas Node works seemlessly with effects as well as
>> Animation timers, and will be tightly bound to the new ImageOps API.
>>
>> This new API will allow HTML5 Canvas users to easily port their existing
>> applications that make heavy use of the HTML5 canvas directly to JavaFX
>> without the need to morph their application to fit the scenegraph model.
>>
>> You can Download and unzip the (preliminary) relevant docs here:
>> JIRA: http://javafx-jira.kenai.com/browse/RT-17407
>>
>> Note that the docs are a work in progress but should be enough for API
>> Review. (Also, Jira will be down Thursday 4/19 at 1400 PDT for a while).
>>
>> A list of the the methods for Canvas and GraphicsContext are listed 
>> below.
>>
>> Canvas:
>>
>> GraphicsContext getGraphicsContext2D()
>> double getHeight()
>> double getWidth()
>> DoubleProperty heightProperty()
>> void setHeight(double value)
>> void setWidth(double value)
>> DoubleProperty widthProperty()
>>
>> GraphicsContext:
>> void appendSVGPath(java.lang.String svgpath)
>> void applyEffect(Effect e)
>> void arc(double centerX, double centerY, double radiusX, double radiusY,
>> double startAngle, double length)
>> void arcTo(double x1, double y1, double x2, double y2, double radius)
>> void beginPath()
>> void bezierCurveTo(double xc1, double yc1, double xc2, double yc2,
>> double x1, double y1)
>> void clearRect(double x, double y, double w, double h)
>> void clip()
>> void closePath()
>> void drawArc(double x, double y, double w, double h, double startAngle,
>> double arcExtent, ArcType closure)
>> void drawImage(Image img, double x, double y)
>> void drawImage(Image img, double x, double y, double w, double h)
>> void drawImage(Image img, double sx, double sy, double sw, double sh,
>> double dx, double dy, double dw, double dh)
>> void drawLine(double x1, double y1, double x2, double y2)
>> void drawOval(double x, double y, double w, double h)
>> void drawPolygon(double[] xPoints, double[] yPoints, int nPoints)
>> void drawPolyline(double[] xPoints, double[] yPoints, int nPoints)
>> void drawRoundRect(double x, double y, double w, double h, double
>> arcWidth, double arcHeight)
>> void fill()
>> void fillArc(double x, double y, double w, double h, double startAngle,
>> double arcExtent, ArcType closure)
>> void fillOval(double x, double y, double w, double h)
>> void fillPolygon(double[] xPoints, double[] yPoints, int nPoints)
>> void fillRect(double x, double y, double w, double h)
>> void fillRoundRect(double x, double y, double w, double h, double
>> arcWidth, double arcHeight)
>> void fillText(java.lang.String text, double x, double y)
>> void fillText(java.lang.String text, double x, double y, double 
>> maxWidth)
>> Canvas getCanvas()
>> boolean isPointInPath(double x, double y)
>> void lineTo(double x1, double y1)
>> double measureText(java.lang.String text)
>> void moveTo(double x0, double y0)
>> void putImageData(GraphicsContext.ImageData imagedata, double dx, double
>> dy)
>> void putImageData(GraphicsContext.ImageData imagedata, double dx, double
>> dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight)
>> void quadraticCurveTo(double xc, double yc, double x1, double y1)
>> void rect(double x, double y, double w, double h)
>> void restore()
>> void rotate(double degrees)
>> void save()
>> void scale(double x, double y)
>> void setEffect(Effect e)
>> void setFill(Paint p)
>> void setFont(Font f)
>> void setGlobalAlpha(double alpha)
>> void setGlobalCompositeOperation(GraphicsContext.CompositeOperation op)
>> void setLineCap(StrokeLineCap cap)
>> void setLineJoin(StrokeLineJoin join)
>> void setLineWidth(double lw)
>> void setMiterLimit(double ml)
>> void setStroke(Paint p)
>> void setTextAlign(TextAlignment align)
>> void setTextBaseline(VPos baseline)
>> void setTransform(double mxx, double myx, double mxy, double myy, double
>> mxt, double myt)
>> void stroke()
>> void strokeRect(double x, double y, double w, double h)
>> void strokeText(java.lang.String text, double x, double y)
>> void strokeText(java.lang.String text, double x, double y, double 
>> maxWidth)
>> void transform(double mxx, double myx, double mxy, double myy, double
>> mxt, double myt)
>> void translate(double x, double y)


-- 
--------------------------------------------------------------------------------------
Dr. Michael Paus, Chairman of the Java User Group Stuttgart e.V. (JUGS).
For more information visit www.jugs.de.



More information about the openjfx-dev mailing list