smourier/DirectN

where is the Guid pixelFormat paramater define ?

sgf opened this issue · 2 comments

sgf commented
  public static IComObject<IWICBitmap> CreateBitmap(this IComObject<IWICImagingFactory> factory, int width, int height, Guid pixelFormat, WICBitmapCreateCacheOption option = WICBitmapCreateCacheOption.WICBitmapNoCache)
   {
       return (factory?.Object).CreateBitmap(width, height, pixelFormat, option);
   }

   public static IComObject<IWICBitmap> CreateBitmap(this IWICImagingFactory factory, int width, int height, Guid pixelFormat, WICBitmapCreateCacheOption option = WICBitmapCreateCacheOption.WICBitmapNoCache)
   {
       if (factory == null)
       {
           throw new ArgumentNullException("factory");
       }

       Guid pixelFormat2 = pixelFormat;
       factory.CreateBitmap((uint)width, (uint)height, ref pixelFormat2, option, out var ppIBitmap).ThrowOnError();
       return new ComObject<IWICBitmap>(ppIBitmap);
   }

i cant find the pixelFormat

DirectN has no intelligence, it exposes bindings for exising COM objects, here IWICImagingFactory::CreateBitmap method, so you need to go to official documentation to learn how it works.

Native Pixel Formats Overview

Note in this case, DirectN also defines the pixel formats usable from .NET https://github.com/smourier/DirectN/blob/master/DirectN/DirectN/Extensions/WICConstants.cs

If you're interested by WIC interop, this project goes further in that direction: https://github.com/smourier/WicNet/ (and it's based on DirectN too)

sgf commented

thank you very much