Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted (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 by pixelsearch

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted

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().

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...