Inheritance: IRenderable
Exemplo n.º 1
0
 /// <param name="image">
 /// Source image.
 /// </param>
 /// <param name="location">
 /// Location of object.
 /// </param>
 public GraphicObject(ImageBase image, Point location)
 {
     this.image = image;
     Location = location;
 }
Exemplo n.º 2
0
        private static RawImage Minimize(ImageBase source, ImagePalette src, ImagePalette dest)
        {
            if(source == null)return null;
            byte[] full = source.ImageData;
            byte[] mini = new byte[64];

            for(int y = 0; y < 8; y++)
            for(int x = 0; x < 8; x++)
            {
                int rs = 0, gs = 0, bs = 0, cn = 0;
                for(int y2 = 0; y2 < 8; y2++)
                for(int x2 = 0; x2 < 8; x2++)
                {
                    Color c = src[full[x*8+x2+(y*8+y2)*64]];
                    rs += c.R;
                    gs += c.G;
                    bs += c.B;
                    cn += 1;
                }
                Color average = Color.FromArgb(Convert.ToInt32(rs/(float)cn), Convert.ToInt32(gs/(float)cn), Convert.ToInt32(bs/(float)cn));
                byte avgbyte = (byte)dest.GetNearestColorIndex(average);
                mini[x+y*8] = avgbyte;
            }
            return new RawImage(mini, 8, 8);
        }
Exemplo n.º 3
0
 /// <param name="image">
 /// Source image.
 /// </param>
 /// <param name="location">
 /// Location of object.
 /// </param>
 public GraphicObject(ImageBase image, Point location)
 {
     this.image = image;
     Location   = location;
 }