Scoop API

scoop:scoop.ui.component:0.1.0

src/builders/media.scoop

Selected production source · src/builders/media.scoop

1package scoop.ui.component
3import scoop.graphics.*
4import scoop.ui.*
6public class ImageViewBuilder internal constructor() {
7 public var fit: ContentFit = ContentFit.Contain
8 public var alignment: Alignment = Alignment()
9 public var clip: Boolean = true
10 public var sampling: ImageSampling = ImageSampling.Linear
11 public var opacity: Double = 1.0
12 public var key: ViewKey = ViewKey.Position
13 public var semantics: ComponentSemantics? = None
16public fun imageView(
17 image: Image,
18 naturalSize: Size,
19 configure: ImageViewBuilder.() -> Unit = {}
20): View = makeImageView(image, naturalSize, configure)
22internal fun makeImageView(
23 image: Image,
24 naturalSize: Size,
25 configure: ImageViewBuilder.() -> Unit
26): View {
27 val builder = ImageViewBuilder()
28 builder.configure()
29 return element(
30 ImageViewProps(
31 image,
32 naturalSize,
33 builder.fit,
34 builder.alignment,
35 builder.clip,
36 builder.sampling,
37 builder.opacity,
38 builder.semantics
39 ),
40 { props, mount -> ImageView(props, scope = mount) },
41 key = builder.key
42 )
45public class PathViewBuilder internal constructor() {
46 public var naturalSize: Size? = None
47 public var paint: Paint = Paint()
48 public var fit: ContentFit = ContentFit.Contain
49 public var alignment: Alignment = Alignment()
50 public var clip: Boolean = true
51 public var key: ViewKey = ViewKey.Position
52 public var semantics: ComponentSemantics? = None
55public fun pathView(path: Path, viewBox: Rect, configure: PathViewBuilder.() -> Unit = {}): View =
56 makePathView(path, viewBox, configure)
58internal fun makePathView(path: Path, viewBox: Rect, configure: PathViewBuilder.() -> Unit): View {
59 val builder = PathViewBuilder()
60 builder.configure()
61 return element(
62 PathViewProps(
63 path,
64 viewBox,
65 builder.naturalSize,
66 builder.paint,
67 builder.fit,
68 builder.alignment,
69 builder.clip,
70 builder.semantics
71 ),
72 { props, mount -> PathView(props, scope = mount) },
73 key = builder.key
74 )