MrKris1224 Posted July 4, 2018 Share Posted July 4, 2018 (edited) Hi, i'am making simple 2D "engine" using gdi+ and now i'am trying to make function that will be able to rotate image before i draw it to buffor. I'am loading images by _GDIPlus_ImageLoadFromFile() then draw them to buffor by _GDIPlus_GraphicsDrawImage() and then copying that buffor to GUI's buffor. The question is how can i rotate image object before i draw it to buffor? Edited July 4, 2018 by MrKris1224 Link to comment Share on other sites More sharing options...
InnI Posted July 4, 2018 Share Posted July 4, 2018 _GDIPlus_ImageRotateFlip() ; or _GDIPlus_MatrixRotate() MrKris1224 1 Link to comment Share on other sites More sharing options...
MrKris1224 Posted July 4, 2018 Author Share Posted July 4, 2018 _GDIPlus_ImageRotateFlip() have only 4 angles _GdiPlus_MatrixRotate() doesn't work for me (image object) Link to comment Share on other sites More sharing options...
InnI Posted July 4, 2018 Share Posted July 4, 2018 3 hours ago, MrKris1224 said: doesn't work for me Really? Strange, but it works for me. What am I doing wrong? #include <ScreenCapture.au3> ; create temp image file _ScreenCapture_Capture(@ScriptDir & "\temp.png", 0, 0, 200, 200) ; ---------------- _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\temp.png") $hBuffer = _GDIPlus_BitmapCreateFromScan0(400, 400) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBuffer) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixRotate($hMatrix, 20) _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 150, 0) $hGUI = GUICreate("test") GUISetState() $hGraph = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImage($hGraph, $hBuffer, 0, 0) Do Until GUIGetMsg() = -3 _GDIPlus_GraphicsDispose($hGraph) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($hImage) _GDIPlus_BitmapDispose($hBuffer) _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_Shutdown() MrKris1224 1 Link to comment Share on other sites More sharing options...
MrKris1224 Posted July 4, 2018 Author Share Posted July 4, 2018 Ok, but this rotatining all of images i drawn. I wanna rotate one image Link to comment Share on other sites More sharing options...
InnI Posted July 4, 2018 Share Posted July 4, 2018 13 minutes ago, MrKris1224 said: I wanna rotate one image See example for _GDIPlus_MatrixRotate in help file. MrKris1224 1 Link to comment Share on other sites More sharing options...
MrKris1224 Posted July 4, 2018 Author Share Posted July 4, 2018 Thanks so much i needed exactly that Topic to close 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