void Canvas::invert_stretch_transparent(const Bitmap &src, Color key) { assert(IsDefined()); assert(src.IsDefined()); HDC virtual_dc = GetCompatibleDC(); HBITMAP old = (HBITMAP)::SelectObject(virtual_dc, src.GetNative()); const PixelSize size = src.GetSize(); BufferCanvas inverted(*this, size.cx, size.cy); ::BitBlt(inverted, 0, 0, size.cx, size.cy, virtual_dc, 0, 0, NOTSRCCOPY); ::SelectObject(virtual_dc, old); #ifdef _WIN32_WCE ::TransparentImage(dc, 0, 0, get_width(), get_height(), inverted, 0, 0, size.cx, size.cy, key); #else ::TransparentBlt(dc, 0, 0, get_width(), get_height(), inverted, 0, 0, size.cx, size.cy, key); #endif }
void Canvas::Copy(int dest_x, int dest_y, unsigned dest_width, unsigned dest_height, HBITMAP src, int src_x, int src_y, DWORD dwRop) { assert(IsDefined()); assert(src != nullptr); HDC virtual_dc = GetCompatibleDC(); HBITMAP old = (HBITMAP)::SelectObject(virtual_dc, src); Copy(dest_x, dest_y, dest_width, dest_height, virtual_dc, src_x, src_y, dwRop); ::SelectObject(virtual_dc, old); }
void Canvas::copy(PixelScalar dest_x, PixelScalar dest_y, UPixelScalar dest_width, UPixelScalar dest_height, HBITMAP src, PixelScalar src_x, PixelScalar src_y, DWORD dwRop) { assert(IsDefined()); assert(src != NULL); HDC virtual_dc = GetCompatibleDC(); HBITMAP old = (HBITMAP)::SelectObject(virtual_dc, src); copy(dest_x, dest_y, dest_width, dest_height, virtual_dc, src_x, src_y, dwRop); ::SelectObject(virtual_dc, old); }