UEZ Posted December 24, 2009 Share Posted December 24, 2009 (edited) When I want to use _GDIPlus_GraphicsDrawImage() for displaying images then some images will be displayed in window stretched! expandcollapse popup#include <GuiConstantsEx.au3> #include <GDIPlus.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $hWnd1, $hWnd2, $hGraphic, $file, $hImage, $hMatrix Global $iX, $iY $file = FileOpenDialog("Select image to load", @ScriptDir, "Images (*.jpg;*.bmp)") _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($file) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) $hWnd1 = GUICreate("_GDIPlus_GraphicsDrawImage", $iX, $iY, @DesktopWidth / 2 - $iX - 10) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd1) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) ;is not working properly with some images ;_GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY) ;is working _GDIPlus_ImageDispose($hImage) $hWnd2 = GUICreate("GUICtrlCreatePic", $iX, $iY, @DesktopWidth / 2 + 10) GUISetBkColor(0) GUICtrlCreatePic($file, 0, 0, $iX, $iY) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Do Until Not Sleep(10000000) Func _Exit() _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit EndFunc I attached 2 images, both images will be displayed stretched (zoomed) with _GDIPlus_GraphicsDrawImage($hGraphic, $hImage, 0, 0) function but not with GUICtrlCreatePic($file, 0, 0, $iX, $iY)! Why? I tried to re-save the images but no success! I couldn't see the difference between the jpg files (formats) Thanks and merry x-mas! UEZ Edited February 20, 2010 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...
Yashied Posted December 24, 2009 Share Posted December 24, 2009 I think the problem is in the picture. Try to resave Eye.jpg and everything will be OK. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
UEZ Posted December 24, 2009 Author Share Posted December 24, 2009 (edited) I think the problem is in the picture. Try to resave Eye.jpg and everything will be OK.Intel.jpg was originally in BMP format which will be displayed stretched (zoomed)!Thanks,UEZ Edited February 15, 2010 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...
UEZ Posted February 19, 2010 Author Share Posted February 19, 2010 (edited) Solution is to use _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iX, $iY) instead! I don't know why it is not working on some images with _GDIPlus_GraphicsDrawImage() but anyway...UEZ Edited February 20, 2010 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...
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