代码之家  ›  专栏  ›  技术社区  ›  Divyesh

fImageLoading CircleTransformation无法处理透明图像

  •  0
  • Divyesh  · 技术社区  · 6 年前
    <StackLayout Grid.Row="1" Grid.Column="0" BackgroundColor="#57bcec" Padding="5" Orientation="Horizontal">
        <ContentView Padding="5,0,0,0">
            <ffimageloading:CachedImage DownsampleToViewSize="True" HorizontalOptions="Center" VerticalOptions="Center"
                                        ErrorPlaceholder="{Binding PlaceholderImage}" LoadingPlaceholder="{Binding PlaceholderImage}" 
                                        Source="{Binding UserImage, Converter={Helper:ImageSourceConverter}}"
                                        Aspect="AspectFit">
                <ffimageloading:CachedImage.WidthRequest>
                    <OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
                </ffimageloading:CachedImage.WidthRequest>
                <ffimageloading:CachedImage.HeightRequest>
                    <OnPlatform x:TypeArguments="x:Double" iOS="40" Android="40" WinPhone="40" />
                </ffimageloading:CachedImage.HeightRequest>
                <ffimageloading:CachedImage.Transformations>
                    <fftransformations:CircleTransformation BorderSize="3" BorderHexColor="#34C04E"/>
                </ffimageloading:CachedImage.Transformations>
            </ffimageloading:CachedImage>
        </ContentView>
        <ContentView Padding="10,0,0,0" VerticalOptions="FillAndExpand">
            <Label Text="Alan Parker" FontSize="14" FontFamily="{StaticResource Lato_Regular}" TextColor="White" VerticalOptions="Center" />
        </ContentView>
    </StackLayout>
    

    图像URL: https://images.app.goo.gl/ZLSN5x9VNeebTD6z8

    输出: 请注意,图像从角部被截断

    enter image description here

    enter image description here

    0 回复  |  直到 6 年前
        1
  •  0
  •   Divyesh    6 年前

    我找到了一个办法。

    https://github.com/daniel-luberda/DLToolkit.Forms.Controls/tree/master/ImageCropView

    <imgcrop:ImageCropView HeightRequest="50" WidthRequest="50" x:Name="cropView"
            Source="https://anothercommonman.files.wordpress.com/2011/10/gandhiji.jpg">
            <imgcrop:ImageCropView.PreviewTransformations>
                    <ffTransformations:CircleTransformation />
            </imgcrop:ImageCropView.PreviewTransformations>
    </imgcrop:ImageCropView> 
    
    推荐文章