Status Update
Comments
ra...@google.com <ra...@google.com> #2
Thanks! Over to Nader to take a detailed look!
fd...@squareup.com <fd...@squareup.com> #3
I believe we should dup
ra...@google.com <ra...@google.com> #4
Yes definitely. Thanks Siyamed!
In the meantime there maybe other ways to work around it. The main issue is that surface implicitly creates a seaprate layer which impacts the behavior of the blending modes. Being ale to just set the Brush on the paint directly would work around this in the most straightforward way.
fd...@squareup.com <fd...@squareup.com> #5
The issue is that the content depends on transparent pixels existing in the scene before the gradient is applied.
To address this you can do the following in order to force rasterization of the graphicsLayer into a separate buffer using CompositingStrategy.Offscreen
, then only draw the gradient on top of the pixels rendered by the text Composable.
Text("Hello World!", modifier =
// Use offscreen compositing strategy so that there are transparent pixels in the offscreen buffer
// to blend against with the SrcIn blend mode
Modifier.graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen).drawWithCache {
val brush = Brush.horizontalGradient(listOf(Color.Red, Color.Blue, Color.Cyan, Color.Magenta, Color.Green))
onDrawWithContent {
drawContent()
drawRect(brush, blendMode = BlendMode.SrcIn)
}
}
)
ra...@google.com <ra...@google.com>
vi...@google.com <vi...@google.com>
fd...@squareup.com <fd...@squareup.com> #7
Hi,
sending them over:
Q: Android build
A: Not applicable, issue is happening when running layoutlib 2021.2.1-patch on the JVM, no device required.
Q: Device used
A: Not applicable, this is an issue with layoutlib, which usually runs in Android Studio
Q: Android bug report (to be captured after reproducing the issue)
A: Not applicable, to replicate the issue there's no need to run it on a device. There's a reproducible sample at
Q: Alternate method
A: Not applicable, as explained in the previous answer.
Description
I'm creating programmatically 100 TextViews in a scrollable LinearLayout and when I call layoutlib embedded in the Paparazzi lib (https://github.com/cashapp/paparazzi ) I'm getting the following OutOfMemory:
Please seehttps://github.com/cashapp/paparazzi/pull/516
OOM issue
layoutlib to be able to render the view
No
I’m using
layoutlib 2021.2.1-patch1
.N/A. This is an issue with layoutlib, which usually runs in Android Studio
Standalone sample here:https://github.com/cashapp/paparazzi/pull/516