javaquery/canvas/src/main/java/net/java/html/canvas/spi/GraphicsEnvironment.java
author Anton Epple <toni.epple@eppleton.de>
Wed, 12 Feb 2014 09:14:20 +0100
branchcanvas
changeset 1447 3e3fb431d2b7
parent 1303 3d62ad46d744
child 1450 0726c9779524
permissions -rw-r--r--
More JavaDoc improvements.
toni@1129
     1
/**
toni@1447
     2
 * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
toni@1447
     3
 * <jaroslav.tulach@apidesign.org>
toni@1129
     4
 *
toni@1447
     5
 * This program is free software: you can redistribute it and/or modify it under
toni@1447
     6
 * the terms of the GNU General Public License as published by the Free Software
toni@1447
     7
 * Foundation, version 2 of the License.
toni@1129
     8
 *
toni@1447
     9
 * This program is distributed in the hope that it will be useful, but WITHOUT
toni@1447
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
toni@1447
    11
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
toni@1447
    12
 * details.
toni@1129
    13
 *
toni@1447
    14
 * You should have received a copy of the GNU General Public License along with
toni@1447
    15
 * this program. Look for COPYING file in the top folder. If not, see
toni@1447
    16
 * http://opensource.org/licenses/GPL-2.0.
toni@1128
    17
 */
toni@1136
    18
package net.java.html.canvas.spi;
toni@1128
    19
toni@1137
    20
import net.java.html.canvas.Dimension;
toni@1144
    21
import net.java.html.canvas.Image;
toni@1136
    22
import net.java.html.canvas.Style;
toni@1128
    23
toni@1128
    24
/**
toni@1136
    25
 * Provider API for Canvas. Implement this to add support for your platform.
toni@1141
    26
 *
toni@1128
    27
 * @author antonepple
toni@1128
    28
 */
toni@1128
    29
