@@ -81,10 +81,8 @@ private fun ThumbnailDemoSamples(imageBitmap: ImageBitmap) {
8181 ThumbnailCallbackSample (modifier, imageBitmap, contentScale)
8282 ThumbnailPositionChangeSample (modifier)
8383 ThumbnailUIPropertiesSample (modifier)
84- ThumbnailScaleModeSample ()
8584}
8685
87-
8886@Composable
8987private fun ThumbnailScaleModeCustomImageSample (
9088 modifier : Modifier ,
@@ -309,199 +307,6 @@ private fun ThumbnailUIPropertiesSample(
309307 ),
310308 contentDescription = null
311309 )
312-
313- }
314- }
315-
316- @Composable
317- private fun ThumbnailScaleModeSample () {
318- val modifier = Modifier
319- .background(Color .LightGray )
320- .fillMaxWidth()
321- .aspectRatio(4 / 3f )
322-
323- val bitmap1 = ImageBitmap .imageResource(
324- LocalContext .current.resources,
325- R .drawable.landscape1
326- )
327-
328- val bitmap2 = ImageBitmap .imageResource(
329- LocalContext .current.resources,
330- R .drawable.landscape2
331- )
332-
333- val bitmap3 = ImageBitmap .imageResource(
334- LocalContext .current.resources,
335- R .drawable.landscape3
336- )
337-
338- ExpandableColumnWithTitle (
339- title = " Content Scale" ,
340- color = MaterialTheme .colorScheme.primary,
341- initialExpandState = false
342- ) {
343-
344- Text (
345- " Demonstrates correct positions are returned even if image is " +
346- " scaled with ContentScale modes"
347- )
348-
349- // Bitmap1 1920x1280
350- Text (text = " ContentScale.None" )
351- ImageWithThumbnail (
352- imageBitmap = bitmap1,
353- modifier = modifier,
354- contentScale = ContentScale .None ,
355- contentDescription = null
356- )
357-
358- Spacer (modifier = Modifier .height(30 .dp))
359- Text (text = " ContentScale.Fit" )
360- ImageWithThumbnail (
361- imageBitmap = bitmap1,
362- modifier = modifier,
363- contentScale = ContentScale .Fit ,
364- contentDescription = null
365- )
366-
367- Spacer (modifier = Modifier .height(30 .dp))
368- Text (text = " ContentScale.Crop" )
369- ImageWithThumbnail (
370- imageBitmap = bitmap1,
371- modifier = modifier,
372- contentScale = ContentScale .Crop ,
373- contentDescription = null
374- )
375-
376- Spacer (modifier = Modifier .height(30 .dp))
377- Text (text = " ContentScale.FillBounds" )
378- ImageWithThumbnail (
379- imageBitmap = bitmap1,
380- modifier = modifier,
381- contentScale = ContentScale .FillBounds ,
382- contentDescription = null
383- )
384-
385- Spacer (modifier = Modifier .height(30 .dp))
386- Text (text = " ContentScale.FillWidth" )
387- ImageWithThumbnail (
388- imageBitmap = bitmap1,
389- modifier = modifier,
390- contentScale = ContentScale .FillWidth ,
391- contentDescription = null
392- )
393-
394- Spacer (modifier = Modifier .height(30 .dp))
395- Text (text = " ContentScale.FillHeight" )
396- ImageWithThumbnail (
397- imageBitmap = bitmap1,
398- modifier = modifier,
399- contentScale = ContentScale .FillHeight ,
400- contentDescription = null
401- )
402-
403- Spacer (modifier = Modifier .height(30 .dp))
404- Text (text = " ContentScale.Inside" )
405- ImageWithThumbnail (
406- imageBitmap = bitmap1,
407- modifier = modifier,
408- contentScale = ContentScale .Inside ,
409- contentDescription = null
410- )
411-
412- // Bitmap2 480x270
413-
414- Spacer (modifier = Modifier .height(30 .dp))
415- Text (text = " ContentScale.None" )
416- ImageWithThumbnail (
417- imageBitmap = bitmap2,
418- modifier = modifier,
419- contentScale = ContentScale .None ,
420- contentDescription = null
421- )
422-
423- Spacer (modifier = Modifier .height(30 .dp))
424- Text (text = " ContentScale.Fit" )
425- ImageWithThumbnail (
426- imageBitmap = bitmap2,
427- modifier = modifier,
428- contentScale = ContentScale .Fit ,
429- contentDescription = null
430- )
431-
432- Spacer (modifier = Modifier .height(30 .dp))
433- Text (text = " ContentScale.Crop" )
434- ImageWithThumbnail (
435- imageBitmap = bitmap2,
436- modifier = modifier,
437- contentScale = ContentScale .Crop ,
438- contentDescription = null
439- )
440-
441- Spacer (modifier = Modifier .height(30 .dp))
442- Text (text = " ContentScale.FillBounds" )
443- ImageWithThumbnail (
444- imageBitmap = bitmap2,
445- modifier = modifier,
446- contentScale = ContentScale .FillBounds ,
447- contentDescription = null
448- )
449-
450- Spacer (modifier = Modifier .height(30 .dp))
451- Text (text = " ContentScale.FillWidth" )
452- ImageWithThumbnail (
453- imageBitmap = bitmap2,
454- modifier = modifier,
455- contentScale = ContentScale .FillWidth ,
456- contentDescription = null
457- )
458-
459- Spacer (modifier = Modifier .height(30 .dp))
460- Text (text = " ContentScale.FillHeight" )
461- ImageWithThumbnail (
462- imageBitmap = bitmap2,
463- modifier = modifier,
464- contentScale = ContentScale .FillHeight ,
465- contentDescription = null
466- )
467-
468- Spacer (modifier = Modifier .height(30 .dp))
469- Text (text = " ContentScale.Inside" )
470- ImageWithThumbnail (
471- imageBitmap = bitmap2,
472- modifier = modifier,
473- contentScale = ContentScale .Inside ,
474- contentDescription = null
475- )
476-
477- // Bitmap3 1000x1000
478-
479- Spacer (modifier = Modifier .height(30 .dp))
480- Text (text = " ContentScale.FillBounds" )
481- ImageWithThumbnail (
482- imageBitmap = bitmap3,
483- modifier = modifier,
484- contentScale = ContentScale .FillBounds ,
485- contentDescription = null
486- )
487-
488- Spacer (modifier = Modifier .height(30 .dp))
489- Text (text = " ContentScale.Fit" )
490- ImageWithThumbnail (
491- imageBitmap = bitmap3,
492- modifier = modifier,
493- contentScale = ContentScale .Fit ,
494- contentDescription = null
495- )
496-
497- Spacer (modifier = Modifier .height(30 .dp))
498- Text (text = " ContentScale.Crop" )
499- ImageWithThumbnail (
500- imageBitmap = bitmap3,
501- modifier = modifier,
502- contentScale = ContentScale .Crop ,
503- contentDescription = null
504- )
505310 }
506311}
507312
0 commit comments