nanogui: How to load a bitmap?


Previous by date: 24 Jan 2007 11:51:50 +0000 How to load a bitmap?, Franco Casadei
Next by date: 24 Jan 2007 11:51:50 +0000 Re: How to load a bitmap?, Franco Casadei
Previous in thread: 24 Jan 2007 11:51:50 +0000 How to load a bitmap?, Franco Casadei
Next in thread: 24 Jan 2007 11:51:50 +0000 Re: How to load a bitmap?, Franco Casadei

Subject: Re: [nanogui] How to load a bitmap?
From: "Uwe Klatt" ####@####.####
Date: 24 Jan 2007 11:51:50 +0000
Message-Id: <001501c73fad$f2058a90$081710ac@arnstein.miwe.de>

Hello,
> I'm using Microwindow with Win32 Api; I cannot figure out how is
> possible to load a bitmap and show it in my window (at x,y position)
> in a similar way provided by GrLoadImageFormFile() for those who use
> Nano-X api.

I am using something like this:

void DrawImage(HWND hWnd, HDC hdc, int x, int y, int dx, int dy, char 
*filename)
{
  HDC hdcMem;
  HBITMAP hbmp, hbmpOrg;
  PMWIMAGEHDR image;
  int image_id;
  image_id = GdLoadImageFromFile(hdc->psd,filename,0);
  hdcMem = CreateCompatibleDC(hdc);
  image = (PMWIMAGEHDR)GdGetImage(image_id);
  hbmp = CreateCompatibleBitmap(hdcMem, image->width, image->height);
  hbmpOrg = SelectObject(hdcMem, hbmp);
  DrawDIB(hdcMem, 0, 0, image);
  StretchBlt(hdc, x, y, dx, dy, hdcMem, 0, 0, image->width-1, 
image->height-1,
                   MWROP_SRCCOPY);
  DeleteObject(SelectObject(hdcMem, hbmpOrg));
  DeleteDC(hdcMem);
  GdFreeImage(image_id);
  return;
}

Bye
Uwe


Previous by date: 24 Jan 2007 11:51:50 +0000 How to load a bitmap?, Franco Casadei
Next by date: 24 Jan 2007 11:51:50 +0000 Re: How to load a bitmap?, Franco Casadei
Previous in thread: 24 Jan 2007 11:51:50 +0000 How to load a bitmap?, Franco Casadei
Next in thread: 24 Jan 2007 11:51:50 +0000 Re: How to load a bitmap?, Franco Casadei


Powered by ezmlm-browse 0.20.