public FlipLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex, FlipType flipType)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     this.layerIndex = layerIndex;
     this.flipType = flipType;
 }
 public DeleteLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, Layer deleteMe)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     this.index = historyWorkspace.Document.Layers.IndexOf(deleteMe);
     this.Data = new DeleteLayerHistoryMementoData(deleteMe);
 }
Beispiel #3
0
        public ResolutionInfo(ImageResource imgRes)
            : base(imgRes)
        {
            //m_bResolutionInfoFilled = true;
            BinaryReverseReader reader = imgRes.GetDataReader();

            this.hRes = reader.ReadInt16();
            this.hResUnit = reader.ReadInt32();
            this.widthUnit = reader.ReadInt16();

            this.vRes = reader.ReadInt16();
            this.vResUnit = reader.ReadInt32();
            this.heightUnit = reader.ReadInt16();

            reader.Close();

            //int ppm_x = 3780;	// 96 dpi
            //int ppm_y = 3780;	// 96 dpi

            //if (psd.ResolutionInfo != null)
            //{
            //    int nHorzResolution = (int)psd.ResolutionInfo.hRes;
            //    int nVertResolution = (int)psd.ResolutionInfo.vRes;

            //    ppm_x = (nHorzResolution * 10000) / 254;
            //    ppm_y = (nVertResolution * 10000) / 254;
            //}
        }
Beispiel #4
0
 public CopyrightInfo(ImageResource imgRes)
     : base(imgRes)
 {
     BinaryPSDReader reader = imgRes.GetDataReader();
     this.Value = reader.ReadByte() == 0 ? false : true;
     reader.Close();
 }
        public BitmapHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, 
            int layerIndex, PdnRegion changedRegion, Surface copyFromThisSurface)
            : base(name, image)
        {
            this.historyWorkspace = historyWorkspace;
            this.layerIndex = layerIndex;

            PdnRegion region = changedRegion.Clone();
            this.tempFileName = FileSystem.GetTempFileName();

            FileStream outputStream = null;

            try
            {
                outputStream = FileSystem.OpenStreamingFile(this.tempFileName, FileAccess.Write);
                SaveSurfaceRegion(outputStream, copyFromThisSurface, region);
            }

            finally
            {
                if (outputStream != null)
                {
                    outputStream.Dispose();
                    outputStream = null;
                }
            }

            this.tempFileHandle = new DeleteFileOnFree(this.tempFileName);
            BitmapHistoryMementoData data = new BitmapHistoryMementoData(null, region);

            this.Data = data;
        }
 public FlipDocumentFunction(string historyName, ImageResource image, FlipType flipType)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.undoImage = image;
     this.flipType = flipType;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ResolutionInfo"/> class using the <see cref="ImageResource"/>.
        /// </summary>
        /// <param name="imgRes">The image resource to use.</param>
        public ResolutionInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryReverseReader dataReader = imgRes.DataReader;

            // read horizontal resolution
            dataReader.ReadInt16();

            // read horizontal resolution units (1=pixels per inch, 2=pixels per centimeter)
            dataReader.ReadInt32();

            // read the width units (1=inches, 2=cm, 3=pt, 4=picas, 5=columns)
            dataReader.ReadInt16();

            // read vertical resolution
            dataReader.ReadInt16();

            // read vertical resolution units (1=pixels per inch, 2=pixels per centimeter)
            dataReader.ReadInt32();

            // read the height units (1=inches, 2=cm, 3=pt, 4=picas, 5=columns)
            dataReader.ReadInt16();

            dataReader.Close();
        }
 public LayerPropertyHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     this.layerIndex = layerIndex;
     this.properties = ((Layer)this.historyWorkspace.Document.Layers[layerIndex]).SaveProperties();
 }
