dantay9 Posted July 13, 2009 Share Posted July 13, 2009 (edited) I am not well versed in GDI+ so I decided to try it out a bit. I am doing ok so far. I used a doublebuffer template by monoceres and switched it up a bit. I am trying to draw a trapezoid and I know you have to use _GDIPlus_GraphicsDrawPolygon. I think all of the points are correct because the vertecies of the trapezoid are correct. My problem is that the two bases aren't flat. They dip into the center of the trapezoid. I am probably missing something really easy. Thanks in advance!Trapezoid.au3 Edited July 13, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Malkey Posted July 13, 2009 Share Posted July 13, 2009 I am not well versed in GDI+ so I decided to try it out a bit. I am doing ok so far. I used a doublebuffer template by monoceres and switched it up a bit. I am trying to draw a trapezoid and I know you have to use _GDIPlus_GraphicsDrawPolygon. I think all of the points are correct because the vertecies of the trapezoid are correct. My problem is that the two bases aren't flat. They dip into the center of the trapezoid. I am probably missing something really easy. Thanks in advance! A trapezoid. ; Local $Points[5][2] = [[4,0],[25,69],[33,27],[123,27],[131,69]] ; Link to comment Share on other sites More sharing options...
dantay9 Posted July 13, 2009 Author Share Posted July 13, 2009 (edited) Wow. I'll have to see what I was doing wrong. I knew it was easy Edit: My points were fine, I just put them in the wrong order expandcollapse popup#include <GDIplus.au3> Global Const $width = 382 Global Const $height = 452 Global $graphics, $bitmap, $backbuffer, $hPenBlack, $hPenRed $GUI = GUICreate("GDI+", $width, $height) GUISetState() Draw($GUI) While WinExists($GUI) While WinActive($GUI) $nMsg = GUIGetMsg() Switch $nMsg Case - 3 close() Case Else ReDraw($graphics, $backbuffer, 176, 381, 136) EndSwitch Sleep(10) WEnd Sleep(200) WEnd Func Draw($hWnd) _GDIPlus_Startup() $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) ReDraw($graphics, $backbuffer, 176, 381, 136) EndFunc ;==>Draw Func ReDraw($hBuffer, $hGraphics, $Left, $Bottom, $Length) Local $Points[5][2] _GDIPlus_GraphicsClear($backbuffer, 0x00F7F7F7) $Points[0][0] = 4 $Points[0][1] = 0 $Points[1][0] = $Left $Points[1][1] = $Bottom $Points[2][0] = $Left + 5 $Points[2][1] = $Bottom - 5 $Points[3][0] = $Points[1][0] + $Length - 5 $Points[3][1] = $Bottom - 5 $Points[4][0] = $Points[1][0] + $Length $Points[4][1] = $Bottom $Poly = _GDIPlus_GraphicsDrawPolygon($hGraphics, $Points) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height) EndFunc ;==>ReDraw Func close() _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_BitmapDispose($bitmap) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_Shutdown() Exit EndFunc ;==>close Edited July 13, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now