(Canvas canvas, IRect target, IRect screen, float dpi)
| 179 | } |
| 180 | |
| 181 | public void drawPixelRef(Canvas canvas, IRect target, IRect screen, float dpi) { |
| 182 | try (var src = new Bitmap(); |
| 183 | var dst = new Bitmap();) |
| 184 | { |
| 185 | var info = ImageInfo.makeS32((int) (target.getWidth() * dpi), (int) (target.getHeight() * dpi), ColorAlphaType.OPAQUE); |
| 186 | src.allocPixels(info); |
| 187 | if (canvas.readPixels(src, (int) (target.getLeft() * dpi), (int) (target.getTop() * dpi))) { |
| 188 | var pixelRef = src.getPixelRef(); |
| 189 | dst.setImageInfo(info.withWidthHeight((int) (target.getWidth() / 2 * dpi), (int) (target.getHeight() / 2 * dpi))); |
| 190 | dst.setPixelRef(pixelRef, (int) (target.getWidth() / 4 * dpi), (int) (target.getHeight() / 4 * dpi)); |
| 191 | try (var image = Image.makeRasterFromBitmap(dst.setImmutable());) { |
| 192 | canvas.drawImageRect(image, target.toRect()); |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | try(var stroke = new Paint().setColor(0xFFE5E5E5).setMode(PaintMode.STROKE).setStrokeWidth(1);) { |
| 198 | canvas.drawRect(target.toRect(), stroke); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | |
| 203 | public void drawAlpha(Canvas canvas, IRect target, IRect screen, float dpi) { |
no test coverage detected