Beispiel #9
0
        public Slices(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();
            this.Version = reader.ReadUInt32();
            this.Rectangle = reader.ReadPSDRectangle(); // new Rectangle(reader).ToERectangle();
            this.SlicesName = reader.ReadPSDUnicodeString();

            int cnt = (int)reader.ReadUInt32();
            this.SliceList = new List<Slice>();
            for (int i = 0; i < cnt; i++)
                this.SliceList.Add(new Slice(reader));

            int unknown1 = (int)reader.ReadUInt32();
            int unknown2 = (int)reader.ReadUInt32();
            ushort unknown3 = reader.ReadUInt16();
            string unknown4 = DynVal.ReadSpecialString(reader);
            int unknown5 = (int)reader.ReadUInt32();

            this.Values = new List<DynVal>();
            while (reader.BytesToEnd > 0)
            {
                DynVal val = DynVal.ReadValue(reader, false);
                this.Values.Add(val);
            }
            //this.Values = DynVal.ReadValues(reader);
            //this.Data = reader.ReadBytes((int)reader.BytesToEnd);
            reader.Close();
        }
Beispiel #10
0
        public Thumbnail(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            //m_bThumbnailFilled = true;

            this.Format = reader.ReadInt32();
            this.Width = reader.ReadInt32();
            this.Height = reader.ReadInt32();
            this.WidthBytes = reader.ReadInt32(); //padded row bytes (
            this.Size = reader.ReadInt32(); //Total size widthbytes * height * planes
            this.CompressedSize = reader.ReadInt32(); //used for consistancy check
            this.BitPerPixel = reader.ReadInt16();
            this.Planes = reader.ReadInt16();

            int numBytes = (int)reader.BytesToEnd;
            byte[] buffer = reader.ReadBytes(numBytes);

            if (this.ID == 1033)
            {
                // BGR
                for (int n = 0; n < numBytes - 2; n += 3)
                {
                    byte tmp = buffer[n + 2];
                    buffer[n + 2] = buffer[n];
                    buffer[n] = tmp;
                }
            }
            System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer);
            this.Bitmap = new System.Drawing.Bitmap(stream);

            reader.Close();
        }
        public ReplaceDocumentHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace)
            : base(name, image)
        {
            this.historyWorkspace = historyWorkspace;

            ReplaceDocumentHistoryMementoData data = new ReplaceDocumentHistoryMementoData(this.historyWorkspace.Document);
            this.Data = data;
        }
 public BitmapHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace,
     int layerIndex, Guid poMaskedSurfaceRef)
     : base(name, image)
 {
     this.layerIndex = layerIndex;
     this.historyWorkspace = historyWorkspace;
     this.poMaskedSurfaceRef = poMaskedSurfaceRef;
 }
 public FlipLayerFunction(string historyName, ImageResource image, FlipType flipType, int layerIndex)
     : base(ActionFlags.None)
 {
     this.historyName = historyName;
     this.flipType = flipType;
     this.undoImage = image;
     this.layerIndex = layerIndex;
 }
 public ColorTransferFunctions(ImageResource imgRes)
     : base(imgRes)
 {
     BinaryPSDReader reader = imgRes.GetDataReader();
     this.Functions = new List<ColorTransferFunction>();
     for (int i = 0; i < 4; i++)
         this.Functions.Add(new ColorTransferFunction(reader));
     reader.Close();
 }
 public MetaDataHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace)
     : base(name, image)
 {
     this.historyWorkspace = historyWorkspace;
     Document document = new Document(1, 1); // we need some place to store the metadata...
     document.ReplaceMetaDataFrom(historyWorkspace.Document);
     MetaDataHistoryMementoData data = new MetaDataHistoryMementoData(document);
     this.Data = data;
 }
Beispiel #16
0
 public CloneStampTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.CloneStampToolIcon.png"),
            PdnResources.GetString("CloneStampTool.Name"),
            PdnResources.GetString("CloneStampTool.HelpText"),
            'l',
            false,
            ToolBarConfigItems.Pen | ToolBarConfigItems.Antialiasing)
 {
 }
   public override void OnGUI()
   {
 #if UNITY_EDITOR
       EditorTools.FieldTypeLabel("Sprite");
       EditorTools.FieldNameLabel(this.Name);
       Sprite        newSprite = EditorGUILayout.ObjectField(this.assignment.sprite, typeof(Sprite), allowSceneObjects: true) as Sprite;
       ImageResource resource  = TemplateImport.Instance.FindResource(newSprite);
       this.assignment.UpdateResource(resource);
 #endif
   }
