public PixelMap GetPixels()
        {
            PixelMap map = new PixelMap(_bitmap.Width, _bitmap.Height);

            for (int x = 0; x < _bitmap.Width; ++x) //(int x = _bitmap.Width - 1; x >= 0; --x)
            {
                for (int y = 0; y < _bitmap.Height; ++y)
                {
                    map.SetPixel(x, y, _bitmap.GetPixel(x, y));
                }
            }

            return(map);
        }
예제 #2
0
 public void Build(BitmapExtended target)
 {
     if (child != null)
     {
         if (child[0] != null)
         {
             child[0].Build(target);
         }
         if (child[1] != null)
         {
             child[1].Build(target);
         }
     }
     if (imageRef != null)
     {
         PixelMap data = imageRef.GetPixels();
         for (int x = 0; x < imageRef.Width; ++x)
         {
             for (int y = 0; y < imageRef.Height; ++y)
             {
                 //target.SetPixel(x + (int)rc.X, y + (int)rc.Y, data[x + y]);// * imageRef.Width]);
                 target.SetPixel(x + (int)rc.X, y + (int)rc.Y, data.GetPixel(x, y));
             }
         }
         // Artificial texture bleeding!
         if (TEXTURE_PADDING > 0 && BLEED)
         {
             for (int y = 0; y < imageRef.Height; ++y)
             {
                 int x = imageRef.Width - 1;
                 target.SetPixel(x + (int)rc.X + TEXTURE_PADDING, y + (int)rc.Y, data.GetPixel(x, y));
             }
             for (int x = 0; x < imageRef.Width; ++x)
             {
                 int y = imageRef.Height - 1;
                 target.SetPixel(x + (int)rc.X, y + (int)rc.Y + TEXTURE_PADDING, data.GetPixel(x, y));
             }
         }
     }
 }