Ejemplo n.º 1
0
        public static PlatformBitmap From(Stream bitmapStream, bool isOpaque)
        {
            if (Environment.OSVersion.Platform == PlatformID.WinCE && !isOpaque)
            {
                //return new StandardBitmap(OptimizeBitmap(bitmapStream));

                if (myImagingFactory == null)
                    myImagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
                byte[] bytes = new byte[bitmapStream.Length];
                bitmapStream.Read(bytes, 0, (int)bitmapStream.Length);
                IImage imagingResource;
                uint hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint)bitmapStream.Length, BufferDisposalFlag.BufferDisposalFlagNone, out imagingResource);

                IBitmapImage bitmap;
                myImagingFactory.CreateBitmapFromImage(imagingResource, 0, 0, PixelFormatID.PixelFormat32bppARGB, InterpolationHint.InterpolationHintDefault, out bitmap);
                Marshal.FinalReleaseComObject(imagingResource);
                imagingResource = bitmap as IImage;

                return new WindowsCEBitmap(imagingResource);
            }
            else
            {
                return new StandardBitmap(bitmapStream);
            }
        }
Ejemplo n.º 2
0
        public static IImagingFactory GetImaging()
        {
            if (factory == null)
            {
                factory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
            }

            return factory;
        }
Ejemplo n.º 3
0
        public SkinManager(string skinFolderPath, int dpi)
        {
            if (string.IsNullOrEmpty(skinFolderPath))
                skinFolderPath = Configuration.SystemConfiguration.AppInstallPath;

            _imageCache = new Dictionary<string, IImage>();
            _skinFolderPath = skinFolderPath;
            _subDataPrefix = dpi < 192 ? "96" : "192";
            _skinInitialized = false;
            _imagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
            _imageList = new Dictionary<string, EntryPoint>();
        }
Ejemplo n.º 4
0
        protected void ChangeImage()
        {
            if (this._picture != null)
            {
                this._picture = null;
            }
            try
            {
                IImagingFactory factory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
                factory.CreateImageFromFile(this.Image, out this._picture);
                this.thumb = null;
            }
            catch
            {
                return;
            }

            this.Refresh();
        }
Ejemplo n.º 5
0
        public WinCEImagingBitmap(Stream stream)
        {
            // this class should only be used in WinCE
            System.Diagnostics.Debug.Assert(Environment.OSVersion.Platform == PlatformID.WinCE);

            if (myImagingFactory == null)
            {
                myImagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
            }

            int bytesLength;

            byte[]       bytes;
            MemoryStream memStream = stream as MemoryStream;

            if (memStream != null)
            {
                bytesLength = (int)memStream.Length;
                bytes       = memStream.GetBuffer();
            }
            else
            {
                bytesLength = (int)stream.Length;
                bytes       = new byte[bytesLength];
                stream.Read(bytes, 0, bytesLength);
            }

            uint hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint)bytesLength, BufferDisposalFlag.BufferDisposalFlagNone, out myImage);

            myImage.GetImageInfo(out myInfo);
            myScaleFactorX = 1 / myInfo.Xdpi * 2540;
            myScaleFactorY = 1 / myInfo.Ydpi * 2540;

            IBitmapImage bitmap;

            myImagingFactory.CreateBitmapFromImage(myImage, 0, 0, PixelFormatID.PixelFormat32bppARGB, InterpolationHint.InterpolationHintDefault, out bitmap);
            Marshal.FinalReleaseComObject(myImage);
            myImage = bitmap as IImage;
        }
Ejemplo n.º 6
0
 public static IBitmapSource CreateFormatConvertedBitmap(this IImagingFactory factory, IBitmapSource source, PixelFormat dstFormat) =>
 factory.CreateFormatConvertedBitmap(source, dstFormat, BitmapDitherType.None, null, 0.0, BitmapPaletteType.Custom);
