-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for image sdf and painter size (#197)
- Loading branch information
Showing
11 changed files
with
105 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
...sions/src/commonMain/kotlin/dev/sargunv/maplibrecompose/expressions/ast/PainterLiteral.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
package dev.sargunv.maplibrecompose.expressions.ast | ||
|
||
import androidx.compose.ui.graphics.painter.Painter | ||
import androidx.compose.ui.unit.DpSize | ||
import dev.sargunv.maplibrecompose.expressions.ExpressionContext | ||
import dev.sargunv.maplibrecompose.expressions.value.StringValue | ||
|
||
/** | ||
* A [Literal] representing a [Painter] value, which will be drawn to a bitmap and loaded as an | ||
* image into the style upon compilation. | ||
*/ | ||
public data class PainterLiteral private constructor(override val value: Painter) : | ||
public data class PainterLiteral | ||
private constructor(override val value: Painter, val size: DpSize?, val sdf: Boolean) : | ||
Literal<StringValue, Painter> { | ||
override fun compile(context: ExpressionContext): StringLiteral = | ||
StringLiteral.of(context.resolvePainter(value)) | ||
StringLiteral.of(context.resolvePainter(this)) | ||
|
||
override fun visit(block: (Expression<*>) -> Unit): Unit = block(this) | ||
|
||
public companion object { | ||
public fun of(value: Painter): PainterLiteral = PainterLiteral(value) | ||
public fun of(value: Painter, size: DpSize?, sdf: Boolean): PainterLiteral = | ||
PainterLiteral(value, size, sdf) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters