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