Ejemplo n.º 7
0
 public static IBitmapSource <TPixel> CreateFormatConvertedBitmap <TPixel>(this IImagingFactory factory, IBitmapSource source) where TPixel : struct, INaturalPixelInfo =>
 factory.CreateFormatConvertedBitmap <TPixel>(source, BitmapDitherType.None, null, 0.0, BitmapPaletteType.Custom);
Ejemplo n.º 8
0
 public static IBitmapSource <TPixel> CreateBufferedBitmap <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, IBitmap <TPixel> buffer = null, int maxBufferHeightLog2 = 7) where TPixel : struct, INaturalPixelInfo =>
 ((IBitmapSource <TPixel>)factory.CreateBufferedBitmap(source, buffer, maxBufferHeightLog2));
Ejemplo n.º 9
0
        protected override List <NativeItemData> BuildNativeControlItems()
        {
            var retVal = new List <NativeItemData>(Items.Count);

            if (Items != null)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    IImagingFactory newImagingFactory = ImagingFactory.GetImaging();

                    IImage newIImage;

                    if (Items[i].IsAvatarLoaded)
                    {
                        newImagingFactory.CreateImageFromFile(Items[i].Avatar, out newIImage);
                    }
                    else
                    {
                        newIImage = MasterForm.SkinManager.GetImage("AvatarStub");
                    }

                    NativeItemData newNativeItemData = new KineticListView <WallPostListViewItem> .NativeItemData
                    {
                        PrimaryText   = Items[i].UserName,
                        SecondaryText = Items[i].Status,
                        TertiaryText  = Items[i].StatusChangeDate,

                        PrimaryImage = newIImage,

                        InfoLeftIndents = new int[2],
                        InfoTopIndents  = new int[1]
                    };

                    retVal.Add(newNativeItemData);
                }
            }

            #region старая версия
            //if (Items != null)
            //{
            //    for (int i = 0; i < Items.Count; i++)
            //    {
            //        IImagingFactory iImagingFactory = ImagingFactory.GetImaging();

            //        //Привязка аватарки пользователя, если она еще не загружена, выводится заглушка
            //        IImage primaryImage;
            //        if (Items[i].IsAvatarLoaded)
            //            iImagingFactory.CreateImageFromFile(Items[i].Avatar, out primaryImage);
            //        else
            //            primaryImage = MasterForm.SkinManager.GetImage("AvatarStub");

            //        //Значек подарка или online
            //        /*
            //        IImage secondaryImage;
            //        if (Items[i].IsBirthday)
            //            secondaryImage = MasterForm.SkinManager.GetImage("Birthday");
            //        else if (Items[i].StatusOnline)
            //            secondaryImage = MasterForm.SkinManager.GetImage("Online");
            //        else secondaryImage = null;
            //        */

            //        //Статус пользователя
            //        string status = Items[i].Status;
            //        NativeItemData data = new NativeItemData
            //        {
            //            PrimaryText = Items[i].Name,
            //            SecondaryText = status,
            //            Tag = Items[i].Name,
            //            PrimaryImage = primaryImage,
            //            //SecondaryImage = secondaryImage,
            //            InfoLeftIndents = new int[2],
            //            InfoTopIndents = new int[1]
            //        };
            //        retVal.Add(data);
            //    }
            //}
            #endregion

            return(retVal);
        }
Ejemplo n.º 10
0
        public WinCEImagingBitmap(Stream stream)
        {
            // this class should only be used in WinCE
            System.Diagnostics.Debug.Assert(Environment.OSVersion.Platform == PlatformID.WinCE);

            if (myImagingFactory == null)
                myImagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));

            int bytesLength;
            byte[] bytes;
            MemoryStream memStream = stream as MemoryStream;
            if (memStream != null)
            {
                bytesLength = (int)memStream.Length;
                bytes = memStream.GetBuffer();
            }
            else
            {
                bytesLength = (int)stream.Length;
                bytes = new byte[bytesLength];
                stream.Read(bytes, 0, bytesLength);
            }

            uint hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint)bytesLength, BufferDisposalFlag.BufferDisposalFlagNone, out myImage);
            myImage.GetImageInfo(out myInfo);
            myScaleFactorX = 1 / myInfo.Xdpi * 2540;
            myScaleFactorY = 1 / myInfo.Ydpi * 2540;

            IBitmapImage bitmap;
            myImagingFactory.CreateBitmapFromImage(myImage, 0, 0, PixelFormatID.PixelFormat32bppARGB, InterpolationHint.InterpolationHintDefault, out bitmap);
            Marshal.FinalReleaseComObject(myImage);
            myImage = bitmap as IImage;
        }
Ejemplo n.º 11
0
 public WinImageProvider()
 {
     _factory = GetIImageFactory();
 }
Ejemplo n.º 12
0
 public static IBitmap <TPixel> CreateBitmap <TPixel>(this IImagingFactory factory, SizeInt32 size, BitmapCreateCacheOption option = 2) where TPixel : struct, INaturalPixelInfo =>
 factory.CreateBitmap <TPixel>(size.width, size.height, option);
Ejemplo n.º 13
0
        public static IBitmap <TPixel> CreateBitmap <TPixel>(this IImagingFactory factory, int width, int height, BitmapCreateCacheOption option = 2) where TPixel : struct, INaturalPixelInfo
        {
            TPixel local = default(TPixel);

            return((IBitmap <TPixel>)factory.CreateBitmap(width, height, local.PixelFormat, option));
        }
Ejemplo n.º 14
0
 public static IImagingFactory CreateRef(this IImagingFactory objectRef) =>
 ((IImagingFactory)objectRef.CreateRef(typeof(IImagingFactory)));
Ejemplo n.º 15
0
        public static unsafe BitmapLoadData BeginLoadBitmap(Stream bitmapStream, bool isTransparent)
        {
            // .NET CF does NOT support transparent images. Need to use the COM IImageFactory to create images with alpha.
            if (myImagingFactory == null)
                myImagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));

            int bytesLength;
            byte[] bytes;
            MemoryStream memStream = bitmapStream as MemoryStream;
            if (memStream != null)
            {
                bytesLength = (int)memStream.Length;
                bytes = memStream.GetBuffer();
            }
            else
            {
                bytesLength = (int)bitmapStream.Length;
                bytes = new byte[bytesLength];
                bitmapStream.Read(bytes, 0, bytesLength);
            }

            IImage image;
            ImageInfo info;
            uint hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint)bytesLength, BufferDisposalFlag.BufferDisposalFlagNone, out image);
            image.GetImageInfo(out info);

            int resizedWidth = (int)info.Width;
            int resizedHeight = (int)info.Height;

            resizedWidth = Texture.GetValidTextureDimensionFromSize(resizedWidth);
            resizedHeight = Texture.GetValidTextureDimensionFromSize(resizedHeight);

            int resizedDim = Math.Max(resizedWidth, resizedHeight);
            if (resizedDim == (int)info.Width && resizedDim == (int)info.Height)
            {
                resizedWidth = 0;
                resizedHeight = 0;
            }
            else
            {
                resizedWidth = resizedDim;
                resizedHeight = resizedDim;
            }

            IBitmapImage bitmap;
            myImagingFactory.CreateBitmapFromImage(image, (uint)resizedWidth, (uint)resizedHeight, PixelFormatID.PixelFormatDontCare, InterpolationHint.InterpolationHintDefault, out bitmap);
            Marshal.FinalReleaseComObject(image);

            Size size;
            bitmap.GetSize(out size);
            RECT rect = new RECT(0, 0, size.Width, size.Height);
            BitmapImageData data;
            if (isTransparent)
            {
                bitmap.LockBits(ref rect, ImageLockMode.ImageLockModeWrite | ImageLockMode.ImageLockModeRead, PixelFormatID.PixelFormat32bppARGB, out data);
                for (int y = 0; y < data.Height; y++)
                {
                    for (int x = 0; x < data.Stride; x += 4)
                    {
                        byte* bp = (byte*)data.Scan0 + data.Stride * y + x;
                        byte temp = bp[0];
                        bp[0] = bp[2];
                        bp[2] = temp;
                    }
                }
            }
            else
            {
                bitmap.LockBits(ref rect, ImageLockMode.ImageLockModeRead, PixelFormatID.PixelFormat16bppRGB565, out data);
            }

            BitmapLoadData ret = new BitmapLoadData();
            ret.Data = data;
            ret.Bitmap = bitmap;
            ret.Width = (int)info.Width;
            ret.Height = (int)info.Height;
            ret.IsTransparent = isTransparent;

            return ret;
        }
