Skip to content

Refactor: Render Markup Layers natively on full-resolution bitmap to prevent quality loss #2571

@haveigonemental

Description

@haveigonemental

Is your feature request related to a problem? Please describe.

Currently, when a user saves an image from the Markup Layers feature, the app uses captureController.captureAsync() to take a screenshot of the Compose view. While this works for displaying the UI, it causes a significant loss in image quality, as the saved image is constrained by the screen resolution rather than the imported image's original full resolution.

As mentioned by the maintainer, the saving process needs to be moved to the repository level by "projecting all compose operations on a full resolution bitmap."

Describe the solution you'd like

Instead of taking a UI screenshot, we need to mathematically project the Compose layer properties (scale, rotation, offset) onto the original high-resolution Bitmap.

I plan to implement the unfinished native rendering logic inside AndroidMarkupLayersApplier.kt by:

Implementing Canvas.drawLayer() using the native android.graphics.Canvas API.

Translating the LayerPosition parameters (scale, rotation, translation) into native Canvas matrix transformations.

Implementing native drawing logic for LayerType.Text, LayerType.Picture.Image, and LayerType.Picture.Sticker.

Removing the useOldLayers = true fallback in MarkupLayersComponent once the native applier is fully functional.

Describe alternatives you've considered

No response

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions