Belini Posted June 5, 2023 Posted June 5, 2023 I would like to know if it is possible to outline the letters that appear in a transparent window or with a black background using GDI, would it be contouring around the letters of cdg files, would it be possible to add contours to these letters? My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Dan_555 Posted June 5, 2023 Posted June 5, 2023 (edited) In a basic programming language you would do something like this: Set color to red. Draw the text around the text position 9 (or more, depending on how big the outline should be) times. Set the color to yellow and draw the text at the text position. something like: Txt$="Test text" tx=10 ty=10 color $ff,0,0 for x=-1 to 1 for y=-1 to 1 Text tx+x,ty+y,Txt$ next next Color $ff,$ff,0 Text tx,ty,txt$ I modified the Autoit GDI+ help example and here is the result: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI, $hGraphic ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) GUISetState(@SW_SHOW) ; Draw a string _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $tx=30 $ty=30 $txt="Hello World" for $x=-1 to 1 for $y=-1 to 1 _GDIPlus_GraphicsDrawString($hGraphic, $txt, $tx+$x, $ty+$y,Default,20,Default,0xFFFF0000) Next Next _GDIPlus_GraphicsDrawString($hGraphic, $txt, $tx, $ty, Default, 20, Default, 0xFFFFFF00) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example Edited June 5, 2023 by Dan_555 Some of my script sourcecode
Belini Posted June 5, 2023 Author Posted June 5, 2023 @Dan_555 I think I didn't explain it well but I need to outline the letters in an external window and possibly there's no way to do this, for it to work I think the letters would have to be created with GDI as well. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Andreik Posted June 5, 2023 Posted June 5, 2023 Something like that? #include <GDIPlus.au3> $hMain = GUICreate('GDI Outline', 800, 600) GUISetState(@SW_SHOW, $hMain) DrawOutlineText($hMain, 'Some text', 200, 200, 300, 100, 0xFFFF8000, 0xFFC0C0C0) Do Sleep(10) Until GUIGetMsg() = -3 Func DrawOutlineText($hGUI, $sText, $iX, $iY, $iWidth, $iHeight, $iTextColor, $iOutlineColor, $sFont='Arial', $iSize = 50) _GDIPlus_Startup() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2) Local $hFontFamily = _GDIPlus_FontFamilyCreate($sFont) Local $hPath = _GDIPlus_PathCreate() Local $tLayout = _GDIPlus_RectFCreate($iX, $iY, $iWidth, $iHeight) Local $hPen = _GDIPlus_PenCreate($iTextColor, 2) Local $hBrush = _GDIPlus_BrushCreateSolid($iOutlineColor) _GDIPlus_PathAddString($hPath, $sText, $tLayout, $hFontFamily, 0, $iSize) _GDIPlus_GraphicsDrawPath($hGraphics, $hPath, $hPen) _GDIPlus_GraphicsFillPath($hGraphics, $hPath, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_PathDispose($hPath) _GDIPlus_FontFamilyDispose($hFontFamily) _GDIPlus_Shutdown() EndFunc
UEZ Posted June 5, 2023 Posted June 5, 2023 You may have a look here: 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Belini Posted June 5, 2023 Author Posted June 5, 2023 (edited) @Andreik I don't know what text I'm going to find because it's a video window that plays a .cdg file and each song has a text. @UEZ in this case it would not be in images but in a video playing cdg file. I think that identifying the text of another window and putting an outline around it must not be possible at all. Edited June 5, 2023 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Andreik Posted June 5, 2023 Posted June 5, 2023 Seems like you need to overlay an existing text in a video/image. So your problem it's not regarding GDI but OCR maybe.
Belini Posted June 7, 2023 Author Posted June 7, 2023 ok @Andreik I will research about OCR. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
DutchCoder Posted January 16, 2024 Posted January 16, 2024 Func _CreateLabel($_text, $_x, $_y, $_w = Default, $_h = Default, $_style = Default, $_fgcol = Default, $_bkcol = 0) Local $_d[4][2] = [[0, -1], [0, 1], [-1, 0], [1, 0]] For $_z = 0 To 3 GUICtrlCreateLabel($_text, $_x + $_d[$_z][0], $_y + $_d[$_z][1], $_w, $_h, $_style) GUICtrlSetColor(-1, $_bkcol) GUICtrlSetBkColor(-1, -2) Next $_label = GUICtrlCreateLabel($_text, $_x, $_y, $_w, $_h, $_style) GUICtrlSetColor(-1, $_fgcol) GUICtrlSetBkColor(-1, -2) Return $_label EndFunc Func _SetLabelData($_handle, $_data) For $_z = 0 To 4 GUICtrlSetData($_handle - $_z, $_data) Next EndFunc Simple solution as replacement for your GUICtrlCreateLabel() and GUICtrlSetData() Belini 1
Belini Posted January 16, 2024 Author Posted January 16, 2024 I tested it here with some changes and found it interesting expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> global $_label, $Form1 $Form1 = GUICreate("Form1", 400, 150, -1, -1) _CreateLabel("TESTE", 40, 50, 640, 50, Default, Default, 0X00FF00, "Arial", 30) _SetLabelData($_label, "TESTANDO") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _CreateLabel($_text, $_x, $_y, $_w = Default, $_h = Default, $_style = Default, $_fgcol = Default, $_bkcol = 0, $ft_type = "Arial", $ft_size = 12) Local $_d[4][2] = [[0, -1], [0, 1], [-1, 0], [1, 0]] For $_z = 0 To 3 GUICtrlCreateLabel($_text, $_x + $_d[$_z][0], $_y + $_d[$_z][1], $_w, $_h, $_style) GUICtrlSetFont(-1, $ft_size, 400, 4, $ft_type) GUICtrlSetColor(-1, $_bkcol) GUICtrlSetBkColor(-1, -2) Next $_label = GUICtrlCreateLabel($_text, $_x, $_y, $_w, $_h, $_style) GUICtrlSetFont(-1, $ft_size, 400, 4, $ft_type) GUICtrlSetColor(-1, $_fgcol) GUICtrlSetBkColor(-1, -2) Return $_label EndFunc Func _SetLabelData($_handle, $_data) For $_z = 0 To 4 GUICtrlSetData($_handle - $_z, $_data) Next EndFunc My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
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