linknet Posted March 18, 2021 Posted March 18, 2021 I'm using _GDIPlus_GraphicsDrawString to draw text on a bitmap image which works fine but I can't get it to draw the text in any other colour than black. How can I change the colour of text drawn with this function.
Werty Posted March 18, 2021 Posted March 18, 2021 (edited) Take a look at _GDIPlus_GraphicsDrawStringEx() example and change the brush color. https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_GraphicsDrawStringEx.htm Edited March 18, 2021 by Werty tpyo Some guy's script + some other guy's script = my script!
linknet Posted March 18, 2021 Author Posted March 18, 2021 Thanks for the reply, yes, I had seen that but it looked unnecessarily complex. I'd still like to know if it's possible to change the colour using _GDIPlus_GraphicsDrawString.
pixelsearch Posted March 18, 2021 Posted March 18, 2021 (edited) I don't know what @UEZ or @jpm think about what follows, but OP's question is an interesting feature and it could be done in a simple way, by adding an optional parameter to Func _GDIPlus_GraphicsDrawString() . Here is the beginning of the original function as found in GDIPlus.au3 Func _GDIPlus_GraphicsDrawString($hGraphics, $sString, $nX, $nY, $sFont = "Arial", $fSize = 10, $iFormat = 0) Local $hBrush = _GDIPlus_BrushCreateSolid() ... EndFunc ;==>_GDIPlus_GraphicsDrawString If you just change the 1st line in the function, for example : Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000) Then running the example from the help file would display "Hello world" in red. If you guys think it's correct, then it could be a possible feature to add to AutoIt Edit: in that case, allowing the Default keyword for parameters preceding the last one could also be user friendly Edited March 18, 2021 by pixelsearch "I think you are searching a bug where there is no bug... don't listen to bad advice."
UEZ Posted March 18, 2021 Posted March 18, 2021 I would say you should use _GDIPlus_GraphicsDrawStringEx() instead to get the feature you want. 😉 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
linknet Posted March 18, 2021 Author Posted March 18, 2021 Ok, thanks for all the info, it appears that by using _GDIPlus_GraphicsDrawString() the colour can't be changed. So I just need to use _GDIPlus_GraphicsDrawStringEx().
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