示例#1
0
 /**
  * Create() allocates an image data resource with the given format and size.
  *
  * For security reasons, if uninitialized, the bitmap will not contain random
  * memory, but may contain data from a previous image produced by the same
  * module if the bitmap was cached and re-used.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] format The desired image data format.
  * @param[in] size A pointer to a <code>PP_Size</code> containing the image
  * size.
  * @param[in] init_to_zero A <code>PP_Bool</code> 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.
  *
  * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
  * failure. Failure means the instance, image size, or format was invalid.
  */
 public static PPResource Create(PPInstance instance,
                                 PPImageDataFormat format,
                                 PPSize size,
                                 PPBool init_to_zero)
 {
     return(_Create(instance, format, size, init_to_zero));
 }
示例#2
0
 /// <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();
     }
 }
示例#3
0
 extern static PPResource _Create(PPInstance instance,
                                  PPImageDataFormat format,
                                  PPSize size,
                                  PPBool init_to_zero);
示例#4
0
 /**
  * IsImageDataFormatSupported() determines if the given image data format is
  * supported by the browser. Note: <code>PP_IMAGEDATAFORMAT_BGRA_PREMUL</code>
  * and <code>PP_IMAGEDATAFORMAT_RGBA_PREMUL</code> formats are always
  * supported. Other image formats do not make this guarantee, and should be
  * checked first with IsImageDataFormatSupported() before using.
  *
  * @param[in] format The image data format.
  *
  * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
  * image data format is supported by the browser.
  */
 public static PPBool IsImageDataFormatSupported(PPImageDataFormat format)
 {
     return(_IsImageDataFormatSupported(format));
 }
示例#5
0
 extern static PPBool _IsImageDataFormatSupported(PPImageDataFormat format);
示例#6
0
 /// <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);
 }