Ejemplo n.º 16
0
        public static IBitmapSource <TPixel> CreateFormatConvertedBitmap <TPixel>(this IImagingFactory factory, IBitmapSource source, BitmapDitherType dither, IPalette palette, double alphaThresholdPercent, BitmapPaletteType paletteTranslate) where TPixel : struct, INaturalPixelInfo
        {
            TPixel local = default(TPixel);

            return((IBitmapSource <TPixel>)factory.CreateFormatConvertedBitmap(source, local.PixelFormat, dither, palette, alphaThresholdPercent, paletteTranslate));
        }
Ejemplo n.º 17
0
 public static int GetBufferBitmapHeight(this IImagingFactory factory, IBitmapSource source, int maxBufferHeightLog2 = 7) =>
 Math.Min(((int)1) << maxBufferHeightLog2, source.Size.Height);
Ejemplo n.º 18
0
 public static IBitmapSource <TPixel> CreateBitmapClipper <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, RectInt32 rect) where TPixel : struct, INaturalPixelInfo =>
 ((IBitmapSource <TPixel>)factory.CreateBitmapClipper(source, rect));
Ejemplo n.º 19
0
 public AndroidImageProvider()
 {
     _factory = new AndroidImagingFactory();
 }
Ejemplo n.º 20
0
 public static IBitmapSource <TPixel> CreateBitmapFlipRotator <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, BitmapTransformOptions options) where TPixel : struct, INaturalPixelInfo =>
 ((IBitmapSource <TPixel>)factory.CreateBitmapFlipRotator(source, options));
