public override void Write(TextureUtil.PixelColor color) { builder.SetPixel(new Pixel(SingleToByte(color.R), SingleToByte(color.G), SingleToByte(color.B), SingleToByte(color.A), false), x, y); if (++x >= width) { x = 0; y++; } }
public override void Write(TextureUtil.PixelColor color) { switch (mode) { case CHANNEL_MODE_RGBA: buff[pointer++] = SingleToByte(color.B); buff[pointer++] = SingleToByte(color.G); buff[pointer++] = SingleToByte(color.R); buff[pointer++] = SingleToByte(color.A); break; case CHANNEL_MODE_RGB: buff[pointer++] = SingleToByte(color.B); buff[pointer++] = SingleToByte(color.G); buff[pointer++] = SingleToByte(color.R); break; case CHANNEL_MODE_RG: buff[pointer++] = 0; buff[pointer++] = SingleToByte(color.G); buff[pointer++] = SingleToByte(color.R); break; case CHANNEL_MODE_R: var r = SingleToUShort(color.R); buff[pointer++] = (byte)(r & 0xFF); buff[pointer++] = (byte)((r >> 8) & 0xFF); break; case CHANNEL_MODE_ALPHA: var a = SingleToUShort(color.A); buff[pointer++] = (byte)(a & 0xFF); buff[pointer++] = (byte)((a >> 8) & 0xFF); break; } }