@@ -99,6 +99,9 @@ public class JSGraphics2D implements
9999 * ctx.backingStorePixelRatio || 1; return dpr / bsr; })() ||
100100 */
101101 1 ;
102+ static {
103+ System .out .println ("JSGraphics2D pixelRatio is " + pixelRatio );
104+ }
102105// this is 1.5 for Windows
103106// nice, but now how would be do raw pixel setting, say, from images?
104107// can.width = w * pixelRatio;
@@ -468,6 +471,14 @@ private void doRoundRect(int x, int y, int w, int h, int aw, int ah, int mode) {
468471 draw (rrect );
469472 }
470473
474+ /**
475+ * Allows for direct image transfer by buffer
476+ * @param img
477+ * @param x
478+ * @param y
479+ * @param observer
480+ * @return
481+ */
471482 public boolean drawImage (Image img , int x , int y , ImageObserver observer ) {
472483 return drawImagePriv (img , x , y , observer );
473484 }
@@ -496,10 +507,10 @@ private void observe(Image img, ImageObserver observer, boolean isOK) {
496507 observer .imageUpdate (img , (isOK ? 0 : ImageObserver .ABORT | ImageObserver .ERROR ), -1 , -1 , -1 , -1 );
497508 }
498509
499- public boolean drawImage (Image img , int x , int y , Color bgcolor , ImageObserver observer ) {
500- // backgroundPainted = true;
501- return drawImage (img , x , y , observer );
502- }
510+ // public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
511+ //// backgroundPainted = true;
512+ // return drawImage(img, x, y, observer);
513+ // }
503514
504515 public boolean drawImage (Image img , int x , int y , int width , int height , Color bgcolor , ImageObserver observer ) {
505516 if (width <= 0 || height <= 0 )
@@ -563,7 +574,7 @@ public boolean drawImagePriv(Image img, int x, int y, ImageObserver observer) {
563574 /**
564575 * @j2sNative
565576 *
566- * pixels = img.秘pix; isRGB = (img.imageType == 1);
577+ * pixels = img.raster.秘pix ||img. 秘pix; isRGB = (img.imageType == 1);
567578 *
568579 */
569580 DOMNode imgNode = null ;
@@ -582,13 +593,7 @@ public boolean drawImagePriv(Image img, int x, int y, ImageObserver observer) {
582593 return true ;
583594 }
584595
585- public void drawDirectRGBA (int [] pixels ) {
586- // this can go VERY fast - for writing directly to the canvas context
587- // backgroundPainted = true;
588- drawDirect (pixels , 0 , 0 , width , height , false );
589- }
590-
591- private void drawDirect (int [] pixels , int x , int y , int width , int height , boolean isRGB ) {
596+ public void drawDirect (int [] pixels , int x , int y , int width , int height , boolean isRGB ) {
592597 if (buf8 == null || x != lastx || y != lasty || nx != width || ny != height ) {
593598 imageData = ctx .getImageData (x , y , width , height );
594599 buf8 = imageData .data ;
0 commit comments