Beispiel #18
0
 public void ApplySettings(PanControlSettings settings)
 {
     MinValueX           = settings.MinValueX;
     MaxValueX           = settings.MaxValueX;
     MinValueY           = settings.MinValueY;
     MaxValueY           = settings.MaxValueY;
     MinValueR           = settings.MinValueR;
     MaxValueR           = settings.MaxValueR;
     StaticImageUnderlay = settings.StaticImageUnderlay;
 }
Beispiel #19
0
 public ApplyRendererToBitmapLayerHistoryFunction(string historyMementoName, ImageResource historyMementoImage, int layerIndex, IRenderer <ColorBgra> renderer, RectInt32 rendererClipRect, int rendererTileEdgeLog2 = 4, int delayUntilProgressDialogMs = 0x7d0, ActionFlags actionFlags = 0) : base(actionFlags)
 {
     this.historyMementoName         = historyMementoName;
     this.historyMementoImage        = historyMementoImage;
     this.layerIndex                 = layerIndex;
     this.renderer                   = renderer;
     this.rendererClipRect           = rendererClipRect;
     this.rendererTileEdgeLog2       = rendererTileEdgeLog2;
     this.delayUntilProgressDialogMs = delayUntilProgressDialogMs;
 }
Beispiel #20
0
 public ToolInfo(string displayName, string helpText, ImageResource image, ImageResource largeImage, char hotKey, bool skipIfActiveOnHotKey, Type toolType)
 {
     this.displayName          = displayName;
     this.helpText             = helpText;
     this.image                = image;
     this.largeImage           = largeImage;
     this.hotKey               = hotKey;
     this.skipIfActiveOnHotKey = skipIfActiveOnHotKey;
     this.toolType             = toolType;
 }
Beispiel #21
0
 public PaintBucketTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.PaintBucketIcon.png"),
            PdnResources.GetString("PaintBucketTool.Name"),
            PdnResources.GetString("PaintBucketTool.HelpText"),
            'f',
            false,
            ToolBarConfigItems.Brush | ToolBarConfigItems.Antialiasing | ToolBarConfigItems.AlphaBlending)
 {
 }
Beispiel #22
0
 protected override void DisposeResource()
 {
     if (movie != null)
     {
         movie.Dispose();
         movie = null;
         black.Dispose();
         black = null;
     }
 }
Beispiel #23
0
        public override bool Equals(object obj)
        {
            if (!(obj is ImageResource))
            {
                return(false);
            }
            ImageResource res = (ImageResource)obj;

            return(this == res);
        }
Beispiel #24
0
 public LineTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.LineToolIcon.png"),
            PdnResources.GetString("LineTool.Name"),
            PdnResources.GetString("LineTool.HelpText"),
            ToolBarConfigItems.None,
            ToolBarConfigItems.ShapeType)
 {
     this.ForceShapeDrawType  = true;
     this.ForcedShapeDrawType = ShapeDrawType.Outline;
 }
        public LayersGroupInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.GroupIds = new List<ushort>();
            while (reader.BytesToEnd > 0)
                this.GroupIds.Add(reader.ReadUInt16());

            reader.Close();
        }
Beispiel #26
0
        public AlphaIdentifiers(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            while (reader.BytesToEnd > 0)
            {
                this._ids.Add(reader.ReadUInt32());
            }
            reader.Close();
        }
Beispiel #27
0
 public MagicWandTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.MagicWandToolIcon.png"),
            PdnResources.GetString("MagicWandTool.Name"),
            PdnResources.GetString("MagicWandTool.HelpText"),
            's',
            false,
            ToolBarConfigItems.None)
 {
     LimitToSelection = false;
 }
