From 54c61a7ac2e40dd488008f0b6aa81e427f3ca970 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 24 Aug 2015 01:37:37 +0200 Subject: Resizing bitmaps --- Linux_C_12/cpicture_121.c | 42 +++++++++++------------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'Linux_C_12') diff --git a/Linux_C_12/cpicture_121.c b/Linux_C_12/cpicture_121.c index c430d46..cb121ee 100644 --- a/Linux_C_12/cpicture_121.c +++ b/Linux_C_12/cpicture_121.c @@ -1134,37 +1134,17 @@ void WinDrawResizedBitmap (gint sourcew, gint sourceh, gint destx, gint desty, gint destw, gint desth, GdkPixbuf *pixbuf, GdkDrawable *inDraw, OS ios, GdkDrawable **outDraw, OS *oos) { -/* HDC compatibleDC; - POINT sourcesize, destsize, dest, origin; - HGDIOBJ prevObj; - - sourcesize.x = sourcew; - sourcesize.y = sourceh; - origin.x = 0; - origin.y = 0; - destsize.x = destw; - destsize.y = desth; - dest.x = destx; - dest.y = desty; - - // Create a compatible device context - compatibleDC = CreateCompatibleDC (hdc); - if (compatibleDC == NULL) - rMessageBox (NULL,MB_APPLMODAL,"WinDrawResizedBitmap","CreateCompatibleDC failed"); - - // Select bitmap into compatible device context - prevObj = SelectObject (compatibleDC, hbmp); - SetMapMode (compatibleDC, GetMapMode (hdc)); - DPtoLP (hdc, &destsize, 1); - DPtoLP (hdc, &dest, 1); - DPtoLP (compatibleDC, &sourcesize, 1); - DPtoLP (compatibleDC, &origin, 1); - - if (!StretchBlt (hdc, dest.x, dest.y, destsize.x, destsize.y, compatibleDC, origin.x, origin.y, sourcesize.x, sourcesize.y, SRCCOPY)) - rMessageBox (NULL,MB_APPLMODAL,"WinDrawResizedBitmap","StretchBlt failed"); - - SelectObject (compatibleDC, prevObj); - DeleteDC (compatibleDC);*/ + if (inDraw) { + gdk_pixbuf_render_to_drawable(gdk_pixbuf_scale_simple(pixbuf, destw, desth, GDK_INTERP_NEAREST), + inDraw, theDrawGC, + 0, 0, + destx, desty, + destw, desth, + GDK_RGB_DITHER_NONE, + 0, 0 + ); + } + printf("WinDrawResizedBitmap is not implemented\n"); *outDraw = inDraw; *oos = ios; -- cgit v1.2.3