public void display_pmap(Graphics displayGraphics, RasterBuffer src) { if (m_sys_format == m_format) { m_pmap_window.Draw(displayGraphics); } else { PixelMap pmap_tmp = new PixelMap(); pmap_tmp.Create(m_pmap_window.Width(), m_pmap_window.Height(), PlatformSupportAbstract.GetBitDepthForPixelFormat(m_sys_format)); RasterBuffer rbuf_tmp = new RasterBuffer(); unsafe { rbuf_tmp.Attach(pmap_tmp.buf(), pmap_tmp.Width(), pmap_tmp.Height(), m_app.FlipY() ? pmap_tmp.stride() : -pmap_tmp.stride(), pmap_tmp.bpp()); } convert_pmap(rbuf_tmp, src, m_format); pmap_tmp.Draw(displayGraphics); throw new System.NotImplementedException(); } }
public unsafe void create_pmap(uint width, uint height, RasterBuffer wnd) { m_pmap_window = new PixelMap(); m_pmap_window.Create(width, height, PlatformSupportAbstract.GetBitDepthForPixelFormat(m_format)); wnd.Attach(m_pmap_window.buf(), m_pmap_window.Width(), m_pmap_window.Height(), m_RenderOrigin == PlatformSupportAbstract.ERenderOrigin.OriginBottomLeft ? -m_pmap_window.stride() : m_pmap_window.stride(), m_pmap_window.bpp()); }
//------------------------------------------------------------------------ public PlatformSupport(PixelFormats format, PlatformSupportAbstract.ERenderOrigin RenderOrigin) : base(format, RenderOrigin) { m_specific = new PlatformSpecificWindow(this, format, RenderOrigin); m_format = format; //m_bpp(m_specific->m_bpp), //m_window_flags(0), m_wait_mode = true; m_RenderOrigin = RenderOrigin; m_initial_width = 10; m_initial_height = 10; Caption = "Anti-Grain Geometry Application"; Focus(); }
public PlatformSpecificWindow(PlatformSupportAbstract app, PlatformSupportAbstract.PixelFormats format, PlatformSupportAbstract.ERenderOrigin RenderOrigin) { m_app = app; m_format = format; m_sys_format = PlatformSupportAbstract.PixelFormats.Undefined; m_RenderOrigin = RenderOrigin; m_WindowContentNeedsRedraw = true; m_StopWatch = new Stopwatch(); switch (m_format) { case PlatformSupportAbstract.PixelFormats.BlackWhite: m_sys_format = PlatformSupportAbstract.PixelFormats.BlackWhite; break; case PlatformSupportAbstract.PixelFormats.Gray8: m_sys_format = PlatformSupportAbstract.PixelFormats.Gray8; break; case PlatformSupportAbstract.PixelFormats.Gray16: m_sys_format = PlatformSupportAbstract.PixelFormats.Gray16; break; case PlatformSupportAbstract.PixelFormats.Rgb565: case PlatformSupportAbstract.PixelFormats.Rgb555: m_sys_format = PlatformSupportAbstract.PixelFormats.Rgb555; break; case PlatformSupportAbstract.PixelFormats.RgbAAA: case PlatformSupportAbstract.PixelFormats.BgrAAA: case PlatformSupportAbstract.PixelFormats.RgbBBA: case PlatformSupportAbstract.PixelFormats.BgrABB: m_sys_format = PlatformSupportAbstract.PixelFormats.Bgr24; break; case PlatformSupportAbstract.PixelFormats.Rgb24: m_sys_format = PlatformSupportAbstract.PixelFormats.Rgb24; break; case PlatformSupportAbstract.PixelFormats.Bgr24: m_sys_format = PlatformSupportAbstract.PixelFormats.Bgr24; break; case PlatformSupportAbstract.PixelFormats.Rgb48: case PlatformSupportAbstract.PixelFormats.Bgr48: m_sys_format = PlatformSupportAbstract.PixelFormats.Bgr24; break; case PlatformSupportAbstract.PixelFormats.Bgra32: m_sys_format = PlatformSupportAbstract.PixelFormats.Bgra32; break; case PlatformSupportAbstract.PixelFormats.Abgr32: m_sys_format = PlatformSupportAbstract.PixelFormats.Abgr32; break; case PlatformSupportAbstract.PixelFormats.Argb32: m_sys_format = PlatformSupportAbstract.PixelFormats.Argb32; break; case PlatformSupportAbstract.PixelFormats.Rgba32: m_sys_format = PlatformSupportAbstract.PixelFormats.Rgba32; break; case PlatformSupportAbstract.PixelFormats.Bgra64: case PlatformSupportAbstract.PixelFormats.Abgr64: case PlatformSupportAbstract.PixelFormats.Argb64: case PlatformSupportAbstract.PixelFormats.Rgba64: m_sys_format = PlatformSupportAbstract.PixelFormats.Bgra32; break; } m_StopWatch.Reset(); m_StopWatch.Start(); }
private static void convert_pmap(RasterBuffer dst, RasterBuffer src, PlatformSupportAbstract.PixelFormats format) { }
public TeselateTestApplication(PixelFormats format, PlatformSupportAbstract.ERenderOrigin RenderOrigin) : base(format, RenderOrigin) { }
public bool load_pmap(string fn, uint idx, RasterBuffer dst) { PixelMap pmap_tmp = new PixelMap(); if (!pmap_tmp.load_from_bmp(fn)) { return(false); } RasterBuffer rbuf_tmp = new RasterBuffer(); unsafe { rbuf_tmp.Attach(pmap_tmp.buf(), pmap_tmp.Width(), pmap_tmp.Height(), m_app.FlipY() ? pmap_tmp.stride() : -pmap_tmp.stride(), pmap_tmp.bpp()); m_pmap_img[idx] = new PixelMap(); m_pmap_img[idx].Create(pmap_tmp.Width(), pmap_tmp.Height(), PlatformSupportAbstract.GetBitDepthForPixelFormat(m_format), 0); dst.Attach(m_pmap_img[idx].buf(), m_pmap_img[idx].Width(), m_pmap_img[idx].Height(), m_app.FlipY() ? m_pmap_img[idx].stride() : -m_pmap_img[idx].stride(), m_pmap_img[idx].bpp()); switch (m_format) { case PlatformSupportAbstract.PixelFormats.Bgr24: switch (pmap_tmp.bpp()) { case 24: unsafe { for (uint y = 0; y < rbuf_tmp.Height(); y++) { byte *sourceBuffer = rbuf_tmp.GetPixelPointer((int)rbuf_tmp.Height() - (int)y - 1); byte *destBuffer = dst.GetPixelPointer((int)y); for (uint x = 0; x < rbuf_tmp.Width(); x++) { *destBuffer++ = sourceBuffer[0]; *destBuffer++ = sourceBuffer[1]; *destBuffer++ = sourceBuffer[2]; sourceBuffer += 3; } } } break; default: throw new System.NotImplementedException(); } break; case PlatformSupportAbstract.PixelFormats.Rgb24: switch (pmap_tmp.bpp()) { // case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgb24()); break; case 24: //color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgba32()); unsafe { for (uint y = 0; y < rbuf_tmp.Height(); y++) { byte *sourceBuffer = rbuf_tmp.GetPixelPointer((int)rbuf_tmp.Height() - (int)y - 1); byte *destBuffer = dst.GetPixelPointer((int)y); for (uint x = 0; x < rbuf_tmp.Width(); x++) { *destBuffer++ = sourceBuffer[2]; *destBuffer++ = sourceBuffer[1]; *destBuffer++ = sourceBuffer[0]; sourceBuffer += 3; } } } break; // case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgb24()); break; default: throw new System.NotImplementedException(); } break; case PlatformSupportAbstract.PixelFormats.Bgra32: switch (pmap_tmp.bpp()) { case 24: unsafe { for (uint y = 0; y < rbuf_tmp.Height(); y++) { byte *sourceBuffer = rbuf_tmp.GetPixelPointer((int)rbuf_tmp.Height() - (int)y - 1); byte *destBuffer = dst.GetPixelPointer((int)y); for (uint x = 0; x < rbuf_tmp.Width(); x++) { *destBuffer++ = sourceBuffer[0]; *destBuffer++ = sourceBuffer[1]; *destBuffer++ = sourceBuffer[2]; *destBuffer++ = 255; sourceBuffer += 3; } } } break; } break; case PlatformSupportAbstract.PixelFormats.Rgba32: switch (pmap_tmp.bpp()) { // case 16: color_conv(dst, &rbuf_tmp, color_conv_rgb555_to_rgba32()); break; case 24: //color_conv(dst, &rbuf_tmp, color_conv_bgr24_to_rgba32()); unsafe { for (uint y = 0; y < rbuf_tmp.Height(); y++) { byte *sourceBuffer = rbuf_tmp.GetPixelPointer((int)rbuf_tmp.Height() - (int)y - 1); byte *destBuffer = dst.GetPixelPointer((int)y); for (uint x = 0; x < rbuf_tmp.Width(); x++) { *destBuffer++ = sourceBuffer[2]; *destBuffer++ = sourceBuffer[1]; *destBuffer++ = sourceBuffer[0]; *destBuffer++ = 255; sourceBuffer += 3; } } } break; // case 32: color_conv(dst, &rbuf_tmp, color_conv_bgra32_to_rgba32()); break; default: throw new System.NotImplementedException(); } break; default: throw new System.NotImplementedException(); } } return(true); }