Beispiel #28
0
        public XMLInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();
            string xml = new string(reader.ReadPSDChars((int)reader.BaseStream.Length));
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            this.Xml = doc;

            reader.Close();
        }
Beispiel #29
0
 public ZoomTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.ZoomToolIcon.png"),
            PdnResources.GetString("ZoomTool.Name"),
            PdnResources.GetString("ZoomTool.HelpText"),
            'z',
            false,
            ToolBarConfigItems.None)
 {
     this.mouseDown = MouseButtons.None;
 }
Beispiel #30
0
        public void TryGet_ReadSameFileAsDifferentResources_FirstReadResourceIsValidSecondFails()
        {
            RawResource rawResource = ResourceManager.ReadRaw(f_filePath);

            //this fails, because the file is already cached but as a raw resource. currently there exists no conversion from raw to image resource.
            //therefor the 'casting' fails.
            ImageResource imageResource = ResourceManager.ReadImage(f_filePath);

            Assert.IsNotNull(rawResource);
            Assert.IsNull(imageResource);
        }
Beispiel #31
0
        protected override void Drop()
        {
            RestoreSavedRegion();

            PdnRegion regionCopy = Selection.CreateRegion();

            using (PdnRegion simplifiedRegion = Utility.SimplifyAndInflateRegion(regionCopy,
                                                                                 Utility.DefaultSimplificationFactor, 2))
            {
                HistoryMemento bitmapAction2 = new BitmapHistoryMemento(Name, Image, DocumentWorkspace,
                                                                        ActiveLayerIndex, simplifiedRegion);

                bool oldHQ = this.fullQuality;
                this.fullQuality = true;
                Render(this.context.offset, true);
                this.fullQuality = oldHQ;
                this.currentHistoryMementos.Add(bitmapAction2);

                activeLayer.Invalidate(simplifiedRegion);
                Update();
            }

            regionCopy.Dispose();
            regionCopy = null;

            ContextHistoryMemento cha = new ContextHistoryMemento(this.DocumentWorkspace, this.ourContext, this.Name, this.Image);

            this.currentHistoryMementos.Add(cha);

            string        name;
            ImageResource image;

            if (didPaste)
            {
                name  = EnumLocalizer.EnumValueToLocalizedName(typeof(CommonAction), CommonAction.Paste);
                image = ImageResource.Get("Icons.MenuEditPasteIcon.png");
            }
            else
            {
                name  = this.Name;
                image = this.Image;
            }

            didPaste = false;

            SelectionHistoryMemento sha = new SelectionHistoryMemento(this.Name, this.Image, this.DocumentWorkspace);

            this.currentHistoryMementos.Add(sha);

            this.context.Dispose();
            this.context = new MoveToolContext();

            this.FlushHistoryMementos(PdnResources.GetString("MoveTool.HistoryMemento.DropPixels"));
        }
Beispiel #32
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                MessageBox.Show($"Right click on Row[{row}] Column[{column}]");
            }

            Graphics graphics = this.CreateGraphics();

            graphics.DrawImage(ImageResource.GetReveledBlankSquare(this.Size), 0, 0);
        }
 public MoveSelectionTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.MoveSelectionToolIcon.png"),
            MoveSelectionTool.StaticName,
            PdnResources.GetString("MoveSelectionTool.HelpText"), // "Click and drag to move a selected region",
            'm',
            false,
            ToolBarConfigItems.None)
 {
     this.context = new Context();
 }
Beispiel #34
0
        public LayersMenu()
        {
            this.InitializeComponent();
            string        staticName  = RotateZoomEffect.StaticName;
            Keys          keys        = Keys.Control | Keys.Shift | Keys.Z;
            ImageResource staticImage = RotateZoomEffect.StaticImage;
            string        str3        = string.Format(PdnResources.GetString("Effects.Name.Format.Configurable"), staticName);

            this.menuLayersRotateZoom.Text = str3;
            this.menuLayersRotateZoom.SetIcon(staticImage);
            this.menuLayersRotateZoom.ShortcutKeys = keys;
        }
