void LKIcon::Draw(LKSurface& Surface, const int x, const int y, const int cx, const int cy) const { #ifdef USE_GDI HGDIOBJ old = ::SelectObject(Surface.GetTempDC(), (HBITMAP) _bitmap); if (_size.cx != cx || _size.cy != cy) { ::StretchBlt(Surface, x, y, cx, cy, Surface.GetTempDC(), 0, 0, _size.cx, _size.cy, SRCPAINT); ::StretchBlt(Surface, x, y, cx, cy, Surface.GetTempDC(), _size.cx, 0, _size.cx, _size.cy, SRCAND); } else { ::BitBlt(Surface, x, y, cx, cy, Surface.GetTempDC(), 0, 0, SRCPAINT); ::BitBlt(Surface, x, y, cx, cy, Surface.GetTempDC(), _size.cx, 0, SRCAND); } ::SelectObject(Surface.GetTempDC(), old); #elif defined(ENABLE_OPENGL) #ifdef USE_GLSL OpenGL::texture_shader->Use(); #else const GLEnable<GL_TEXTURE_2D> scope; OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); #endif const GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GLTexture &texture = *_bitmap.GetNative(); texture.Bind(); texture.Draw(x, y, cx, cy, 0, 0, _size.cx, _size.cy); #else Canvas& canvas = Surface; if(canvas.IsDefined() && _bitmap.IsDefined()) { if (_size.cx != cx || _size.cy != cy) { canvas.StretchOr(x, y, cx, cy, _bitmap, 0, 0, _size.cx, _size.cy); canvas.StretchAnd(x, y, cx, cy, _bitmap, _size.cx, 0, _size.cx, _size.cy); } else { canvas.CopyOr(x, y, cx, cy, _bitmap, 0, 0); canvas.CopyAnd(x, y, cx, cy, _bitmap, _size.cx, 0); } } #endif }