Revision: 2427
http://sourceforge.net/p/swingme/code/2427
Author: yuranet
Date: 2021-03-19 06:54:29 +0000 (Fri, 19 Mar 2021)
Log Message:
-----------
fix for filter image to take image densaties into account
Modified Paths:
--------------
AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java
AndroidME/src_MIDP/javax/microedition/lcdui/Image.java
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java 2021-03-19 06:42:46 UTC (rev 2426)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java 2021-03-19 06:54:29 UTC (rev 2427)
@@ -137,6 +137,11 @@
} else {
ay = y - image.getHeight();
}
+
+ drawImage(image, tx + ax, ty + ay, paint);
+ }
+
+ public void drawImage(javax.microedition.lcdui.Image image, int x, int y, Paint paint) {
int a = paint.getAlpha();
paint.setAlpha(0xFF);// do not want to use alpha with images
@@ -144,10 +149,10 @@
// this is probably a bug: https://issuetracker.google.com/issues/181887424
// we cant compare image with canvas.getDensity() as that seems to just return 0, and we also cant set it
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && getTargetDensity() != image.getBitmap().getDensity()) {
- canvas.drawBitmap(image.getBitmap(),null, new Rect(tx+ax, ty+ay, tx+ax + image.getWidth(), ty+ay + image.getHeight()), paint);
+ canvas.drawBitmap(image.getBitmap(),null, new Rect(x, y, x + image.getWidth(), y + image.getHeight()), paint);
}
else {
- canvas.drawBitmap(image.getBitmap(), tx + ax, ty + ay, paint);
+ canvas.drawBitmap(image.getBitmap(), x, y, paint);
}
paint.setAlpha(a);
}
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Image.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Image.java 2021-03-19 06:42:46 UTC (rev 2426)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Image.java 2021-03-19 06:54:29 UTC (rev 2427)
@@ -388,16 +388,9 @@
}
public static void filter(Image source, Image bm, ColorMatrix cm) {
-
- // Image bm = createImage(source.getWidth(), source.getHeight());
-
android.graphics.Paint paint = new android.graphics.Paint();
paint.setColorFilter(new android.graphics.ColorMatrixColorFilter(cm));
-
- // bm.getGraphics().getCanvas().drawBitmap(source.bitmap, 0, 0, paint);
- new Canvas(bm.bitmap).drawBitmap(source.bitmap, 0, 0, paint);
-
- // return bm;
+ bm.getGraphics().drawImage(source, 0, 0, paint);
}
private static void cleanMem() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|