2017-06-24 15 views
1

私は、アプリケーションのメインデータがロードされている間に、イメージをロードし、サイズを変更し、イメージをバックグラウンドで変換しようとしています。私はこれを行う必要があります。なぜなら、イメージの一部が大きすぎると私はそれらの多くを持っているので、私はそれを表示する前にすべてのイメージを準備することをお勧めします。Xamarin.FormsのFFImageLoadingでキャッシュされた結果を再利用する方法?

私は、バックグラウンドでこのコードを実行します。 がウリから画像をロードします。

ImageService.Instance.LoadUrl(uri, TimeSpan.FromDays(60)) 
      .DownSample(100, 100, false).Preload(); 

は同じイメージをロードし、それに追加の変換を適用:

私は後で再利用する可能性がどのように
ImageService.Instance.LoadUrl(uri, TimeSpan.FromDays(60)) 
      .DownSample(100, 100, false).Transform(BlurredTransformHere).Preload(); 

CachedImageのこれらのキャッシュクエリの結果ですか?

<forms:CachedImage 
    x:Name="Blured" 
    Aspect="Fill" 
    CacheType="All" 
    HorizontalOptions="Fill" 
    Opacity="0.3" 
    VerticalOptions="Fill"/>  

<forms:CachedImage 
    x:Name="Normal" 
    CacheType="All" 
    Aspect="AspectFit" 
    HorizontalOptions="CenterAndExpand" 
    VerticalOptions="CenterAndExpand"/> 

各CachedImageのクエリと同じ設定パラメータを追加する必要がありますか?例えば同じパラメータ値でDownsampleHeight & WとBlurredTransformationを追加しますか?

答えて

0

変換はイメージのキャッシュされたバージョンには影響しません。イメージソースのレンダリング方法が変わるだけです。

Imageプリロードの場合、DownSampleを適用し、後でCachedImageコントロールで変換を使用することができます。

<forms:CachedImage 
    x:Name="Blured" 
    Aspect="Fill" 
    CacheType="All" 
    HorizontalOptions="Fill" 
    Opacity="0.3" 
    Source="YOUR_SOURCE_URI" 
    VerticalOptions="Fill"> 
     <forms:CachedImage.Transformations> 
      <fftransformations:BlurredTransformation Radius="30"/> 
     </forms:CachedImage.Transformations> 
</forms:CachedImage> 
関連する問題