void InitData() { if (PPBImageData.Describe(this, out imageDataDesc) == PPBool.True) { imageDataPtr = PPBImageData.Map(this); } }
/// <summary> /// A constructor that allocates a new <code>ImageData</code> in the browser /// with the provided parameters. The resulting object will be IsEmpty if /// the allocation failed. /// </summary> /// <param name="instance">The instance with which this resource will be /// associated. /// </param> /// <param name="format">A PP_ImageDataFormat containing desired image format. /// PP_ImageDataFormat is an enumeration of the different types of /// image data formats. /// </param> /// <param name="size">the image size.</param> /// <param name="init_to_zero">A bool used to determine transparency at /// creation. Set the <code>init_to_zero</code> flag if you want the bitmap /// initialized to transparent during the creation process. If this flag is /// not set, the current contents of the bitmap will be undefined, and the /// module should be sure to set all the pixels. /// </param> public ImageData(Instance instance, PPImageDataFormat format, PPSize size, bool init_to_zero) { handle = PPBImageData.Create(instance, format, size, init_to_zero ? PPBool.True : PPBool.False); if (PPBImageData.IsImageData(handle) == PPBool.True) { InitData(); } }
/// <summary> /// IsImageDataFormatSupported() returns <code>true</code> if the supplied /// format is supported by the browser. Note: /// <code>BGRA_PREMUL</code> and /// <code>RGBA_PREMUL</code> formats are always supported. /// Other image formats do not make this guarantee, and should be checked /// first with IsImageDataFormatSupported() before using. /// </summary> /// <param name="format">Image data format.</param> /// <returns></returns> public static bool IsImageDataFormatSupported(PPImageDataFormat format) { return(PPBImageData.IsImageDataFormatSupported(format) == PPBool.True ? true : false); }