예제 #1
0
 public override void writeTile(int x, int y, int w, int h, Color[] color, float[] alpha)
 {
     color = ColorEncoder.unlinearize(color);             // gamma correction
     byte[] tileData = ColorEncoder.quantizeRGBA8(color, alpha);
     for (int j = 0, index = 0; j < h; j++)
     {
         int imageIndex = 4 * (x + (height - 1 - (y + j)) * width);
         for (int i = 0; i < w; i++, index += 4, imageIndex += 4)
         {
             // swap bytes around so buffer is in native BGRA order
             data[imageIndex + 0] = tileData[index + 2];
             data[imageIndex + 1] = tileData[index + 1];
             data[imageIndex + 2] = tileData[index + 0];
             data[imageIndex + 3] = tileData[index + 3];
         }
     }
 }
예제 #2
0
        public override void writeTile(int x, int y, int w, int h, Color[] color, float[] alpha)
        {
            color = ColorEncoder.unlinearize(color);             // gamma correction
            byte[] tileData = ColorEncoder.quantizeRGBA8(color, alpha);

            lock (data) {
                for (int j = 0, index = 0; j < h; j++)
                {
                    for (int i = 0; i < w; i++, index += 4)
                    {
                        data.SetPixel(x + i, y + j, System.Drawing.Color.FromArgb(tileData[index + 3],
                                                                                  tileData[index],
                                                                                  tileData[index + 1],
                                                                                  tileData[index + 2]));
                    }
                }
            }
        }