読者です 読者をやめる 読者になる 読者になる

酢ろぐ!

カレーが嫌いなスマートフォンアプリプログラマのブログ。

usage WriteableBitmapEffector

画像処理 Windows Store Apps

日本語での紹介文は こちらをご覧ください。

Sorry. I have very easy english. Please tell me if there is a place can not understand the meaning.

Has a sample application.

This library is those who want to serve you hope you will make a good looking effect in the Metro style app.

Download the source code

Has published the source code to GitHub. Please download the. Has adopted the MIT license.

usage WriteableBitmapEffector

Please add the following to the using directive.

using Softbuild.Media;

Load a picture from application resource

Using the WriteableBitmapExtensions.FromStreamAsync method to load the image in the resource.

    private async Task<WriteableBitmap> GetTestImageAsync() {
        // クラスライブラリ内の画像をリソースを読み出す
        var imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/lena.PNG"));
        // StorageFileからWriteableBitampを生成する
        return await WriteableBitmapExtensions.FromStreamAsync(await imageFile.OpenReadAsync());
    }

Resize

Using the Resize method, perform the resize.

var bitmap = await GetTestImageAsync();
var resizedBmp = bitmap.Resize(640, 480);

Effect

As of August 2012, corresponding to the following effect processing as an extension method of WriteableBitmap.

EffectNegative Method Nagetive
EffectGrayscale Method Grayscale
EffectSaturation Method Saturation
EffectContrast Method Contrast
EffectVignettingAsync Method Vignetting
EffectSepia Method Sepia
EffectPosterize Method Posterize
EffectBakumatsuAsync Method Bakumatsu
EffectToycameraAsync Method Toycamera
Bakumatsu effect

Use the EffectBakumatsuAsync method.

    private async void btnBakumatsu_Click(object sender, RoutedEventArgs e) {
        var bitmap = await GetTestImageAsync();
        imageDst.Source = await bitmap.EffectBakumatsuAsync();
    }

I run the sample code above.

Toycamera effect

Use the EffectToycameraAsync method.

    private async void btnToycamera_Click(object sender, RoutedEventArgs e) {
        var bitmap = await GetTestImageAsync();
        imageDst.Source = await bitmap.EffectToycameraAsync();
    }

I run the sample code above.