Skip to content

Commit

Permalink
Update Bitmap javadoc, bump version to 3.10 snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
BloCamLimb committed Dec 21, 2023
1 parent d23b026 commit 0b04047
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions core/src/main/java/icyllis/modernui/graphics/Bitmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@

/**
* Describes a 2D raster image (pixel map), with its pixels in native memory.
* This is used for CPU side operations, such as decoding or encoding. It is
* generally uploaded to GPU side {@link Image} for drawing on the screen,
* or downloaded from GPU side {@link Image} for encoding to streams.
* This class can be used for CPU-side encoding, decoding and resampling;
* pixel transfer between CPU and GPU. You cannot draw content to Bitmap.
* <p>
* Bitmap is created with immutable width, height and memory allocation
* (memory address), its contents may be changed. You can obtain Bitmap from
* encoded data (PNG, TGA, BMP, JPEG, HDR, PSD, PBM, PGM, and PPM) via
* {@link BitmapFactory}.
* <p>
* The color space of Bitmap defaults to sRGB and can only be in RGB space.
* The alpha defaults to non-premultiplied (independent of RGB channels).
* <p>
* This class is not thread safe, but memory safe. Its internal state may
* be shared by multiple threads. Nevertheless, it's recommended to call
Expand Down Expand Up @@ -290,16 +297,19 @@ public int getAlphaType() {

/**
* Reinterpret pixels with newColorType and newAlphaType.
* <p>
* You must be careful with packed formats and CPU byte order.
*
* @throws IllegalArgumentException newColorType has alpha but newAlphaType is unknown,
* or new bpp is not equal to old bpp
* @throws IllegalArgumentException colorType has alpha but alphaType is unknown,
* or bytesPerPixels mismatch
*/
@ApiStatus.Internal
public void setColorInfo(int newColorType, int newAlphaType) {
public void setColorInfo(@ImageInfo.ColorType int newColorType,
@ImageInfo.AlphaType int newAlphaType) {
newAlphaType = ImageInfo.validateAlphaType(newColorType, newAlphaType);
var oldInfo = getInfo();
if (oldInfo.bytesPerPixel() != ImageInfo.bytesPerPixel(newColorType)) {
throw new IllegalArgumentException();
throw new IllegalArgumentException("bpp mismatch");
}
var newInfo = new ImageInfo(
oldInfo.width(), oldInfo.height(),
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

modernui_version=3.9.1-SNAPSHOT
modernui_version=3.10.0-SNAPSHOT

lwjgl_version=3.3.2
log4j_version=2.19.0
Expand Down

0 comments on commit 0b04047

Please sign in to comment.