Пример #1
0
        public void Merge(IconGroup additions, IconOptions options)
        {
            if (options.ClearOriginals)
            {
                // clear this instance's icons
                List <IDirectoryMember> imagesToRemove = new List <IDirectoryMember>(_images);
                foreach (IconImage image in imagesToRemove)
                {
                    Remove(image);
                }
            }

            foreach (IconImage image in additions._images)
            {
                if (options.SizeLimit > 0 && image.Size.Width >= options.SizeLimit)
                {
                    continue;
                }

                this.AddUpdate(image);
            }
        }
Пример #2
0
        internal IconImage(Byte[] data, IconGroup parentIcon, ResIconDirectoryEntry entry)
        {
            if (data.Length < 4)
            {
                throw new ArgumentException("IconImage data must be at least 4 bytes long", "data");
            }

            // in resources, the hotspot is the first 2 words of the data
            UInt16 hotspotX = (ushort)(data[0] | data[1] << 8);
            UInt16 hotspotY = (ushort)(data[2] | data[3] << 8);

            ImageData  = data;
            ParentIcon = parentIcon;

            Size    = new Size(entry.bWidth, entry.bHeight);
            Hotspot = new Point(hotspotX, hotspotY);

            ColorCount = entry.bColorCount;
            BitCount   = entry.wBitCount;
            Planes     = entry.wPlanes;

            Validate();
        }