public interface GraphicsEnvironment {
toni@1129
    30
toni@1447
    31
    /**
toni@1447
    32
     * Adds path elements to the current path to make an arc.
toni@1447
    33
     *
toni@1447
    34
     * @param centerX the center x position of the arc.
toni@1447
    35
     * @param centerY the center y position of the arc.
toni@1447
    36
     * @param startAngle the startAngle of the arc
toni@1447
    37
     * @param radius the radius of the arc.
toni@1447
    38
     * @param endAngle the endAngle of the arc
toni@1447
    39
     * @param ccw the direction of the arc (counterclockwise)
toni@1447
    40
     */
toni@1128
    41
    public void arc(double centerX,
toni@1128
    42
            double centerY,
toni@1128
    43
            double startAngle,
toni@1128
    44
            double radius,
toni@1128
    45
            double endAngle,
toni@1128
    46
            boolean ccw);
toni@1128
    47
toni@1447
    48
    /**
toni@1447
    49
     * Adds segments to the current path to make an arc.
toni@1447
    50
     *
toni@1447
    51
     * @param x1 the X coordinate of the first point of the arc.
toni@1447
    52
     * @param y1 the Y coordinate of the first point of the arc.
toni@1447
    53
     * @param x2 the X coordinate of the second point of the arc.
toni@1447
    54
     * @param y2 the Y coordinate of the second point of the arc.
toni@1447
    55
     * @param radius the radius of the arc in the range {0.0-positive infinity}.
toni@1447
    56
     */
toni@1128
    57
    public void arcTo(double x1,
toni@1128
    58
            double y1,
toni@1128
    59
            double x2,
toni@1128
    60
            double y2,
toni@1447
    61
            double radius);
toni@1128
    62
toni@1447
    63
    /**
toni@1447
    64
     * Returns true if the the given x,y point is inside the path.
toni@1447
    65
     *
toni@1447
    66
     * @param x the X coordinate to use for the check.
toni@1447
    67
     * @param y the Y coordinate to use for the check.
toni@1447
    68
     * @return true if the point given is inside the path, false otherwise.
toni@1447
    69
     */
toni@1128
    70
    public boolean isPointInPath(double x, double y);
toni@1128
    71
toni@1447
    72
    /**
toni@1447
    73
     * Fills the path with the current fill paint.
toni@1447
    74
     */
toni@1128
    75
    public void fill();
toni@1128
    76
toni@1447
    77
    /**
toni@1447
    78
     * Strokes the path with the current stroke paint.
toni@1447
    79
     */
toni@1128
    80
    public void stroke();
toni@1128
    81
toni@1447
    82
    /**
toni@1447
    83
     * Starts a Path
toni@1447
    84
     */
toni@1128
    85
    public void beginPath();
toni@1128
    86
toni@1447
    87
    /**
toni@1447
    88
     * Closes the path.
toni@1447
    89
     */
toni@1128
    90
    public void closePath();
toni@1128
    91
toni@1447
    92
    /**
toni@1447
    93
     * Clips using the current path
toni@1447
    94
     */
toni@1128
    95
    public void clip();
toni@1128
    96
toni@1447
    97
    /**
toni@1447
    98
     * Issues a move command for the current path to the given x,y coordinate.
toni@1447
    99
     *
toni@1447
   100
     * @param x the X position for the move to command.
toni@1447
   101
     * @param y the Y position for the move to command.
toni@1447
   102
     */
toni@1128
   103
    public void moveTo(double x, double y);
toni@1128
   104
toni@1447
   105
    /**
toni@1447
   106
     * Adds segments to the current path to make a line at the given x,y
toni@1447
   107
     * coordinate.
toni@1447
   108
     *
toni@1447
   109
     * @param x the X coordinate of the ending point of the line.
toni@1447
   110
     * @param y the Y coordinate of the ending point of the line.
toni@1447
   111
     */
toni@1128
   112
    public void lineTo(double x, double y);
toni@1128
   113
toni@1447
   114
    /**
toni@1447
   115
     * Adds segments to the current path to make a quadratic curve.
toni@1447
   116
     *
toni@1447
   117
     * @param cpx the X coordinate of the control point
toni@1447
   118
     * @param cpy the Y coordinate of the control point
toni@1447
   119
     * @param x the X coordinate of the end point
toni@1447
   120
     * @param y the Y coordinate of the end point
toni@1447
   121
     */
toni@1128
   122
    public void quadraticCurveTo(double cpx, double cpy, double x, double y);
toni@1128
   123
toni@1447
   124
    /**
toni@1447
   125
     * Adds segments to the current path to make a cubic bezier curve.
toni@1447
   126
     *
toni@1447
   127
     * @param cp1x the X coordinate of first bezier control point.
toni@1447
   128
     * @param cp1y the Y coordinate of the first bezier control point.
toni@1447
   129
     * @param cp2x the X coordinate of the second bezier control point.
toni@1447
   130
     * @param cp2y the Y coordinate of the second bezier control point.
toni@1447
   131
     * @param x the X coordinate of the end point.
toni@1447
   132
     * @param y the Y coordinate of the end point.
toni@1447
   133
     */
toni@1128
   134
    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
toni@1128
   135
toni@1447
   136
    /**
toni@1447
   137
     * Fills a rectangle using the current fill paint.
toni@1447
   138
     *
toni@1447
   139
     * @param x the X position of the upper left corner of the rectangle.
toni@1447
   140
     * @param y the Y position of the upper left corner of the rectangle.
toni@1447
   141
     * @param width the width of the rectangle.
toni@1447
   142
     * @param height the height of the rectangle.
toni@1447
   143
     */
toni@1128
   144
    public void fillRect(double x, double y, double width, double height);
toni@1128
   145
toni@1447
   146
    /**
toni@1447
   147
     * Strokes a rectangle using the current stroke paint.
toni@1447
   148
     *
toni@1447
   149
     * @param x the X position of the upper left corner of the rectangle.
toni@1447
   150
     * @param y the Y position of the upper left corner of the rectangle.
toni@1447
   151
     * @param width the width of the rectangle.
toni@1447
   152
     * @param height the height of the rectangle.
toni@1447
   153
     */
toni@1128
   154
    public void strokeRect(double x, double y, double width, double height);
toni@1128
   155
toni@1447
   156
    /**
toni@1447
   157
     * Clears a portion of the canvas with a transparent color value.
toni@1447
   158
     *
toni@1447
   159
     * @param x X position of the upper left corner of the rectangle.
toni@1447
   160
     * @param y Y position of the upper left corner of the rectangle.
toni@1447
   161
     * @param width width of the rectangle.
toni@1447
   162
     * @param height height of the rectangle.
toni@1447
   163
     */
toni@1128
   164
    public void clearRect(double x, double y, double width, double height);
toni@1128
   165
toni@1447
   166
    /**
toni@1447
   167
     * Clears a portion of the canvas with a transparent color value.
toni@1447
   168
     *
toni@1447
   169
     * @param x X position of the upper left corner of the rectangle.
toni@1447
   170
     * @param y Y position of the upper left corner of the rectangle.
toni@1447
   171
     * @param width width of the rectangle.
toni@1447
   172
     * @param height height of the rectangle.
toni@1447
   173
     */
toni@1128
   174
    public void rect(double x, double y, double width, double height);
toni@1128
   175
toni@1447
   176
    /**
toni@1447
   177
     * Saves the following attributes onto a stack.
toni@1447
   178
     * <ul>
toni@1447
   179
     * <li>Global Alpha</li>
toni@1447
   180
     * <li>Global Blend Operation</li>
toni@1447
   181
     * <li>Transform</li>
toni@1447
   182
     * <li>Fill Paint</li>
toni@1447
   183
     * <li>Stroke Paint</li>
toni@1447
   184
     * <li>Line Width</li>
toni@1447
   185
     * <li>Line Cap</li>
toni@1447
   186
     * <li>Line Join</li>
toni@1447
   187
     * <li>Miter Limit</li>
toni@1447
   188
     * <li>Number of Clip Paths</li>
toni@1447
   189
     * <li>Font</li>
toni@1447
   190
     * <li>Text Align</li>
toni@1447
   191
     * <li>Text Baseline</li>
toni@1447
   192
     * <li>Effect</li>
toni@1447
   193
     * <li>Fill Rule</li>
toni@1447
   194
     * </ul>
toni@1447
   195
     * This method does NOT alter the current state in any way. Also, not that
toni@1447
   196
     * the current path is not saved.
toni@1447
   197
     */
toni@1128
   198
    public void save();
toni@1128
   199
toni@1447
   200
    /**
toni@1447
   201
     * Pops the state off of the stack, setting the following attributes to
toni@1447
   202
     * their value at the time when that state was pushed onto the stack. If the
toni@1447
   203
     * stack is empty then nothing is changed.
toni@1447
   204
     *
toni@1447
   205
     * <ul>
toni@1447
   206
     * <li>Global Alpha</li>
toni@1447
   207
     * <li>Global Blend Operation</li>
toni@1447
   208
     * <li>Transform</li>
toni@1447
   209
     * <li>Fill Paint</li>
toni@1447
   210
     * <li>Stroke Paint</li>
toni@1447
   211
     * <li>Line Width</li>
toni@1447
   212
     * <li>Line Cap</li>
toni@1447
   213
     * <li>Line Join</li>
toni@1447
   214
     * <li>Miter Limit</li>
toni@1447
   215
     * <li>Number of Clip Paths</li>
toni@1447
   216
     * <li>Font</li>
toni@1447
   217
     * <li>Text Align</li>
toni@1447
   218
     * <li>Text Baseline</li>
toni@1447
   219
     * <li>Effect</li>
toni@1447
   220
     * <li>Fill Rule</li>
toni@1447
   221
     * </ul>
toni@1447
   222
     */
toni@1128
   223
    public void restore();
toni@1128
   224
toni@1447
   225
    /**
toni@1447
   226
     * Rotates the current transform in degrees.
toni@1447
   227
     *
toni@1447
   228
     * @param angle value in degrees to rotate the current transform.
toni@1447
   229
     */
toni@1128
   230
    public void rotate(double angle);
toni@1128
   231
toni@1447
   232
    /**
toni@1447
   233
     * Concatenates the input with the current transform.
toni@1447
   234
     *
toni@1447
   235
     * @param a - the X coordinate scaling element of the 3x4 matrix
toni@1447
   236
     * @param b - the Y coordinate shearing element of the 3x4 matrix
toni@1447
   237
     * @param c - the X coordinate shearing element of the 3x4 matrix
toni@1447
   238
     * @param d - the Y coordinate scaling element of the 3x4 matrix
toni@1447
   239
     * @param e - the X coordinate translation element of the 3x4 matrix
toni@1447
   240
     * @param f - the Y coordinate translation element of the 3x4 matrix
toni@1447
   241
     */
toni@1128
   242
    public void transform(double a, double b, double c, double d, double e, double f);
toni@1128
   243
toni@1447
   244
    /**
toni@1447
   245
     * Concatenates the input with the current transform.
toni@1447
   246
     *
toni@1447
   247
     * @param a - the X coordinate scaling element of the 3x4 matrix
toni@1447
   248
     * @param b - the Y coordinate shearing element of the 3x4 matrix
toni@1447
   249
     * @param c - the X coordinate shearing element of the 3x4 matrix
toni@1447
   250
     * @param d - the Y coordinate scaling element of the 3x4 matrix
toni@1447
   251
     * @param e - the X coordinate translation element of the 3x4 matrix
toni@1447
   252
     * @param f - the Y coordinate translation element of the 3x4 matrix
toni@1447
   253
     */
toni@1128
   254
    public void setTransform(double a, double b, double c, double d, double e, double f);
toni@1128
   255
toni@1447
   256
    /**
toni@1447
   257
     * Translates the current transform by x, y.
toni@1447
   258
     *
toni@1447
   259
     * @param x value to translate along the x axis.
toni@1447
   260
     * @param y value to translate along the y axis.
toni@1447
   261
     */
toni@1128
   262
    public void translate(double x, double y);
toni@1128
   263
toni@1447
   264
    /**
toni@1447
   265
     * Scales the current transform by x, y.
toni@1447
   266
     *
toni@1447
   267
     * @param x value to scale in the x axis.
toni@1447
   268
     * @param y value to scale in the y axis.
toni@1447
   269
     */
toni@1128
   270
    public void scale(double x, double y);
toni@1128
   271
toni@1447
   272
    /**
toni@1447
   273
     * Draws an image at the given x, y position using the width and height of
toni@1447
   274
     * the given image.
toni@1447
   275
     *
toni@1447
   276
     * @param image the image to be drawn.
toni@1447
   277
     * @param x the X coordinate on the destination for the upper left of the
toni@1447
   278
     * image.
toni@1447
   279
     * @param y the Y coordinate on the destination for the upper left of the
toni@1447
   280
     * image.
toni@1447
   281
     * @return the native Image for caching.
toni@1447
   282
     */
toni@1302
   283
    public Object drawImage(Image image, double x, double y, Object nativeImage);
toni@1144
   284
toni@1447
   285
    /**
toni@1447
   286
     * Draws an image into the given destination rectangle of the canvas. The
toni@1447
   287
     * Image is scaled to fit into the destination rectagnle.
toni@1447
   288
     *
toni@1447
   289
     * @param image the image to be drawn.
toni@1447
   290
     * @param x the X coordinate on the destination for the upper left of the
toni@1447
   291
     * image.
toni@1447
   292
     * @param y the Y coordinate on the destination for the upper left of the
toni@1447
   293
     * image.
toni@1447
   294
     * @param width the width of the destination rectangle.
toni@1447
   295
     * @param height the height of the destination rectangle.
toni@1447
   296
     * @return the native Image for caching.
toni@1447
   297
     *
toni@1447
   298
     */
toni@1144
   299
    public Object drawImage(Image image, double x, double y, double width, double height, Object nativeImage);
toni@1144
   300
toni@1447
   301
    /**
toni@1447
   302
     * Draws the current source rectangle of the given image to the given
toni@1447
   303
     * destination rectangle of the Canvas.
toni@1447
   304
     *
toni@1447
   305
     * @param image the image to be drawn.
toni@1447
   306
     * @param sx the source rectangle's X coordinate position.
toni@1447
   307
     * @param sy the source rectangle's Y coordinate position.
toni@1447
   308
     * @param sWidth the source rectangle's width.
toni@1447
   309
     * @param sHeight the source rectangle's height.
toni@1447
   310
     * @param x the destination rectangle's X coordinate position.
toni@1447
   311
     * @param y the destination rectangle's Y coordinate position.
toni@1447
   312
     * @param width the destination rectangle's width.
toni@1447
   313
     * @param height the destination rectangle's height.
toni@1447
   314
     * @return the native Image for caching.
toni@1447
   315
     */
toni@1144
   316
    public Object drawImage(Image image, double sx, double sy, double sWidth, double sHeight, double x, double y, double width, double height, Object nativeImage);
toni@1144
   317
toni@1447
   318
    /**
toni@1447
   319
     * Get the width of this Image
toni@1447
   320
     *
toni@1447
   321
     * @param image the image to measure
toni@1447
   322
     * @param nativeImage the cached native Image or null
toni@1447
   323
     * @return the width of the image
toni@1447
   324
     */
toni@1263
   325
    public int getWidth(Image image, Object nativeImage);
toni@1302
   326
toni@1447
   327
    /**
toni@1447
   328
     * Get the height of this Image
toni@1447
   329
     *
toni@1447
   330
     * @param image the image to measure
toni@1447
   331
     * @param nativeImage the cached native Image or null
toni@1447
   332
     * @return the height of the image
toni@1447
   333
     */
toni@1263
   334
    public int getHeight(Image image, Object nativeImage);
toni@1302
   335
toni@1141
   336
    /**
toni@1141
   337
     * When implementing you can return an Object of your choice to enable
toni@1141
   338
     * caching. Returning null means no caching. When caching is enabled, and
toni@1141
   339
     * the cache hasn't been invalidated, the Object you returned will be passed
toni@1141
   340
     * as a parameter.
toni@1141
   341
     *
toni@1141
   342
     * @param style The style object you should use to create your native style
toni@1141
   343
     * @param nativeStyle your native object if cached, null otherwise
toni@1141
   344
     * @return return native Object for caching
toni@1141
   345
     *
toni@1141
   346
     */
toni@1141
   347
    public Object setFillStyle(Style style, Object nativeStyle);
toni@1128
   348
toni@1141
   349
    /**
toni@1141
   350
     * When implementing you can return an Object of your choice to enable
toni@1141
   351
     * caching. Returning null means no caching. When caching is enabled, and
toni@1141
   352
     * the cache hasn't been invalidated, the Object you returned will be passed
toni@1141
   353
     * as a parameter.
toni@1141
   354
     *
toni@1141
   355
     * @param style The style object you should use to create your native style
toni@1141
   356
     * @param nativeStyle your native object if cached, null otherwise
toni@1141
   357
     * @return return native Object for caching
toni@1141
   358
     *
toni@1141
   359
     */
toni@1141
   360
    public Object setStrokeStyle(Style style, Object nativeStyle);
toni@1128
   361
toni@1302
   362
//    public void setShadowColor(String color);
toni@1302
   363
//
toni@1302
   364
//    public void setShadowBlur(double blur);
toni@1302
   365
//
toni@1302
   366
//    public void setShadowOffsetX(double x);
toni@1302
   367
//
toni@1302
   368
//    public void setShadowOffsetY(double y);
toni@1302
   369
//    
toni@1302
   370
//    public String getShadowColor();
toni@1302
   371
//
toni@1302
   372
//    public double getShadowBlur();
toni@1302
   373
//
toni@1302
   374
//    public double getShadowOffsetX();
toni@1302
   375
//
toni@1302
   376
//    public double getShadowOffsetY();
toni@1302
   377
    /**
toni@1302
   378
     * Gets the current stroke line cap.
toni@1302
   379
     *
toni@1302
   380
     * @return {@code StrokeLineCap} with a value of Butt, Round, or Square.
toni@1302
   381
     */
toni@1128
   382
    public String getLineCap();
toni@1128
   383
toni@1302
   384
    /**
toni@1302
   385
     * Sets the current stroke line cap.
toni@1302
   386
     *
toni@1302
   387
     * @param style a value of Butt, Round, or Square.
toni@1302
   388
     */
toni@1128
   389
    public void setLineCap(String style);
toni@1128
   390
toni@1302
   391
    /**
toni@1302
   392
     * Gets the current stroke line join.
toni@1302
   393
     *
toni@1302
   394
     * @return a value of Miter, Bevel, or Round.
toni@1302
   395
     */
toni@1128
   396
    public String getLineJoin();
toni@1128
   397
toni@1302
   398
    /**
toni@1302
   399
     * Sets the current stroke line join.
toni@1302
   400
     *
toni@1302
   401
     * @param style with a value of Miter, Bevel, or Round.
toni@1302
   402
     */
toni@1128
   403
    public void setLineJoin(String style);
toni@1128
   404
toni@1302
   405
    /**
toni@1302
   406
     * Gets the current line width.
toni@1302
   407
     *
toni@1302
   408
     * @return value between 0 and infinity.
toni@1302
   409
     */
toni@1128
   410
    public double getLineWidth();
toni@1128
   411
toni@1302
   412
    /**
toni@1302
   413
     * Sets the current line width.
toni@1302
   414
     *
toni@1302
   415
     * @param width value in the range {0-positive infinity}, with any other
toni@1302
   416
     * value being ignored and leaving the value unchanged.
toni@1302
   417
     */
toni@1128
   418
    public void setLineWidth(double width);
toni@1128
   419
toni@1302
   420
    /**
toni@1302
   421
     * Gets the current miter limit. v
toni@1302
   422
     *
toni@1302
   423
     * @return the miter limit value in the range {@code 0.0-positive infinity}
toni@1302
   424
     */
toni@1128
   425
    public double getMiterLimit();
toni@1128
   426
toni@1302
   427
    /**
toni@1302
   428
     * Sets the current miter limit.
toni@1302
   429
     *
toni@1302
   430
     * @param limit miter limit value between 0 and positive infinity with any
toni@1302
   431
     * other value being ignored and leaving the value unchanged.
toni@1302
   432
     */
toni@1128
   433
    public void setMiterLimit(double limit);
toni@1128
   434
toni@1302
   435
    /**
toni@1302
   436
     * Gets the current Font.
toni@1302
   437
     *
toni@1302
   438
     * @return the Font
toni@1302
   439
     */
toni@1128
   440
    public String getFont();
toni@1128
   441
toni@1302
   442
    /**
toni@1302
   443
     * Sets the current Font.
toni@1302
   444
     *
toni@1302
   445
     */
toni@1128
   446
    public void setFont(String font);
toni@1128
   447
toni@1302
   448
    /**
toni@1302
   449
     * Gets the current {@code TextAlignment}.
toni@1302
   450
     *
toni@1302
   451
     * @return TextAlignment with values of Left, Center, Right, or Justify.
toni@1302
   452
     */
toni@1128
   453
    public String getTextAlign();
toni@1128
   454
toni@1302
   455
    /**
toni@1302
   456
     * Defines horizontal text alignment, relative to the text origin.
toni@1302
   457
     *
toni@1302
   458
     * @param textAlign with values of Left, Center, Right.
toni@1302
   459
     */
toni@1128
   460
    public void setTextAlign(String textAlign);
toni@1128
   461
toni@1302
   462
    /**
toni@1302
   463
     * Sets the current Text Baseline.
toni@1302
   464
     *
toni@1302
   465
     * @param baseline with values of Top, Center, Baseline, or Bottom
toni@1302
   466
     */
toni@1128
   467
    public String getTextBaseline();
toni@1128
   468
toni@1302
   469
    /**
toni@1302
   470
     * Sets the current Text Baseline.
toni@1302
   471
     *
toni@1302
   472
     * @param baseline with values of Top, Center, Baseline, or Bottom
toni@1302
   473
     */
toni@1302
   474
    public void setTextBaseline(String baseline);
toni@1128
   475
toni@1302
   476
    /**
toni@1302
   477
     * Fills the given string of text at position x, y (0,0 at top left) with
toni@1302
   478
     * the current fill paint attribute.
toni@1302
   479
     *
toni@1302
   480
     * @param text the string of text.
toni@1302
   481
     * @param x position on the x axis.
toni@1302
   482
     * @param y position on the y axis.
toni@1302
   483
     */
toni@1128
   484
    public void fillText(String text, double x, double y);
toni@1128
   485
toni@1302
   486
    /**
toni@1302
   487
     * Fills text and includes a maximum width of the string.
toni@1302
   488
     *
toni@1302
   489
     * If the width of the text extends past max width, then it will be sized to
toni@1302
   490
     * fit.
toni@1302
   491
     *
toni@1302
   492
     * @param text the string of text.
toni@1302
   493
     * @param x position on the x axis.
toni@1302
   494
     * @param y position on the y axis.
toni@1302
   495
     * @param maxWidth maximum width the text string can have.
toni@1302
   496
     */
toni@1128
   497
    public void fillText(String text, double x, double y, double maxWidth);
toni@1128
   498
toni@1302
   499
    /**
toni@1302
   500
     * The Dimension of this text using the current Font settings
toni@1302
   501
     *
toni@1302
   502
     * @param text
toni@1302
   503
     * @return the Dimension of this text using the current Font settings
toni@1302
   504
     */
toni@1128
   505
    public Dimension measureText(String text);
toni@1128
   506
toni@1302
   507
    /**
toni@1302
   508
     * draws the given string of text at position x, y (0,0 at top left) with
toni@1302
   509
     * the current stroke paint attribute.
toni@1302
   510
     *
toni@1302
   511
     * @param text the string of text.
toni@1302
   512
     * @param x position on the x axis.
toni@1302
   513
     * @param y position on the y axis.
toni@1302
   514
     */
toni@1128
   515
    public void strokeText(String text, double x, double y);
toni@1128
   516
toni@1302
   517
    /**
toni@1302
   518
     * Draws text with stroke paint and includes a maximum width of the string.
toni@1302
   519
     *
toni@1302
   520
     * If the width of the text extends past max width, then it will be sized to
toni@1302
   521
     * fit.
toni@1302
   522
     *
toni@1302
   523
     * @param text the string of text.
toni@1302
   524
     * @param x position on the x axis.
toni@1302
   525
     * @param y position on the y axis.
toni@1302
   526
     * @param maxWidth maximum width the text string can have.
toni@1302
   527
     */
toni@1128
   528
    public void strokeText(String text, double x, double y, double maxWidth);
toni@1128
   529
toni@1302
   530
//    public ImageData createPixelMap(double x, double y);
toni@1302
   531
//
toni@1302
   532
//    public ImageData createPixelMap(ImageData imageData);
toni@1302
   533
//
toni@1302
   534
//    public ImageData getPixelMap(double x, double y, double width, double height);
toni@1302
   535
//
toni@1302
   536
//    public void putPixelMap(ImageData imageData, double x, double y);
toni@1302
   537
//
toni@1302
   538
//    public void putPixelMap(ImageData imageData, double x, double y, double dirtyx, double dirtyy, double dirtywidth, double dirtyheight);
toni@1302
   539
    /**
toni@1302
   540
     * Sets the global alpha of the current state.
toni@1302
   541
     *
toni@1302
   542
     * @param alpha value in the range {@code 0.0-1.0}. The value is clamped if
toni@1302
   543
     * it is out of range.
toni@1302
   544
     */
toni@1128
   545
    public void setGlobalAlpha(double alpha);
toni@1128
   546
toni@1447
   547
    /**
toni@1447
   548
     * Get the global alpha of the current state.
toni@1447
   549
     *
toni@1447
   550
     * @return alpha value in the range {@code 0.0-1.0}.
toni@1447
   551
     */
toni@1128
   552
    public double getGlobalAlpha();
toni@1128
   553
toni@1447
   554
    /**
toni@1447
   555
     * Sets the global blend mode.
toni@1447
   556
     *
toni@1447
   557
     * @param operation the BlendMode that will be set.
toni@1447
   558
     */
toni@1128
   559
    public void setGlobalCompositeOperation(String operation);
toni@1128
   560
toni@1447
   561
    /**
toni@1447
   562
     * Gets the global blend mode.
toni@1447
   563
     *
toni@1447
   564
     * @return the global BlendMode of the current state.
toni@1447
   565
     */
toni@1128
   566
    public String getGlobalCompositeOperation();
toni@1302
   567
toni@1447
   568
    /**
toni@1447
   569
     * Get the height of this GraphicsContext (which should be the same as the
toni@1447
   570
     * enclosing canvas height)
toni@1447
   571
     *
toni@1447
   572
     * @return the height of this GraphicsContext
toni@1447
   573
     */
toni@1128
   574
    public int getHeight();
toni@1128
   575
toni@1447
   576
    /**
toni@1447
   577
     * Get the width of this GraphicsContext (which should be the same as the
toni@1447
   578
     * enclosing canvas height)
toni@1447
   579
     *
toni@1447
   580
     * @return the width of this GraphicsContext
toni@1447
   581
     */
toni@1128
   582
    public int getWidth();
toni@1128
   583
toni@1302
   584
//    public void setHeight(int height);
toni@1302
   585
//
toni@1302
   586
//    public void setWidth(int width);
toni@1447
   587
     /**
toni@1447
   588
     * Merges two images drawing one on top of the other and returning the
toni@1447
   589
     * result.
toni@1447
   590
     *
toni@1447
   591
     * @param a the lower Image
toni@1447
   592
     * @param b the upper Image
toni@1447
   593
     * @param cachedA the native cached Image, if available, or null.
toni@1447
   594
     * @param cachedB the native cached Image, if available, or null.
toni@1447
   595
     * @return
toni@1447
   596
     */  
toni@1263
   597
    public Object mergeImages(Image a, Image b, Object cachedA, Object cachedB);
toni@1128
   598
}