Beispiel #35
0
 public MoveTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.MoveToolIcon.png"),
            MoveTool.StaticName,
            PdnResources.GetString("MoveTool.HelpText"), // "Click and drag to move a selected region",
            'm',
            false,
            ToolBarConfigItems.Resampling)
 {
     this.context       = new MoveToolContext();
     this.enableOutline = false;
 }
Beispiel #36
0
 public PencilTool(DocumentWorkspace documentWorkspace)
     : base(documentWorkspace,
            ImageResource.Get("Icons.PencilToolIcon.png"),
            PdnResources.GetString("PencilTool.Name"),
            PdnResources.GetString("PencilTool.HelpText"),
            'p',
            true,
            ToolBarConfigItems.AlphaBlending)
 {
     // initialize any state information you need
     mouseDown = false;
 }
Beispiel #37
0
 protected override void OnGetStatus(out ImageResource image, out string text)
 {
     if (!base.DocumentWorkspace.Selection.IsEmpty)
     {
         base.DocumentWorkspace.GetLatestSelectionInfo(out text, out image);
         if ((text != null) && (image != null))
         {
             return;
         }
     }
     base.OnGetStatus(out image, out text);
 }
Beispiel #38
0
        public VersionInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();
            this.Version = reader.ReadUInt32();
            this.HasRealMergedData = reader.ReadBoolean();
            this.WriterName = reader.ReadPSDUnicodeString();
            this.ReaderName = reader.ReadPSDUnicodeString();
            this.FileVersion = reader.ReadUInt32();

            reader.Close();
        }
Beispiel #39
0
        public ColorHalftoneInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.Screens = new List<Screen>();
            for (int i = 0; i < 4; i++)
            {
                this.Screens.Add(new Screen(reader));
            }

            reader.Close();
        }
Beispiel #40
0
 public ShapeTool(DocumentWorkspace documentWorkspace,
                  ImageResource toolBarImage,
                  string name,
                  string helpText)
     : this(documentWorkspace,
            toolBarImage,
            name,
            helpText,
            defaultShortcut,
            ToolBarConfigItems.None,
            ToolBarConfigItems.None)
 {
 }
