| ofs | hex dump | ascii |
|---|
| 0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 01 00 00 00 01 00 08 06 00 00 00 5c 72 a8 | .PNG........IHDR.............\r. |
| 0020 | 66 00 00 00 04 73 42 49 54 08 08 08 08 7c 08 64 88 00 00 00 09 70 48 59 73 00 00 06 ec 00 00 06 | f....sBIT....|.d.....pHYs....... |
| 0040 | ec 01 1e 75 38 35 00 00 00 19 74 45 58 74 53 6f 66 74 77 61 72 65 00 77 77 77 2e 69 6e 6b 73 63 | ...u85....tEXtSoftware.www.inksc |
| 0060 | 61 70 65 2e 6f 72 67 9b ee 3c 1a 00 00 20 00 49 44 41 54 78 9c ec 9d 77 98 5b d5 99 b8 df db d4 | ape.org..<.....IDATx...w.[...... |
| 0080 | a6 cf d8 33 ae 18 1b 5c b1 b1 45 68 a6 18 43 08 25 24 f4 1a 52 21 95 24 b3 bf 25 3d 90 4d 36 85 | ...3...\..Eh..C.%$..R!.$..%=.M6. |
| 00a0 | 4d 83 24 03 a4 b1 10 16 08 a1 18 42 87 d0 4c 35 35 88 6a 03 06 db 18 f7 e9 33 ea ba e5 f7 c7 d5 | M.$........B..L55.j......3...... |
| 00c0 | 8c ed 29 ba 57 d2 51 99 b1 de e7 99 67 c3 5a 3a e7 48 ba df 77 be f3 9d af 48 96 65 51 61 ec d2 | ..).W.Q.....g.Z:.H..w....H.eQa.. |
| 00e0 | 16 0a c9 c0 0c 60 2e d0 02 d4 ec f2 57 3d e4 bf 47 fa ff 03 f4 a7 ff c2 bb fc ef fe 0c ff ff ed | .....`......W=..G............... |
| 0100 | c0 3b c0 07 ad c1 a0 59 e8 cf 58 a1 70 48 15 05 30 36 68 0b 85 ea b0 85 7c e8 df 6c c0 57 a2 65 | .;.....Y..X.pH..06h.....|..l.W.e |
| 0120 | c5 81 b5 d8 ca 60 b7 bf d6 60 b0 b7 44 6b aa 90 05 15 05 50 66 b4 85 42 2a 70 20 70 18 30 8f 9d | .....`...`..Dk.....Pf..B*p.p.0.. |
| 0140 | 82 de 52 ca 75 e5 c0 80 95 f0 0e f0 36 b0 0a 78 b9 35 18 d4 4b ba aa 0a bb 51 51 00 25 26 6d c2 | ..R.u.......6..x.5..K....QQ.%&m. |
| 0160 | 2f 06 8e 49 ff 1d c9 4e d3 7c bc d1 0f 3c 0d 3c 9e fe 7b ad 72 84 28 2d 15 05 50 02 da 42 a1 05 | /..I...N.|...<.<..{.r.(-..P..B.. |
| 0180 | d8 c2 7e 34 b0 1c 68 2c e9 82 4a 47 17 f0 04 b0 12 78 bc 35 18 5c 5d da e5 ec 79 54 14 40 11 68 | ..~4..h,..JG.....x.5.\]...yT.@.h |
| 01a0 | 0b 85 26 03 9f c0 16 f8 a3 81 49 a5 5d 51 d9 b2 0d 5b 19 ac 04 ee 6b 0d 06 b7 96 78 3d e3 9e 8a | ..&.......I.]Q...[....k....x=... |
| 01c0 | 02 28 10 6d a1 50 00 38 15 f8 2c 70 2c a0 94 76 45 63 0e 03 78 14 b8 01 b8 ab 35 18 8c 96 78 3d | .(.m.P.8..,p,..vEc..x.....5...x= |
| 01e0 | e3 92 8a 02 10 48 5b 28 24 61 9b f4 9f 05 ce 60 fc 9e e5 8b 4d 3f 70 07 b6 32 78 a2 35 18 ac 3c | .....H[($a.....`....M?p..2x.5..< |
| 0200 | b4 82 a8 28 00 01 b4 85 42 73 b1 85 fe d3 c0 5e 25 5e ce 78 67 23 70 13 70 43 6b 30 f8 4e a9 17 | ...(....Bs.....^%^.xg#p.pCk0.N.. |
| 0220 | 33 d6 a9 28 80 1c 69 0b 85 9a 80 73 b1 05 ff e0 12 2f 67 4f e5 45 6c ab e0 96 d6 60 b0 b3 d4 8b | 3..(..i....s...../gO.El....`.... |
| 0240 | 19 8b 54 14 40 96 b4 85 42 fb 00 df c7 16 7c 4f 89 97 53 c1 26 89 ad 08 7e d9 1a 0c be 5f ea c5 | ..T.@...B.....|O..S.&...~...._.. |
| 0260 | 8c 25 2a 0a c0 25 6d a1 d0 7e c0 0f 81 73 a8 38 f4 ca 15 03 b8 15 b8 ac 35 18 7c ab d4 8b 19 0b | .%*..%m..~...s.8........5.|..... |
| 0280 | 54 14 80 03 6d a1 d0 81 c0 25 c0 29 80 54 e2 e5 54 70 87 05 dc 0d fc a2 35 18 7c b9 d4 8b 29 67 | T...m....%.).T..Tp......5.|...)g |
| 02a0 | 2a 0a 60 14 da 42 a1 65 d8 82 7f 5c a9 d7 52 21 2f 1e c6 56 04 4f 95 7a 21 e5 48 45 01 0c a1 2d | *.`..B.e...\..R!/..V.O.z!.HE...- |
| 02c0 | 14 3a 01 5b f0 8f 28 f5 5a 2a 08 e5 19 6c 45 f0 50 a9 17 52 4e 54 14 40 9a b6 50 e8 18 e0 37 c0 | .:.[..(.Z*...lE.P..RNT.@..P...7. |
| 02e0 | 01 a5 5e 4b 85 82 f2 0a f0 9d d6 60 f0 f1 52 2f a4 1c d8 e3 15 40 5b 28 34 09 b8 1c f8 54 a9 d7 | ..^K.......`..R/.....@[(4....T.. |
| 0300 | 52 a1 a8 dc 0c 7c ab 35 18 dc 56 ea 85 94 92 3d 56 01 b4 85 42 0a 70 11 f0 73 a0 b6 c4 cb 29 28 | R....|.5..V....=V...B.p..s....)( |
| 0320 | 32 06 1a 09 3c 52 02 0f 09 b4 f4 9f 47 4a 00 90 b4 bc a4 b0 ff 92 78 07 ff db 1c ff 97 1d 7d c0 | 2...<R......GJ........x.......}. |
| 0340 | a5 c0 1f 5b 83 41 a3 d4 8b 29 05 7b a4 02 68 0b 85 0e 01 fe 04 04 4b bd 96 7c 90 b0 a8 91 ba 68 | ...[.A...).{..h.......K..|.....h |
| 0360 | 60 07 0d d2 ce 3f 1f 51 5b d0 a5 38 1e 12 28 e4 96 82 6f a0 92 c4 4b ca f2 91 c4 4b 9c 00 3d 56 | `....?.Q[..8..(...o...K....K..=V |
| 0380 | 33 5d 56 33 dd 56 33 dd 34 d3 6f 35 62 8d fd cb 91 10 f0 b5 d6 60 f0 85 52 2f a4 d8 ec 51 0a a0 | 3]V3.V3.4.o5b........`..R/...Q.. |
| 03a0 | 2d 14 6a 04 fe 07 f8 12 63 e8 4a 4f 23 49 a3 b4 6d a7 90 a7 05 be 5e 6a cf 59 b8 45 61 a0 d2 63 | -.j.....c.JO#I..m.....^j.Y.Ea..c |
| 03c0 | 4d 1c 54 08 dd 69 e5 d0 65 4d 22 35 b6 e2 a4 2c e0 1a e0 07 ad c1 60 57 a9 17 53 2c f6 08 05 90 | M.T..i..eM"5...,......`W..S,.... |
| 03e0 | 4e d2 f9 3c f0 6b 60 42 69 57 e3 8c 82 ce 64 69 03 d3 e5 b5 4c 93 d6 d2 22 7d 80 cc d8 aa 9b 61 | N..<.k`BiW....di....L..."}.....a |
| 0400 | 22 b3 dd 9a c1 26 6b 36 1f 9a b3 d9 6a ed 8d 81 5a ea 65 b9 a1 03 f8 2e 70 fd 9e 90 74 34 ee 15 | "....&k6....j...Z.e.....p...t4.. |
| 0420 | 40 5b 28 b4 08 db dc 3f bc d4 6b 19 0d 19 93 16 e9 03 a6 49 6b 99 2e af 65 b2 b4 a1 e4 3b bb 68 | @[(....?..k........Ik...e....;.h |
| 0440 | 0c 54 b6 5a 7b f3 a1 39 9b 4d d6 6c b6 5b 33 30 91 4b bd ac 4c 3c 8b 7d 2c 78 a3 d4 0b 29 24 e3 | .T.Z{..9.M.l.[30.K..L<.},x...)$. |
| 0460 | 5a 01 b4 85 42 df c0 f6 f0 97 9d 2d 5a 2b 75 b2 af f4 3a d3 e5 b5 4c 91 d6 a1 91 28 f5 92 8a 4a | Z...B......-Z+u...:...L....(...J |
| 0480 | 0a 2f 5b ac 59 7c 68 ce e6 3d 6b 7f fa ac a6 52 2f 69 24 92 d8 37 05 57 95 7a 21 85 62 5c 2a 80 | ./[.Y|h..=k....R/i$..7.W.z!.b\*. |
| 04a0 | b6 50 a8 1e b8 16 38 bd d4 6b d9 15 2f 31 66 cb af 32 4f 7e 99 29 d2 7a ec 63 67 05 90 d8 62 cd | pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */#region Header
//
// Project: WriteableBitmapEx - WriteableBitmap extensions
// Description: Collection of extension methods for the WriteableBitmap class.
//
// Changed by: $Author: unknown $
// Changed on: $Date: 2015-03-05 18:18:24 +0100 (Do, 05 Mrz 2015) $
// Changed in: $Revision: 113191 $
// Project: $URL: https://writeablebitmapex.svn.codeplex.com/svn/trunk/Source/WriteableBitmapEx/BitmapFactory.cs $
// Id: $Id: BitmapFactory.cs 113191 2015-03-05 17:18:24Z unknown $
//
//
// Copyright © 2009-2015 Rene Schulte and WriteableBitmapEx Contributors
//
// This code is open source. Please read the License.txt for details. No worries, we won't sue you! ;)
//
#endregion
using System;
using System.IO;
using System.Reflection;
#if NETFX_CORE
using Windows.Storage;
using Windows.Storage.Streams;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using System.Runtime.InteropServices.WindowsRuntime;
namespace Windows.UI.Xaml.Media.Imaging
#else
namespace System.Windows.Media.Imaging
#endif
{
/// <summary>
/// Cross-platform factory for WriteableBitmaps
/// </summary>
internal static class BitmapFactory
{
/// <summary>
/// Creates a new WriteableBitmap of the specified width and height
/// </summary>
/// <remarks>For WPF the default DPI is 96x96 and PixelFormat is Pbgra32</remarks>
/// <param name="pixelWidth"></param>
/// <param name="pixelHeight"></param>
/// <returns></returns>
internal static WriteableBitmap New(int pixelWidth, int pixelHeight)
{
if (pixelHeight < 1) pixelHeight = 1;
if (pixelWidth < 1) pixelWidth = 1;
#if SILVERLIGHT
return new WriteableBitmap(pixelWidth, pixelHeight);
#elif WPF
return new WriteableBitmap(pixelWidth, pixelHeight, 96.0, 96.0, PixelFormats.Pbgra32, null);
#elif NETFX_CORE
return new WriteableBitmap(pixelWidth, pixelHeight);
#endif
}
#if WPF
/// <summary>
/// Converts the input BitmapSource to the Pbgra32 format WriteableBitmap which is internally used by the WriteableBitmapEx.
/// </summary>
/// <param name="source">The source bitmap.</param>
/// <returns></returns>
internal static WriteableBitmap ConvertToPbgra32Format(BitmapSource source)
{
// Convert to Pbgra32 if it's a different format
if (source.Format == PixelFormats.Pbgra32)
{
return new WriteableBitmap(source);
}
var formatedBitmapSource = new FormatConvertedBitmap();
formatedBitmapSource.BeginInit();
formatedBitmapSource.Source = source;
formatedBitmapSource.DestinationFormat = PixelFormats.Pbgra32;
formatedBitmapSource.EndInit();
return new WriteableBitmap(formatedBitmapSource);
}
#endif
#if NETFX_CORE
/// <summary>
/// Loads an image from the applications content and returns a new WriteableBitmap.
/// </summary>
/// <param name="uri">The URI to the content file.</param>
/// <param name="pixelFormat">The pixel format of the stream data. If Unknown is provided as param, the default format of the BitmapDecoder is used.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static async Task<WriteableBitmap> FromContent(Uri uri, BitmapPixelFormat pixelFormat = BitmapPixelFormat.Unknown)
{
// Decode pixel data
var file = await StorageFile.GetFileFromApplicationUriAsync(uri);
using (var stream = await file.OpenAsync(FileAccessMode.Read))
{
return await FromStream(stream);
}
}
/// <summary>
/// Loads the data from an image stream and returns a new WriteableBitmap.
/// </summary>
/// <param name="stream">The stream with the image data.</param>
/// <param name="pixelFormat">The pixel format of the stream data. If Unknown is provided as param, the default format of the BitmapDecoder is used.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static async Task<WriteableBitmap> FromStream(Stream stream, BitmapPixelFormat pixelFormat = BitmapPixelFormat.Unknown)
{
using (var dstStream = new InMemoryRandomAccessStream())
{
await RandomAccessStream.CopyAsync(stream.AsInputStream(), dstStream);
return await FromStream(dstStream);
}
}
/// <summary>
/// Loads the data from an image stream and returns a new WriteableBitmap.
/// </summary>
/// <param name="stream">The stream with the image data.</param>
/// <param name="pixelFormat">The pixel format of the stream data. If Unknown is provided as param, the default format of the BitmapDecoder is used.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static async Task<WriteableBitmap> FromStream(IRandomAccessStream stream, BitmapPixelFormat pixelFormat = BitmapPixelFormat.Unknown)
{
var decoder = await BitmapDecoder.CreateAsync(stream);
var transform = new BitmapTransform();
if (pixelFormat == BitmapPixelFormat.Unknown)
{
pixelFormat = decoder.BitmapPixelFormat;
}
var pixelData = await decoder.GetPixelDataAsync(pixelFormat, decoder.BitmapAlphaMode, transform, ExifOrientationMode.RespectExifOrientation, ColorManagementMode.ColorManageToSRgb);
var pixels = pixelData.DetachPixelData();
// Copy to WriteableBitmap
var bmp = new WriteableBitmap((int)decoder.OrientedPixelWidth, (int)decoder.OrientedPixelHeight);
using (var bmpStream = bmp.PixelBuffer.AsStream())
{
bmpStream.Seek(0, SeekOrigin.Begin);
bmpStream.Write(pixels, 0, (int)bmpStream.Length);
return bmp;
}
}
/// <summary>
/// Loads the data from a pixel buffer like the RenderTargetBitmap provides and returns a new WriteableBitmap.
/// </summary>
/// <param name="pixelBuffer">The source pixel buffer with the image data.</param>
/// <param name="width">The width of the image data.</param>
/// <param name="height">The height of the image data.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static async Task<WriteableBitmap> FromPixelBuffer(IBuffer pixelBuffer, int width, int height)
{
// Copy to WriteableBitmap
var bmp = new WriteableBitmap(width, height);
using (var srcStream = pixelBuffer.AsStream())
{
using (var destStream = bmp.PixelBuffer.AsStream())
{
srcStream.Seek(0, SeekOrigin.Begin);
await srcStream.CopyToAsync(destStream);
}
return bmp;
}
}
#else
/// <summary>
/// Loads an image from the applications resource file and returns a new WriteableBitmap.
/// </summary>
/// <param name="relativePath">Only the relative path to the resource file. The assembly name is retrieved automatically.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static WriteableBitmap FromResource(string relativePath)
{
var fullName = Assembly.GetCallingAssembly().FullName;
var asmName = new AssemblyName(fullName).Name;
return FromContent(asmName + ";component/" + relativePath);
}
/// <summary>
/// Loads an image from the applications content and returns a new WriteableBitmap.
/// </summary>
/// <param name="relativePath">Only the relative path to the content file.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static WriteableBitmap FromContent(string relativePath)
{
using (var bmpStream = Application.GetResourceStream(new Uri(relativePath, UriKind.Relative)).Stream)
{
return FromStream(bmpStream);
}
}
/// <summary>
/// Loads the data from an image stream and returns a new WriteableBitmap.
/// </summary>
/// <param name="stream">The stream with the image data.</param>
/// <returns>A new WriteableBitmap containing the pixel data.</returns>
internal static WriteableBitmap FromStream(Stream stream)
{
var bmpi = new BitmapImage();
#if SILVERLIGHT
bmpi.SetSource(stream);
bmpi.CreateOptions = BitmapCreateOptions.None;
#elif WPF
bmpi.BeginInit();
bmpi.CreateOptions = BitmapCreateOptions.None;
bmpi.StreamSource = stream;
bmpi.EndInit();
#endif
var bmp = new WriteableBitmap(bmpi);
bmpi.UriSource = null;
return bmp;
}
#endif
}
}
|