酢ろぐ!

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

usage WriteableBitmapEffector

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

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.

-GitHub - CH3COOH/Softbuild.Media: WriteableBitmapEffector is WriteableBitmap Effector for Windows Store apps and Windows Phone.

**usage WriteableBitmapEffector

Please add the following to the using directive.

|cs| using Softbuild.Media; ||<

**Load a picture from application resource

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

|cs| private async Task 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.

|cs| 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.

|cs| 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.

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

I run the sample code above.

**Related article

-WindowsストアアプリでIRandomAccessStream型のストリームからWriteableBitmapオブジェクトへ変換する - 酢ろぐ! -ネガティブ(ネガポジ反転)変換 - 酢ろぐ! -グレースケール変換 - 酢ろぐ! -セピア調変換 - 酢ろぐ! -コントラスト調整 - 酢ろぐ!