Implement Bitmap.copy, text layouting (#1455)

* Bitmap: Use provided config

* Bitmap: implement copy

* Bitmap: Simplify getPixels

This also fixes a bug where the returned data may not be in the correct
format

Android getPixels():
> The returned colors are non-premultiplied ARGB values in the sRGB color space.
BufferedImage getRGB():
> Returns an array of integer pixels in the default RGB color model (TYPE_INT_ARGB) and default sRGB color space

* Stub TextPaint and Paint

* Paint: Implement some required functions

* Stub StaticLayout and Layout

* Implement some Paint support

* Draw Bounds

* WebP write support

* First text rendering

* Paint: Fix text size, font metrics

* Paint: Fix not copying new properties

Fixes font size in draw

* Canvas: Stroke add cap/join for better aliasing

Otherwise we get bad artifacts on sharp corners

Based on https://stackoverflow.com/a/35222059/

* Remove logs

* Canvas: Implement other drawText methods

* Bitmap: support erase

* Layout: Fix text direction

Should be LTR, otherwise 0 is read, which is automatically interpreted
as RTL without explicit check

* Bitmap: scale to destination rectangle

* Canvas: drawBitmap with just x/y

* Bitmap: Convert image on JPEG export to RGB

JPEG does not support alpha, so will throw "bogus color space"

* Switch to newer fork
This commit is contained in:
Constantin Piber
2025-06-21 18:01:56 +02:00
committed by GitHub
parent 0b021e6c42
commit 20c850c10b
17 changed files with 7290 additions and 26 deletions
@@ -1,15 +1,15 @@
package android.graphics;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.os.Parcel;
public final class Rect {
int left;
int top;
int right;
int bottom;
public int left;
public int top;
public int right;
public int bottom;
private static final class UnflattenHelper {
private static final Pattern FLATTENED_PATTERN = Pattern.compile(