1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Tue May 28 08:50:06 2013 +0200
1.2 +++ b/javaquery/canvas/src/main/java/net/java/html/canvas/GraphicsContext.java Sat Sep 07 18:25:09 2013 +0200
1.3 @@ -151,6 +151,19 @@
1.4 Object nativeImage = graphicsEnvironmentImpl.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height, image.getCached());
1.5 image.cache(nativeImage);
1.6 }
1.7 +
1.8 + public Image merge(Image a, Image b){
1.9 + if(a.getCached()==null){
1.10 + drawImage(a, 0, 0);
1.11 + }
1.12 + if(b.getCached()==null){
1.13 + drawImage(b, 0, 0);
1.14 + }
1.15 + Object nativeImage = graphicsEnvironmentImpl.mergeImages(a,b,a.getCached(),b.getCached());
1.16 + Image merged = Image.create("should add real path here");
1.17 + merged.cache(nativeImage);
1.18 + return merged;
1.19 + }
1.20
1.21 public void setShadowColor(String color){
1.22 graphicsEnvironmentImpl.setShadowColor(color);
1.23 @@ -322,10 +335,6 @@
1.24 return new Style.Color(webColor);
1.25 }
1.26
1.27 - public Image getImageForPath(String path){
1.28 - return new net.java.html.canvas.Image(path);
1.29 - }
1.30 -
1.31 public int getHeight(){
1.32 return graphicsEnvironmentImpl.getHeight();
1.33 }
1.34 @@ -341,4 +350,23 @@
1.35 public void setWidth(int width){
1.36 graphicsEnvironmentImpl.setWidth(width);
1.37 }
1.38 +
1.39 + public void fillCircle(float centerX, float centerY, float radius) {
1.40 + graphicsEnvironmentImpl.arc(centerX, centerY, radius, 0, Math.PI*2, false);
1.41 + }
1.42 +
1.43 + public void fillPolygon(double[] x_coord, double[] y_coord, int vertexCount) {
1.44 + if (vertexCount >=1&&x_coord!=null && x_coord.length>=vertexCount && y_coord!=null && y_coord.length>=vertexCount)
1.45 + graphicsEnvironmentImpl.beginPath();
1.46 + graphicsEnvironmentImpl.moveTo(x_coord[0], y_coord[0]);
1.47 + for (int i = 1; i < vertexCount; i++) {
1.48 + graphicsEnvironmentImpl.lineTo(x_coord[i], y_coord[i]);
1.49 +
1.50 + }
1.51 + graphicsEnvironmentImpl.closePath();
1.52 + graphicsEnvironmentImpl.fill();
1.53 + graphicsEnvironmentImpl.stroke();
1.54 +
1.55 +
1.56 + }
1.57 }