Ejemplo n.º 1
0
        /// <summary>
        /// Construct a new MIME / Image record based on a WriteableBitmap.
        /// Specify the MIME type and DPI, and the image data is encoded accordingly.
        /// </summary>
        /// <param name="bmp">Source bitmap to use for conversion.</param>
        /// <param name="mimeType">MIME type to specify the target image encoding.</param>
        /// <param name="dpi">Optional parameter to set the DPI of the encoded image
        /// (if supported by the specific MIME type).</param>
        /// <returns>A newly constructed MIME / Image record with the WriteableBitmap
        /// encoded into the specified MIME type.</returns>
        public static async Task <NdefMimeImageRecord> CreateFromBitmap(WriteableBitmap bmp, ImageMimeType mimeType,
                                                                        double dpi = 96.0)
        {
            var imgRecord = new NdefMimeImageRecord();
            await imgRecord.SetImage(bmp, mimeType, dpi);

            return(imgRecord);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Construct a new MIME / Image record based on a WriteableBitmap.
 /// Specify the MIME type and DPI, and the image data is encoded accordingly. 
 /// </summary>
 /// <param name="bmp">Source bitmap to use for conversion.</param>
 /// <param name="mimeType">MIME type to specify the target image encoding.</param>
 /// <param name="dpi">Optional parameter to set the DPI of the encoded image
 /// (if supported by the specific MIME type).</param>
 /// <returns>A newly constructed MIME / Image record with the WriteableBitmap
 /// encoded into the specified MIME type.</returns>
 public static async Task<NdefMimeImageRecord> CreateFromBitmap(WriteableBitmap bmp, ImageMimeType mimeType,
     double dpi = 96.0)
 {
     var imgRecord = new NdefMimeImageRecord();
     await imgRecord.SetImage(bmp, mimeType, dpi);
     return imgRecord;
 }