1

amaro、hudson、sepia、rise などの Instagram の写真効果を実装する必要があります。この記事では基本的な効果のみを使用していることを知っています: http://code.msdn.microsoft.com/windowsdesktop/Metro-Style-lightweight-24589f50

人々が提案する別の方法は、Direct2d を実装し、それを使用して適用することです。しかし、そのためには経験のない C++ コードを書く必要があります。

c# で Instagram エフェクトを実装する他の方法を提案できる人はいますか?

これらのエフェクト用の組み込みの C++ ファイルはありますか?

4

1 に答える 1

1

Please see this example from CodeProject : Metro Style Lightweight Image Processing

The above example contains these image effects.

  • Negative
  • Color filter
  • Emboss
  • SunLight
  • Black & White
  • Brightness
  • Oilpaint
  • Tint

Please note above example seems to be implemented on either developer preview or release preview of Windows 8. So you will get error like this

'Windows.UI.Xaml.Media.Imaging.WriteableBitmap' does not contain a constructor that takes 1 arguments

So you have to create instance of WriteableBitmap by passing pixel height and pixel width of image. I have edited the sample and it is working for me. You have to change wb = new WriteableBitmap(bs); to wb = await GetWB();

StorageFile originalImageFile;
WriteableBitmap cropBmp;
public async Task<WriteableBitmap> GetWB()
{
    if (originalImageFile != null)
    {
        //originalImageFile is the image either loaded from file or captured image.
        using (IRandomAccessStream stream = await originalImageFile.OpenReadAsync())
        {
            BitmapImage bmp = new BitmapImage();
            bmp.SetSource(stream);
            BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);
            byte[] pixels = await GetPixelData(decoder, Convert.ToUInt32(bmp.PixelWidth), Convert.ToUInt32(bmp.PixelHeight));
            cropBmp = new WriteableBitmap(bmp.PixelWidth, bmp.PixelHeight);
            Stream pixStream = cropBmp.PixelBuffer.AsStream();
            pixStream.Write(pixels, 0, (int)(bmp.PixelWidth * bmp.PixelHeight * 4));
        } 
    }
    return cropBmp;
}

Let me know if you are facing any problem.

于 2013-03-26T07:37:44.767 に答える