@@ -10,12 +10,16 @@ https://user-images.githubusercontent.com/35650605/177825237-6b509ff5-5027-44aa-
1010A composable that lays out and draws a given ` ImageBitmap ` . This will attempt to
1111size the composable according to the ` ImageBitmap ` 's given width and height.
1212
13- ` ImageScope ` contains ` Constraints ` since ` ImageWithConstraints ` uses ` BoxWithConstraints `
14- also it contains information about canvas width, height and top left position relative
15- to parent ` BoxWithConstraints ` .
13+ ` ImageScope ` returns constraints, width and height of the drawing area based on ` contentScale `
14+ * and rectangle of ` imageBitmap ` drawn. When a bitmap is displayed scaled to fit area of Composable
15+ * space used for drawing image is represented with ` ImageScope.imageWidth ` and
16+ * ` ImageScope.imageHeight ` .
17+ *
18+ * When we display a bitmap 1000x1000px with ` ContentScale.Crop ` if it's cropped to 500x500px
19+ * ` ImageScope.rect ` returns ` IntRect(250,250,750,750) ` .
1620
1721This composable enables building other ` Image ` based Composables that require you to know
18- which section of Composable image is drawn to or which section of Bitmap is drawn to ` Canvas `
22+ spaces around ` ImageBitmap ` with ` ContentScale ` or which section of Bitmap is drawn to ` Canvas `
1923
2024``` kotlin
2125@Composable
@@ -76,13 +80,13 @@ interface ImageScope {
7680
7781 /**
7882 * Width of area inside BoxWithConstraints that is scaled based on [ContentScale]
79- * This is width of the [Canvas] draw draws [ImageBitmap]
83+ * This is width of the [Canvas] draws [ImageBitmap]
8084 */
8185 val imageWidth: Dp
8286
8387 /**
8488 * Height of area inside BoxWithConstraints that is scaled based on [ContentScale]
85- * This is height of the [Canvas] draw draws [ImageBitmap]
89+ * This is height of the [Canvas] draws [ImageBitmap]
8690 */
8791 val imageHeight: Dp
8892
@@ -93,8 +97,9 @@ interface ImageScope {
9397}
9498```
9599
96- * drawImage param is to set whether this Composable should draw on Canvas or ` content ` param
97- should get scope parameter and draw it
100+ * drawImage param is to set whether this Composable should draw on Canvas. ` ImageWithConstraints `
101+ can be used not only for drawing but providing required info for its ` content ` or child
102+ Composables so child can draw ` ImageBitmap ` as required by developer.
98103
99104## ImageWithThumbnail
100105` ImageWithThumbnail ` displays thumbnail of bitmap it draws in corner specified
0 commit comments