Andreik Posted August 27, 2008 Share Posted August 27, 2008 I write a simple GDI+ example, maybe some people will learn something new. expandcollapse popup#include <GDIPlus.au3> #include <Misc.au3> Func GdipRotateTextureTransform($hBrush,$Angle,$MatrixOrder=0) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipRotateTextureTransform","int",$hBrush,"float",$Angle,"int",$MatrixOrder) EndFunc Func GdipCreateTexture($hImg,$WrapMode=0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipCreateTexture","int",$hImg,"int",$WrapMode,"int*",0) Return $RESULT[3] EndFunc Func GdipScaleTextureTransform($hBrush,$SX,$SY,$MatrixOrder=0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipScaleTextureTransform","int",$hBrush,"float",$SX,"float",$SY,"int",$MatrixOrder) EndFunc _GDIPlus_Startup() $ANGLE = 0 $LOAD = FileOpenDialog("IMAGE",@DesktopDir,"Images (*.jpg;*.png;*.bmp;*.gif;*.tif)",1) If @error Then Exit $ZOOM = InputBox("ZOOM","Please select zoom","1") $IMAGE = _GDIPlus_ImageLoadFromFile($LOAD) $X = _GDIPlus_ImageGetWidth($IMAGE)*$ZOOM $Y = _GDIPlus_ImageGetHeight($IMAGE)*$ZOOM $GUI = GUICreate("GDI+",$X,$Y,-1,-1,0x80000000) $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState(@SW_SHOW,$GUI) $BRUSH = GdipCreateTexture($IMAGE,0x00) GdipScaleTextureTransform($BRUSH,$ZOOM,$ZOOM,0x00) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) While 1 $MSG = GUIGetMsg() If _IsPressed('25') Then GdipRotateTextureTransform($BRUSH,$ANGLE+1,0) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf _IsPressed('27') Then GdipRotateTextureTransform($BRUSH,$ANGLE-1,0) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf $MSG = -3 Then _GDIPlus_BrushDispose($BRUSH) _GDIPlus_ImageDispose($IMAGE) _GDIPlus_GraphicsDispose($GRAPHIC) _GDIPlus_Shutdown() Exit EndIf Sleep(15) WEnd When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Zinthose Posted August 27, 2008 Share Posted August 27, 2008 Very Nice, I love the effect is creates with the previously painted image. FYI: You forgot to mention, You have to Press <Left Arrow> or <Right Arrow> to activate rotation and Press <Esc> to exit. --- TTFN Link to comment Share on other sites More sharing options...
Andreik Posted August 27, 2008 Author Share Posted August 27, 2008 Very Nice, I love the effect is creates with the previously painted image.FYI: You forgot to mention, You have to Press <Left Arrow> or <Right Arrow> to activate rotation and Press <Esc> to exit.Yeah. Thanks for you mentions. I'm forgetful. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted August 27, 2008 Share Posted August 27, 2008 Very nice! I sense an image viewer coming soon. expandcollapse popup#include <GDIPlus.au3> #include <Misc.au3> Func GdipRotateTextureTransform($hBrush,$Angle,$MatrixOrder=0) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipRotateTextureTransform","int",$hBrush,"float",$Angle,"int",$MatrixOrder) EndFunc Func GdipCreateTexture($hImg,$WrapMode=0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipCreateTexture","int",$hImg,"int",$WrapMode,"int*",0) Return $RESULT[3] EndFunc Func GdipScaleTextureTransform($hBrush,$SX,$SY,$MatrixOrder=0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL,"int","GdipScaleTextureTransform","int",$hBrush,"float",$SX,"float",$SY,"int",$MatrixOrder) EndFunc _GDIPlus_Startup() $ANGLE = 0 $LOAD = FileOpenDialog("IMAGE",@DesktopDir,"Images (*.jpg;*.png;*.bmp;*.gif;*.tif)",1) If @error Then Exit $ZOOM = InputBox("ZOOM","Please select zoom","1") $IMAGE = _GDIPlus_ImageLoadFromFile($LOAD) $X = _GDIPlus_ImageGetWidth($IMAGE)*$ZOOM $Y = _GDIPlus_ImageGetHeight($IMAGE)*$ZOOM $GUI = GUICreate("GDI+",$X,$Y,-1,-1,0x80000000) $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState(@SW_SHOW,$GUI) $BRUSH = GdipCreateTexture($IMAGE,0x00) GdipScaleTextureTransform($BRUSH,$ZOOM,$ZOOM,0x00) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) While 1 $MSG = GUIGetMsg() If _IsPressed('25') Then ;left GdipRotateTextureTransform($BRUSH,$ANGLE +1, 0) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf _IsPressed('26') Then ;up GdipScaleTextureTransform($BRUSH,$ZOOM +0.1,$ZOOM +0.1,0x00) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf _IsPressed('27') Then ;right GdipRotateTextureTransform($BRUSH,$ANGLE -0.1, 0) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf _IsPressed('28') Then ;down GdipScaleTextureTransform($BRUSH,$ZOOM -0.1,$ZOOM -0.1,0x00) _GDIPlus_GraphicsFillRect($GRAPHIC,0,0,$X,$Y,$BRUSH) ElseIf $MSG = -3 Then _GDIPlus_BrushDispose($BRUSH) _GDIPlus_ImageDispose($IMAGE) _GDIPlus_GraphicsDispose($GRAPHIC) _GDIPlus_Shutdown() Exit EndIf Sleep(15) WEnd Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
ptrex Posted August 28, 2008 Share Posted August 28, 2008 @Andreik Very nice !! Regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Alek Posted August 28, 2008 Share Posted August 28, 2008 (edited) sweet, needed this Edited August 28, 2008 by Alek [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
Andreik Posted August 28, 2008 Author Share Posted August 28, 2008 Thanks guys. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
rasim Posted August 29, 2008 Share Posted August 29, 2008 AndreikVery nice my friend! Link to comment Share on other sites More sharing options...
UEZ Posted August 29, 2008 Share Posted August 29, 2008 Thanks for sharing knowledge! I learned something new... UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
UEZ Posted August 30, 2008 Share Posted August 30, 2008 (edited) I made some simple modifications: expandcollapse popup#include <GDIPlus.au3> #include <Misc.au3> _GDIPlus_Startup() $ANGLE = 0 $LOAD = FileOpenDialog("IMAGE", @DesktopDir, "Images (*.jpg;*.png;*.bmp;*.gif;*.tif)", 1) If @error Then Exit $ZOOM = 1 $IMAGE = _GDIPlus_ImageLoadFromFile($LOAD) $X = _GDIPlus_ImageGetWidth($IMAGE) * $ZOOM $Y = _GDIPlus_ImageGetHeight($IMAGE) * $ZOOM $GUI = GUICreate("GDI+", $X, $Y, -1, -1, 0x80000000) $GRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState(@SW_SHOW, $GUI) $BRUSH = GdipCreateTexture($IMAGE, 0x00) GdipScaleTextureTransform($BRUSH, $ZOOM, $ZOOM, 0x00) _GDIPlus_GraphicsFillRect($GRAPHIC, 0, 0, $X, $Y, $BRUSH) $i = 0 $degree = 360 $pi = 3.1415926535897932 $zoom_factor = 0.002 While 1 $MSG = GUIGetMsg() If $i <= 2 * $degree Then GdipRotateTextureTransform($BRUSH, $ANGLE + 1 * Cos($i * $pi / 180) * Random(2, 4, 0) * ATan($i * $pi / 180), 0) GdipScaleTextureTransform($BRUSH, $ZOOM - $zoom_factor, $ZOOM - $zoom_factor, 0x00) Else GdipRotateTextureTransform($BRUSH, $ANGLE - 1 * Sin($i * $pi / 180) * Random(2, 4, 0) * ATan($i * $pi / 180), 0) GdipScaleTextureTransform($BRUSH, $ZOOM + $zoom_factor, $ZOOM + $zoom_factor, 0x00) EndIf _GDIPlus_GraphicsFillRect($GRAPHIC, 0, 0, $X, $Y, $BRUSH) $i += 1 If $i = 4 * $degree - 1 Then $i = 0 Sleep(1) If $MSG = -3 Then _GDIPlus_BrushDispose($BRUSH) _GDIPlus_ImageDispose($IMAGE) _GDIPlus_GraphicsDispose($GRAPHIC) _GDIPlus_Shutdown() Exit EndIf Sleep(15) WEnd Func GdipRotateTextureTransform($hBrush, $ANGLE, $MatrixOrder = 0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL, "int", "GdipRotateTextureTransform", "int", $hBrush, "float", $ANGLE, "int", $MatrixOrder) EndFunc ;==>GdipRotateTextureTransform Func GdipCreateTexture($hImg, $WrapMode = 0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL, "int", "GdipCreateTexture", "int", $hImg, "int", $WrapMode, "int*", 0) Return $RESULT[3] EndFunc ;==>GdipCreateTexture Func GdipScaleTextureTransform($hBrush, $SX, $SY, $MatrixOrder = 0x00) Local $DLL = "gdiplus.dll" Local $RESULT $RESULT = DllCall($DLL, "int", "GdipScaleTextureTransform", "int", $hBrush, "float", $SX, "float", $SY, "int", $MatrixOrder) EndFunc ;==>GdipScaleTextureTransform Maybe you like it! UEZ Edit: dynamic zooming Edited August 30, 2008 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Andreik Posted August 30, 2008 Author Share Posted August 30, 2008 I like your modifications. Is very hypnotist. When the words fail... music speaks. 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