Beispiel #41
0
        public short Opacity; // 0..100

        #endregion Fields

        #region Constructors

        public DisplayInfo(ImageResource imgRes)
        {
            BinaryReverseReader reader = imgRes.GetDataReader();

            this.ColorSpace = (ColorModes)reader.ReadInt16();
            for(int i=0; i<4; i++)
                this.Color[i] = reader.ReadInt16();

            this.Opacity = (short)Math.Max(0,Math.Min(100,(int)reader.ReadInt16()));
            this.kind = reader.ReadByte()==0?false:true;

            reader.Close();
        }
 public AlphaChannels(ImageResource imgRes)
     : base(imgRes)
 {
     BinaryReverseReader reader = imgRes.DataReader;
     // the names are pascal strings without padding!!!
     while ((reader.BaseStream.Length - reader.BaseStream.Position) > 0)
     {
         byte stringLength = reader.ReadByte();
         string s = new string(reader.ReadChars(stringLength));
         if (s.Length > 0)
             _channelNames.Add(s);
     }
     reader.Close();
 }
 public AlphaChannelNames(ImageResource imgRes)
     : base(imgRes)
 {
     BinaryPSDReader reader = imgRes.GetDataReader();
     while (reader.BytesToEnd > 0)
     {
         //no padding in these strings!
         byte length = reader.ReadByte();
         string name = new string(reader.ReadPSDChars(length));
         if (name.Length > 0)
             this._names.Add(name);
     }
     reader.Close();
 }
        public SwapLayerHistoryMemento(string name, ImageResource image, IHistoryWorkspace historyWorkspace, int layerIndex1, int layerIndex2)
            : base(name, image)
        {
            this.historyWorkspace = historyWorkspace;
            this.layerIndex1 = layerIndex1;
            this.layerIndex2 = layerIndex2;

            if (this.layerIndex1 < 0 || this.layerIndex2 < 0 ||
                this.layerIndex1 >= this.historyWorkspace.Document.Layers.Count ||
                this.layerIndex2 >= this.historyWorkspace.Document.Layers.Count)
            {
                throw new ArgumentOutOfRangeException("layerIndex[1|2]", "out of range");
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AlphaChannels" /> class.
        /// </summary>
        /// <param name="imgRes">The image resource.</param>
        public AlphaChannels(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryReverseReader dataReader = imgRes.DataReader;
            while (dataReader.BaseStream.Length - dataReader.BaseStream.Position > 0L)
            {
                // read the length of the string
                byte length = dataReader.ReadByte();

                // read the string
                dataReader.ReadChars(length);
            }

            dataReader.Close();
        }
        public ResolutionInfo(ImageResource imgRes)
            : base(imgRes)
        {
            BinaryReverseReader reader = imgRes.DataReader;

            HRes = reader.ReadInt16();
            HResUnit = (ResUnit)reader.ReadInt32();
            WidthUnit = (Unit)reader.ReadInt16();

            VRes = reader.ReadInt16();
            VResUnit = (ResUnit)reader.ReadInt32();
            HeightUnit = (Unit)reader.ReadInt16();

            reader.Close();
        }
Beispiel #47
0
        public ResolutionInfo(ImageResource imgRes)
            : base(imgRes)
        {
            //m_bResolutionInfoFilled = true;
            BinaryPSDReader reader = imgRes.GetDataReader();

            this.hRes = reader.ReadInt16();
            this.hResUnit = reader.ReadInt32();
            this.widthUnit = reader.ReadInt16();

            this.vRes = reader.ReadInt16();
            this.vResUnit = reader.ReadInt32();
            this.heightUnit = reader.ReadInt16();

            reader.Close();
        }
Beispiel #48
0
 public SelectionTool(
     DocumentWorkspace documentWorkspace,
     ImageResource toolBarImage,
     string name,
     string helpText,
     char hotKey,
     ToolBarConfigItems toolBarConfigItems)
     : base(documentWorkspace,
            toolBarImage,
            name,
            helpText,
            hotKey,
            false,
            toolBarConfigItems)
 {
     this.tracking = false;
 }
Beispiel #49
0
 public ToolInfo(
     string name, 
     string helpText, 
     ImageResource image, 
     char hotKey, 
     bool skipIfActiveOnHotKey, 
     ToolBarConfigItems toolBarConfigItems, 
     Type toolType)
 {
     this.name = name;
     this.helpText = helpText;
     this.image = image;
     this.hotKey = hotKey;
     this.skipIfActiveOnHotKey = skipIfActiveOnHotKey;
     this.toolBarConfigItems = toolBarConfigItems;
     this.toolType = toolType;
 }
        public Thumbnail(ImageResource imgRes)
            : base(imgRes)
        {
            using (BinaryReverseReader reader = DataReader)
            {
                int format = reader.ReadInt32();
                int width = reader.ReadInt32();
                int height = reader.ReadInt32();
                int widthBytes = reader.ReadInt32();
                int size = reader.ReadInt32();
                int compressedSize = reader.ReadInt32();
                short bitPerPixel = reader.ReadInt16();
                short planes = reader.ReadInt16();

                if (format == 1)
                {

                    byte[] imgData = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));

                    using (var memoryStream = new MemoryStream(imgData))
                    {
                        Image = (Bitmap)(Bitmap.FromStream(memoryStream).Clone());
                    }

                    if (ID == 1033)
                    {
                        //// BGR
                        //for(int y=0;y<m_thumbnailImage.Height;y++)
                        //  for (int x = 0; x < m_thumbnailImage.Width; x++)
                        //  {
                        //    Color c=m_thumbnailImage.GetPixel(x,y);
                        //    Color c2=Color.FromArgb(c.B, c.G, c.R);
                        //    m_thumbnailImage.SetPixel(x, y, c);
                        //  }
                    }

                }
                else
                {
                    Image = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                }
            }
        }