Public paste
Undefined
By: Guest | Date: Nov 21 2009 23:48 | Format: None | Expires: never | Size: 1.15 KB | Hits: 794

  1. DWORD pGdi;
  2.  
  3. void InitGdi()
  4. {
  5.         Gdiplus::GdiplusStartupInput gdiStartInput;
  6.         Gdiplus::GdiplusStartup(&pGdi, &gdiStartInput, NULL);
  7. }
  8.  
  9. void DeInitGdi()
  10. {
  11.         Gdiplus::GdiplusShutdown(pGdi);
  12. }
  13.  
  14. Gdiplus::Color GdiCreateColor(int a, int r, int g, int b)
  15. {
  16.         return Gdiplus::Color::Color(a, r, g, b);
  17. }
  18.  
  19. void GdiDrawLine(Gdiplus::Color color, int x1, int y1, int x2, int y2, float penwidth, HDC hdc)
  20. {
  21.         Gdiplus::Graphics gdiGraphic(hdc);
  22.         Gdiplus::Pen gdiPen(Gdiplus::Color(color), penwidth);
  23.         gdiGraphic.DrawLine(&gdiPen, x1, y1, x2, y2);
  24.         gdiGraphic.ReleaseHDC(hdc);
  25. }
  26.  
  27. void GdiDrawRect(Gdiplus::Color color, int x1, int y1, int rectw, int recth, float penwidth, HDC hdc)
  28. {
  29.         Gdiplus::Graphics gdiGraphic(hdc);
  30.         Gdiplus::Pen gdiPen(Gdiplus::Color(color), penwidth);
  31.         gdiGraphic.DrawRectangle(&gdiPen, x1, y1, rectw, recth);
  32.         gdiGraphic.ReleaseHDC(hdc);
  33. }
  34.  
  35. void GdiDrawEllipse(Gdiplus::Color color, int x, int y, int ellipsew, int ellipseh, float penwidth, HDC hdc)
  36. {
  37.         Gdiplus::Graphics gdiGraphic(hdc);
  38.         Gdiplus::Pen gdiPen(Gdiplus::Color(color), penwidth);
  39.         gdiGraphic.DrawEllipse(&gdiPen, x, y, ellipsew, ellipseh);
  40.         gdiGraphic.ReleaseHDC(hdc);
  41. }