Ejemplo n.º 21
0
        private unsafe void RenderTileWorkItem(PointInt32 tileOffset)
        {
            IBitmap <ColorPbgra32> bitmap;
            bool      isCancelled = false;
            bool      flag        = false;
            Exception error       = null;

            isCancelled |= this.IsTileRenderingCancelled(tileOffset);
            if (isCancelled)
            {
                bitmap = null;
            }
            else
            {
                RectInt32 tileSourceRect = this.tileMathHelper.GetTileSourceRect(tileOffset);
                SizeInt32 tileBufferSize = this.GetTileBufferSize(tileOffset);
                bitmap = RetryManager.Eval <IBitmap <ColorPbgra32> >(3, () => BitmapAllocator.Pbgra32.Allocate(tileBufferSize, AllocationOptions.Default), delegate(Exception _) {
                    CleanupManager.RequestCleanup();
                    Thread.Sleep(200);
                    CleanupManager.WaitForPendingCleanup();
                }, delegate(AggregateException ex) {
                    throw new AggregateException($"could not allocate a bitmap of size {tileBufferSize.Width} x {tileBufferSize.Height}", ex).Flatten();
                });
                if (this.source != null)
                {
                    try
                    {
                        isCancelled |= this.IsTileRenderingCancelled(tileOffset);
                        if (!isCancelled)
                        {
                            using (IBitmapLock <ColorPbgra32> @lock = bitmap.Lock <ColorPbgra32>(BitmapLockOptions.ReadWrite))
                            {
                                if (this.mipLevel == 0)
                                {
                                    this.source.CopyPixels(new RectInt32?(tileSourceRect), @lock);
                                    RenderingKernels.ConvertBgra32ToPbgra32((uint *)@lock.Scan0, tileBufferSize.Width, tileBufferSize.Height, @lock.Stride);
                                    flag = true;
                                }
                                else
                                {
                                    BitmapInterpolationMode linear;
                                    if (!this.isHighQuality)
                                    {
                                        linear = BitmapInterpolationMode.Linear;
                                    }
                                    else if (this.mipLevel == 1)
                                    {
                                        linear = BitmapInterpolationMode.Linear;
                                    }
                                    else
                                    {
                                        linear = BitmapInterpolationMode.Fant;
                                    }
                                    IImagingFactory    instance    = ImagingFactory.Instance;
                                    ICancellationToken cancelToken = CancellationTokenUtil.Create((Func <bool>)(() => (isCancelled | this.IsTileRenderingCancelled(tileOffset))));
                                    int copyHeightLog2             = Math.Max(3, 7 - this.mipLevel);
                                    using (ClippedBitmapSource <ColorBgra32> source2 = new ClippedBitmapSource <ColorBgra32>(this.source, tileSourceRect))
                                    {
                                        using (CancellableBitmapSource <ColorBgra32> source3 = new CancellableBitmapSource <ColorBgra32>(source2, r => this.tileMathHelper.EnumerateTilesClippedToSourceRect(r), null, cancelToken))
                                        {
                                            using (IBitmapSource <ColorPbgra32> source4 = CreateBufferedTileScaler(instance, source3, tileBufferSize.Width, tileBufferSize.Height, linear))
                                            {
                                                using (CancellableBitmapSource <ColorPbgra32> source5 = new CancellableBitmapSource <ColorPbgra32>(source4, r => TileRectSplitter(r, ((int)1) << copyHeightLog2), null, cancelToken))
                                                {
                                                    try
                                                    {
                                                        source5.CopyPixels <ColorPbgra32>(@lock);
                                                        flag = true;
                                                    }
                                                    catch (OperationCanceledException exception2)
                                                    {
                                                        error       = exception2;
                                                        isCancelled = true;
                                                    }
                                                    catch (Exception exception3)
                                                    {
                                                        error = exception3;
                                                        throw;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                isCancelled |= this.IsTileRenderingCancelled(tileOffset);
                                if (isCancelled)
                                {
                                    flag = false;
                                }
                            }
                            if (!flag)
                            {
                                DisposableUtil.Free <IBitmap <ColorPbgra32> >(ref bitmap);
                            }
                        }
                    }
                    catch (OperationCanceledException exception4)
                    {
                        error       = exception4;
                        isCancelled = true;
                    }
                    catch (Exception exception5)
                    {
                        error        = exception5;
                        isCancelled |= this.IsTileRenderingCancelled(tileOffset);
                        if (!isCancelled)
                        {
                            using (IDrawingContext context = DrawingContext.FromBitmap(bitmap, FactorySource.PerThread))
                            {
                                context.Clear(new ColorRgba128Float?((ColorRgba128Float)Colors.White));
                                string text = exception5.ToString();
                                using (ISystemFonts fonts = new SystemFonts(true))
                                {
                                    TextLayout textLayout = UIText.CreateLayout(context, text, fonts.Caption, null, HotkeyRenderMode.Ignore, (double)bitmap.Size.Width, 65535.0);
                                    textLayout.FontSize    *= 0.6;
                                    textLayout.WordWrapping = WordWrapping.Wrap;
                                    context.DrawTextLayout(PointDouble.Zero, textLayout, SolidColorBrushCache.Get((ColorRgba128Float)Colors.Black), DrawTextOptions.None);
                                }
                            }
                            flag = true;
                        }
                    }
                }
            }
            isCancelled |= this.IsTileRenderingCancelled(tileOffset);
            if (isCancelled)
            {
                DisposableUtil.Free <IBitmap <ColorPbgra32> >(ref bitmap);
            }
            RenderedTileInfo info = new RenderedTileInfo(bitmap, !isCancelled && (bitmap > null), error);

            if (!this.tilesRenderedQueue.TryEnqueue(tileOffset, info))
            {
                ExceptionUtil.ThrowInternalErrorException("Could not enqueue to this.tilesRenderedQueue");
            }
            if (Interlocked.Exchange(ref this.isProcessTileRenderedQueueQueued, 1) == 0)
            {
                this.syncContext.Post(this.processTileRenderedQueueCallback);
            }
        }
Ejemplo n.º 22
0
 public static IBitmap <TPixel> CreateBitmapFromSourceRect <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, RectInt32 sourceRect) where TPixel : struct, INaturalPixelInfo =>
 ((IBitmap <TPixel>)factory.CreateBitmapFromSourceRect(source, sourceRect));
Ejemplo n.º 23
0
 public static IBitmapSource <TPixel> CreateBitmapScaler <TPixel>(this IImagingFactory factory, IBitmapSource <TPixel> source, int dstWidth, int dstHeight, BitmapInterpolationMode mode) where TPixel : struct, INaturalPixelInfo =>
 ((IBitmapSource <TPixel>)factory.CreateBitmapScaler(source, dstWidth, dstHeight, mode));
Ejemplo n.º 24
0
        unsafe public static BitmapLoadData BeginLoadBitmap(Stream bitmapStream, bool isTransparent)
        {
            // .NET CF does NOT support transparent images. Need to use the COM IImageFactory to create images with alpha.
            if (myImagingFactory == null)
            {
                myImagingFactory = (IImagingFactory)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("327ABDA8-072B-11D3-9D7B-0000F81EF32E")));
            }

            int bytesLength;

            byte[]       bytes;
            MemoryStream memStream = bitmapStream as MemoryStream;

            if (memStream != null)
            {
                bytesLength = (int)memStream.Length;
                bytes       = memStream.GetBuffer();
            }
            else
            {
                bytesLength = (int)bitmapStream.Length;
                bytes       = new byte[bytesLength];
                bitmapStream.Read(bytes, 0, bytesLength);
            }

            IImage    image;
            ImageInfo info;
            uint      hresult = myImagingFactory.CreateImageFromBuffer(bytes, (uint)bytesLength, BufferDisposalFlag.BufferDisposalFlagNone, out image);

            image.GetImageInfo(out info);

            int resizedWidth  = (int)info.Width;
            int resizedHeight = (int)info.Height;

            resizedWidth  = Texture.GetValidTextureDimensionFromSize(resizedWidth);
            resizedHeight = Texture.GetValidTextureDimensionFromSize(resizedHeight);

            int resizedDim = Math.Max(resizedWidth, resizedHeight);

            if (resizedDim == (int)info.Width && resizedDim == (int)info.Height)
            {
                resizedWidth  = 0;
                resizedHeight = 0;
            }
            else
            {
                resizedWidth  = resizedDim;
                resizedHeight = resizedDim;
            }

            IBitmapImage bitmap;

            myImagingFactory.CreateBitmapFromImage(image, (uint)resizedWidth, (uint)resizedHeight, PixelFormatID.PixelFormatDontCare, InterpolationHint.InterpolationHintDefault, out bitmap);
            Marshal.FinalReleaseComObject(image);

            Size size;

            bitmap.GetSize(out size);
            RECT            rect = new RECT(0, 0, size.Width, size.Height);
            BitmapImageData data;

            if (isTransparent)
            {
                bitmap.LockBits(ref rect, ImageLockMode.ImageLockModeWrite | ImageLockMode.ImageLockModeRead, PixelFormatID.PixelFormat32bppARGB, out data);
                for (int y = 0; y < data.Height; y++)
                {
                    for (int x = 0; x < data.Stride; x += 4)
                    {
                        byte *bp   = (byte *)data.Scan0 + data.Stride * y + x;
                        byte  temp = bp[0];
                        bp[0] = bp[2];
                        bp[2] = temp;
                    }
                }
            }
            else
            {
                bitmap.LockBits(ref rect, ImageLockMode.ImageLockModeRead, PixelFormatID.PixelFormat16bppRGB565, out data);
            }

            BitmapLoadData ret = new BitmapLoadData();

            ret.Data          = data;
            ret.Bitmap        = bitmap;
            ret.Width         = (int)info.Width;
            ret.Height        = (int)info.Height;
            ret.IsTransparent = isTransparent;

            return(ret);
        }