public void HorizontalLine(RowIterator row, int x, int count, Color c) { row.Move(x + x + x); for (int i = 0; i < 3 * count; i += 3) { row[i + 0] = c.B; row[i + 1] = c.G; row[i + 2] = c.R; } }
public void HorizontalLine(RowIterator row, int x, int count, Color c) { byte dst = c.A; row.Move(x); for (int i = 0; i < count; i++) { row[i] = dst; } }
public void HorizontalLine(RowIterator row, int x, int count, Color c) { row.Move(x << 1); ushort v = ToRgb555(c.R, c.G, c.B); for (int i = 0; i < count << 1; i += 2) { row[i + 0] = (byte)(v >> 8); row[i + 1] = (byte)(v & 0xFF); } }
public Color Get(RowIterator row, int x) { row.Move(x << 2); Color c = new Color(); c.A = row[0]; c.B = row[1]; c.G = row[2]; c.R = row[3]; return(c); }
public void HorizontalLine(RowIterator row, int x, int count, Color c) { row.Move(x << 2); for (int i = 0; i < count << 2; i += 4) { row[i + 0] = c.A; row[i + 1] = c.B; row[i + 2] = c.G; row[i + 3] = c.R; } }
public Color Get(RowIterator row, int x) { byte rgb = row[x]; Color c = new Color(); c.R = 0; c.G = 0; c.B = 0; c.A = rgb; return(c); }
public Color Get(RowIterator row, int x) { row.Move(x << 1); ushort rgb = (ushort)(row[0] | row[1]); Color c = new Color(); c.R = (byte)((rgb >> 7) & 0xF8); c.G = (byte)((rgb >> 2) & 0xF8); c.B = (byte)((rgb << 3) & 0xF8); c.A = 255; return(c); }
public void Render(RowIterator row, int x, int count, CoverageIterator covers, Color c) { byte dst = c.A; row.Move(x); for (int i = 0; i < count; i++) { int alpha = covers.Current * c.A; uint src = row[i]; row[i] = (byte)((((dst - src) * alpha) + (src << 16)) >> 16); covers.MoveNext(); } }
public void Render(RowIterator row, int x, int count, CoverageIterator covers, Color c) { row.Move(x + x + x); for (int i = 0; i < 3 * count; i += 3) { int alpha = covers.Current * c.A; int b = row[i + 0]; int g = row[i + 1]; int r = row[i + 2]; row[i + 0] = (byte)((((c.B - b) * alpha) + (b << 16)) >> 16); row[i + 1] = (byte)((((c.G - g) * alpha) + (g << 16)) >> 16); row[i + 2] = (byte)((((c.R - r) * alpha) + (r << 16)) >> 16); covers.MoveNext(); } }
/// <summary> /// Renders the specified scanline in the specified color into the /// rendering buffer. /// </summary> /// <param name="scanline">The scanline to render.</param> /// <param name="color">The color to render the scanline.</param> public void Render(Scanline scanline, Color color) { if (scanline.Y < 0 || scanline.Y >= m_rbuf.Height) { return; } int base_x = scanline.BaseX; int y = scanline.Y; RowIterator row = m_rbuf.Row(y); Scanline.Iterator span = new Scanline.Iterator(scanline); for (int num_spans = scanline.SpanCount; num_spans > 0; num_spans--) { int x = span.Next() + base_x; CoverageIterator covers = span.Covers(); int num_pix = span.PixelCount(); if (x < 0) { num_pix += x; if (num_pix <= 0) { continue; } covers -= x; x = 0; } if (x + num_pix >= m_rbuf.Width) { num_pix = m_rbuf.Width - x; if (num_pix <= 0) { continue; } } m_span.Render(row, x, num_pix, covers, color); } }
public void Render(RowIterator row, int x, int count, CoverageIterator covers, Color c) { row.Move(x << 1); for (int i = 0; i < count << 1; i += 2) { ushort rgb = (ushort)(row[i + 0] | row[i + 1]); int alpha = covers.Current * c.A; int r = (rgb >> 7) & 0xF8; int g = (rgb >> 2) & 0xF8; int b = (rgb << 3) & 0xF8; int v = (((((c.R - r) * alpha) + (r << 16)) >> 9) & 0x7C00) | (((((c.G - g) * alpha) + (g << 16)) >> 14) & 0x3E0) | ((((c.B - b) * alpha) + (b << 16)) >> 19); row[i + 0] = (byte)(v >> 8); row[i + 1] = (byte)(v & 0xFF); covers.MoveNext(); } }