Firex Posted July 28, 2013 Posted July 28, 2013 Good day, I was confused. expandcollapse popup#Include <GDIPlus.au3> #Include <WinAPIEx.au3> #Include <APIConstants.au3> #include <GUIConstants.au3> _GDIPlus_Startup() $_hGUI_Dlg = GUICreate( '', 250, 250, -1, -1, $WS_POPUP, BitOR( $WS_EX_TRANSPARENT, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_LAYERED )) GUISetBkColor($GUI_BKCOLOR_TRANSPARENT, $_hGUI_Dlg) GUISetState(@SW_SHOW, $_hGUI_Dlg) $_hGraphic = _GDIPlus_GraphicsCreateFromHWND( $_hGUI_Dlg ) $_hBitmap = _GDIPlus_BitmapCreateFromGraphics( 250, 250, $_hGraphic ) $_hBuffer = _GDIPlus_ImageGetGraphicsContext($_hBitmap) ;_GDIPlus_GraphicsSetSmoothingMode( $_hBuffer, 2 ) ;DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $_hBuffer, "int", 7) ;DllCall($ghGDIPDll, "uint", "GdipSetTextRenderingHint", "handle", $_hBuffer, "int", 4) ; --- $_hDC = _WinAPI_GetDC($_hGUI_Dlg) $_hCompatibleDC = _WinAPI_CreateCompatibleDC($_hDC) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", 250) DllStructSetData($tSize, "Y", 250) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", 0) DllStructSetData($tBlend, "Format", 0) $_hPen = _GDIPlus_PenCreate(0xFFE0E000, 20) ;And after try 22E0E000 :C While 1 If GUIGetMsg() = -3 Then _ _Quit() _GDIPlus_GraphicsClear($_hBuffer, 0x00000000) _GDIPlus_GraphicsDrawLine( $_hBuffer, 125, 0, 125, 250, $_hPen ) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_hBitmap, 0x00000000) _WinAPI_SelectObject($_hCompatibleDC, $gdibitmap) _WinAPI_UpdateLayeredWindow($_hGUI_Dlg, $_hDC, 0, $pSize, $_hCompatibleDC, $pSource, 0, $pBlend, 1) _WinAPI_DeleteObject($gdibitmap) ;_WinAPI_BitBlt($_hDC, 0, 0, 250, 250, $_hCompatibleDC, 0, 0, $SRCCOPY ); 0x00CC0020) ;0x00CC0020 = $SRCCOPY Sleep( 20 ) WEnd Func _Quit() _WinAPI_ReleaseDC($_hGUI_Dlg, $_hDC) _WinAPI_ReleaseDC($_hGUI_Dlg, $_hCompatibleDC) _WinAPI_DeleteDC($_hDC) _WinAPI_DeleteDC($_hCompatibleDC) ; --- _GDIPlus_GraphicsDispose($_hBuffer) _GDIPlus_BitmapDispose($_hBitmap) _GDIPlus_GraphicsDispose($_hGraphic) ; --- _GDIPlus_Shutdown() GuiDelete($_hGUI_Dlg) Exit EndFunc 50% transparent line(_GDIPlus_GraphicsDrawLine)(and also image) with a fully transparent background (Bitmap). Is this possible?
Artisan Posted July 29, 2013 Posted July 29, 2013 It's certainly possible. I've messed around with GDI, GDI+, and WINAPI stuff and haven't figured it out yet. Look up _WinAPI_SetLayeredWindowAttributes() in the helpfile and try its example. I know it doesn't use GDI+, but it's a good example using layered windows. I'm sure someone here can help you figure out how to draw a transparent image & line using GDI+.
UEZ Posted July 29, 2013 Posted July 29, 2013 (edited) Try this:expandcollapse popup#Include <GDIPlus.au3> #Include <WinAPIEx.au3> #Include <APIConstants.au3> #include <GUIConstants.au3> _GDIPlus_Startup() $_hGUI_Dlg = GUICreate( '', 250, 250, -1, -1, $WS_POPUP, BitOR( $WS_EX_LAYERED , $WS_EX_TOPMOST , $WS_EX_TOOLWINDOW )) GUISetState(@SW_SHOW, $_hGUI_Dlg) $_hBitmap = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", 250, "int", 250, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0) $_hBitmap = $_hBitmap[6] $_hBuffer = _GDIPlus_ImageGetGraphicsContext($_hBitmap) $_hPen = _GDIPlus_PenCreate(0xA0E0E000, 20) ;And after try 22E0E000 :C _GDIPlus_GraphicsDrawLine( $_hBuffer, 125, 0, 125, 250, $_hPen ) $_hDC = _WinAPI_GetDC($_hGUI_Dlg) $_hCompatibleDC = _WinAPI_CreateCompatibleDC($_hDC) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", 250) DllStructSetData($tSize, "Y", 250) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", 255) DllStructSetData($tBlend, "Format", 1) $gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($_hBitmap) _WinAPI_SelectObject($_hCompatibleDC, $gdibitmap) _WinAPI_UpdateLayeredWindow($_hGUI_Dlg, $_hDC, 0, $pSize, $_hCompatibleDC, $pSource, 0, $pBlend, 2) _WinAPI_DeleteObject($gdibitmap) While 1 If GUIGetMsg() = -3 Then _Quit() WEnd Func _Quit() _WinAPI_ReleaseDC($_hGUI_Dlg, $_hDC) _WinAPI_ReleaseDC($_hGUI_Dlg, $_hCompatibleDC) _WinAPI_DeleteDC($_hDC) _WinAPI_DeleteDC($_hCompatibleDC) _GDIPlus_GraphicsDispose($_hBuffer) _GDIPlus_BitmapDispose($_hBitmap) ; --- _GDIPlus_Shutdown() GuiDelete($_hGUI_Dlg) Exit EndFunc Br, UEZ Edited July 29, 2013 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
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