graphics
This table lists all the artifacts in the androidx.graphics
group.
Artifact | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
graphics-core | - | - | - | 1.0.0-alpha05 |
graphics-path | - | - | 1.0.0-beta01 | - |
graphics-shapes | - | - | - | 1.0.0-alpha03 |
Declaring dependencies
To add a dependency on Graphics, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle
file for
your app or module:
Groovy
dependencies { implementation "androidx.graphics:graphics-core:1.0.0-alpha05" implementation "androidx.graphics:graphics-path:1.0.0-beta01" implementation "androidx.graphics:graphics-shapes:1.0.0-alpha03" }
Kotlin
dependencies { implementation("androidx.graphics:graphics-core:1.0.0-alpha05") implementation("androidx.graphics:graphics-path:1.0.0-beta01") implementation("androidx.graphics:graphics-shapes:1.0.0-alpha03") }
For more information about dependencies, see Add build dependencies.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
There are no release notes for this artifact.
Graphics Shapes Version 1.0
Version 1.0.0-alpha03
June 7, 2023
androidx.graphics:graphics-shapes:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
API Changes
- Added new
RoundedPolygon.rectangle()
function (I78e7e, b/280322189) - Star and Circle functions are now decapitalized and called via
RoundedPolygon
's companion object: e.g.,RoundedPolygon.star(...)
(I14735)
Bug Fixes
- Fixed bug on smoothing (Ibf894)
- Fixed a bug that occured when start and end shape were the same. Better distribute available space on side for cuts, first using available space for rounding, then for smoothing if there is space left. (Ibd320, b/277936300)
Version 1.0.0-alpha02
April 19, 2023
androidx.graphics:graphics-shapes:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
API Changes
- The Polygon superclass was merged in with its subclass,
RoundedPolygon
; all polygons are now [optionally] rounded polygons. - The Star function (which still returns a
RoundedPolygon
, as before) now takes aninnerRadius
value, instead of the previousinnerRadiusRatio
parameter. This is in the same units as the existing radius parameter, making things simpler and more consistent. Also, thenumOuterVertices
parameter was renamed tonumVerticesPerRadius
to clarify that the same number is applied to both inner and outer radii. CornerRounding.radius
was previously documented to be relative to the size of the polygon, but it was (and should be) an absolute, not relative, value. The docs were updated and the annotation limiting it to a max value of 1.0 was fixed.
Version 1.0.0-alpha01
April 5, 2023
Graphics-Shapes is a new library which allows easy creation and rendering of rounded polygonal shapes, as well as simple and automatic morphing (animation) between different shapes.
androidx.graphics:graphics-shapes:1.0.0-alpha01
is released. This version was released from an internal branch.
New Features
- Use the Polygon API to create regular and star polygons with the desired number of vertices.
- Use optional
CornerRounding
parameters to specify the rounding radius and smoothing parameters for the corners, resulting in polygonal shapes with rounded corners. - Use the new
Morph(Polygon, Polygon)
API to automatically calculate a “morph” shape whose progress can be set from 0 to 1 to animate between the starting and ending shapes. Animate that progress over time, drawing the result on every frame, to create a smooth animation between these new rounded shapes.
Graphics Path Version 1.0
Version 1.0.0-beta01
November 29, 2023
androidx.graphics:graphics-path:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
API Changes
- Removed usages of experimental
isAtLeastU()
API (Ie9117, b/289269026)
Bug Fixes
- Various fixes and performance improvements, including how the library deals with conics.
Version 1.0.0-alpha02
June 7, 2023
androidx.graphics:graphics-path:1.0.0-alpha02
is released. This version is developed in an internal branch.
New Features
- Fixed problem with internal platform version check which caused problems when running on Android 14 previews (the version check would fail, but the mechanism for doing things on previous releases doesn’t work correctly on Android 14 in particular).
Version 1.0.0-alpha01
March 22, 2023
androidx.graphics:graphics-path:1.0.0-alpha01
is released. Version 1.0.0-alpha01 contains these commits.
New Features
- This new library allows querying of Path data via the new
PathIterator
API. Using this API, callers can iterate through all segments of a Path object to determine the operation and data for those segments. - The library uses similar APIs introduced in Android 14 preview, but this AndroidX version of the API also works on versions back to API 21.
Graphics Core Version 1.0
Version 1.0.0-alpha05
September 6, 2023
androidx.graphics:graphics-core:1.0.0-alpha05
is released. Version 1.0.0-alpha05 contains these commits.
New Features
- Introduced
GLFrameBufferRenderer
API. This provides a combination of OpenGL dependencies, swap chain configuration, pixel formats andSurfaceControl
configuration. (Ic775b)
API Changes
- Added width + height parameters to various callback APIs to pipe dimensions from
SurfaceHolder#Callbacks
. (I7f9fc) - Added clear API to clear both front and multi buffered layers. (Ic1f95)
- Added support to configure the underlying buffer type of swapchains used within
GLFrontBufferedRenderer
. (I07a13) - Added kotlin properties for getters on
GLFrameBufferRenderer
,IntRange
annotation for max buffer entries, andHardwareBufferFormart
andHardwareBufferUsage
annotations forsetFormat
/setUsage
respectively. (Ief89e) - Updated
setBuffer
API onSurfaceControl
transactions to provide a release fence. (Ice1bb) - Added
SurfaceControlCompat.Transaction
APIs to configure the data space as well as set the extended brightness range. (Ic378d)
Version 1.0.0-alpha04
June 7, 2023
androidx.graphics:graphics-core:1.0.0-alpha04
is released. Version 1.0.0-alpha04 contains these commits.
New Features
- Introduced
CanvasFrontBufferedRenderer
to support low latency graphics leveraging theandroid.graphics.Canvas
API alongside the existing OpenGL implementation
API Changes
- Updated
SurfaceControlCompat.Transaction#setBuffer
API to allow for nullableHardwareBuffer
instances to mirror the corresponding platform API (I173d7) - Rename methods referring to Double Buffered rendering to Multi Buffered instead as the backing swapchain may contain more than 2 buffers. (I830d7)
- Create
CanvasFrontBufferedRenderer
API to enable 3ps to leverage a front buffered rendering system using the Canvas API. (Ibfc29)
Bug Fixes
- Fixed issue where
GLFrontBufferedRenderer
would not render content after resuming the corresponding Activity. - Fixed issue where front buffered content would be cleared prematurely.
- Fixed issue where
SurfaceHolder.Callbacks
would not be removed after low latency graphics APIs were released.
Version 1.0.0-alpha03
March 22, 2023
androidx.graphics:graphics-core:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
API Changes
- Updated
GLFrontBufferedRenderer
callback implementation to provideBufferInfo
object that contains buffer width/height along with a frame buffer identifier that can be used to re-target the original destination after rendering to an intermediate scratch buffer. (I7fe20) - Consolidated
SyncFence
creation to static factory method onSyncFenceCompat
. - Removed public compatibility method for
eglDupNativeFenceFDANDROID
in favor ofSyncFenceCompat
factory method for SyncFence creation. This is to ensure all API surfaces receive the correctSyncFence
implementation regardless of API level. (I849bb) - Added documentation for
FrameBufferRenderer
andSyncStrategy
.- Moved
FrameBufferRenderer
+FrameBuffer
+FrameBufferPool
toandroidx.graphics.opengl
package - Moved
SyncStrategy
toandroidx.graphics.opengl
package - Updated
RenderCallback#onDraw
docs - Updated documentation of
RenderCallback#obtainFrameBuffer
that implementor of API is responsible for callingFrameBuffer.close
- Updated
onDrawComplete
to indicate consumers are responsible for dispatching contents to display - Moved
SyncFence
compatibility interfaces/classes toandroidx.hardware
package to mirror the framework - Renamed
SyncFence
API toSyncFenceV19
and made private to consolidate usages toSyncFenceCompat
which leverages the framework'sSyncFence
API wherever possible. (I5149c)
- Moved
- Added
GLFrontBufferedRenderer#cancel
andGLFrontBufferedRenderer#execute
methods. The former is useful in palm rejection scenarios where rendering to the front buffer should be cancelled and hide the front buffer. The latter is useful in scenarios to manipulate objects on the GL thread without having to schedule a render. (If0b7f) - Add API to render directly to the double buffered layer. This assists with re-rendering a scene after resume as well as giving an opportunity to consumers to selectively determine when to leverage front buffered rendering dynamically based on the desired scene to render. (Ied56c)
- Added new API to
SurfaceControlCompat.Builder
to support configuring the parentSurfaceControl
from anotherSurfaceControl
instance in addition to the existing mechanism from aSurfaceView
. (I1d1b6) - More return type nullability of deprecated-hidden functions (Ibf7b0)
- Added
EGL_ANDROID_get_native_client_buffer
extension constant to query whether the Android device supports importing ofHardwareBuffer
instances intoEGLClientBuffer
objects that can be consumed as anEGLImage
instance. (Iad767) - Adding
@JvmDefaultWithCompatibility
annotation (I8f206)
Version 1.0.0-alpha02
November 9, 2022
androidx.graphics:graphics-core:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
API Changes
- Fixed missing
RequiresApi
annotation foraddTransactionCommitListener
which was introduced in Android S (I0a035) - Updated
onDraw<Front/Double>
Buffer callbacks to provide a transform matrix that consumers can pass to their vertex shaders in addition to the current buffer width/height. Consumers are responsible for using these parameters to properly pre-rotate their OpenGL rendering code. (I82f9e)
Bug Fixes
- Improved graphics latency by pre-rotating buffers before issuing
SurfaceControl
transactions. - Fixed issue where error logs would show error 300d (EGL_BAD_SURFACE).
- Fixed issue where
GLFrontBufferedRenderer
would be invalid after the corresponding Activity it was used within was resumed. - Increased support for emulators and ChromeOS devices.
- Fixed issue where the front buffered layer maybe hidden prematurely.
Version 1.0.0-alpha01
October 24, 2022
androidx.graphics:graphics-core:1.0.0-alpha01
is released. Version 1.0.0-alpha01 contains these commits.
New Features
- Initial release of the graphics core AndroidX library. This includes APIs to support low latency use cases such as stylus input. This also introduces some helper APIs for OpenGL usage.
API Changes
- Introduces
GLFrontBufferedRenderer
to assist in front and multi-buffered rendering to achieve both low latency and high quality rendering output. - Introduces
GLRenderer
API to assist in OpenGL rendering for various Surface providers such asSurfaceView
,TextureView
and others.