API Review RT:17407 Canvas Node
joe andresen
joseph.andresen at oracle.com
Thu Apr 19 09:21:50 PDT 2012
On 4/19/2012 2:52 AM, Michael Heinrichs wrote:
> This is so awesome! I am looking forward to use Canvas. Here are my first thoughts and lots of questions about the API. Very well possible, that I missed something in the documentation, it is a huge change. :-)
>
> - What is the reason to have drawX and strokeX? It looks like both mean the same and I find it confusing to have strokeRect() and drawRoundRect() for example.
> - I do not like the term "oval", actually I totally overlooked it first. I would prefer ellipse and circle, which is used by pretty much all APIs I have dealt with so far. And the JavaFX API uses these terms, too.
> - Is it possible to get and set the value of a single pixels?
> - I am missing getters for the current settings like LineCap etc. Would it be possible to add them?
> - Do you do antialiasing when drawing paths? Is it possible to turn it on and off?
It may be useful to link
<http://www.w3.org/TR/2dcontext/#canvasrenderingcontext2d> the w3c spec
for canvas and the AWT Graphics2D
<http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html>.
> Thanks,
> Michael
>
>
>
> On 19.04.2012, at 00:36, 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)
More information about the openjfx-dev
mailing list