Xamarin形式加载角点变换
我有一个UI设计,如下图所示。我正在使用FFImageLoading插件和角点变换,但我无法在图像底部制作椭圆形。我该怎么做 我正在尝试以下代码,但它不起作用Xamarin形式加载角点变换,xamarin,xamarin.forms,ffimageloading,Xamarin,Xamarin.forms,Ffimageloading,我有一个UI设计,如下图所示。我正在使用FFImageLoading插件和角点变换,但我无法在图像底部制作椭圆形。我该怎么做 我正在尝试以下代码,但它不起作用 <ffimg:CachedImage HeightRequest="225" Aspect="AspectFill" Source="https://www.ashmolean.org/sites/default/files/styles/listing
<ffimg:CachedImage HeightRequest="225"
Aspect="AspectFill"
Source="https://www.ashmolean.org/sites/default/files/styles/listing_landscape_textoverlay_left_bottom_image/public/ashmolean/images/media/cafe1.jpg?itok=RRq3Tds5">
<ffimg:CachedImage.Transformations>
<ffimgtr:CornersTransformation
BottomLeftCornerSize="40"
BottomRightCornerSize="40" />
</ffimg:CachedImage.Transformations>
</ffimg:CachedImage>
我是FFImageLoading库的初学者,但根据官方文档(您可以在此处找到:),我不确定您是否能达到您的效果。。。在我看来,最好的选择是:
- 使用一个看起来像你的转换,但实际上并不相同(我想你已经做了)。例如,你可以使用一个
,但在图片的底部中心仍然有一个直的形状段CornersTransformation
- 或者我心目中最好的解决方案:使用一个普通的正方形图像(你的标题图像),只需使用另一个作为顶层(带透明度的png),它将模拟“白色”底部椭圆形(见下面的图像示例)
<Grid>
<Grid.RowDefinitions>
<RowDefinitions Height="255" />
<RowDefinitions Height="*" />
</Grid.RowDefinitions>
<!-- your header on row 0 -->
<Grid Grid.Row="0">
<!-- HEADER Squared background image -->
<ffimg:CachedImage HeightRequest="225" Aspect="AspectFill" Source="https://www.ashmolean..." />
<!-- Top layer OVER image (the one you have to generate as PNG for the transparency) -->
<ffimg:CachedImage
HeightRequest="40
Aspect="AspectFill"
VerticalOrientation="End"
Source="myOvalShape.png"
/>
<!-- your list of header buttons inside this panel -->
<StackLayout VerticalOrientation="Start" ... />
</Grid>
...
谢谢你的回答,朱利安!我想我不能用转换来实现这一点。但我不明白我怎么能用透明的形状做到这一点。我的餐厅形象是一个正方形的形象。你能创建一个示例代码吗?也;我的背景不仅仅是任何颜色。我正在使用模式图像作为背景,并带有相对性。@OğuzKURTCUOĞLU,我更新了我的答案。检查XAML代码中的注释和图像,以了解制作顶部遮罩图像的步骤,该图像将放置在标题方形图像上。技巧是生成顶部遮罩图像(PNG),但在paint/photoshop中并不复杂。。。告诉我是否清楚