Jump to content

Recommended Posts

Posted (edited)

Fixed. This repaints the image correctly=)

#include <GDIPLUS.au3>

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\Clock_Blank.jpg')
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)

$backgroundimage = _GDIPlus_BitmapCreateFromGraphics(400, 150, $hGraphic)
$background = _GDIPlus_ImageGetGraphicsContext($backgroundimage)


$hFamily = _GDIPlus_FontFamilyCreate ("Britannic Bold")
$hFont = _GDIPlus_FontCreate($hFamily, 20, 1)
$tLayout = _GDIPlus_RectFCreate (104, 48, 400, 60)
$hFormat  = _GDIPlus_StringFormatCreate(0)
$hBrush  = _GDIPlus_BrushCreateSolid(0xA7FFFFFF)


Do
    
_GDIPlus_GraphicsClear($background, 0xFF000000)
_GDIPlus_GraphicsDrawImageRect($background, $hImage,0,0, 400, 150)

$time = @HOUR & ":" & @MIN

if @HOUR  >= 13 then 
    
$tLayout = _GDIPlus_RectFCreate (122, 48, 400, 60)
$time = @HOUR - 12 & ":" & @MIN

EndIf

_GDIPlus_GraphicsDrawStringEx($background, $time, $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_ImageSaveToFile($backgroundimage, @ScriptDir & '\Clocktest.jpg')



Sleep(3000)

until False

Func OnAutoItExit ( )
_GDIPlus_Shutdown()
EndFunc
Edited by Szhlopp
Posted

Any help?

I can re-read the image from the file, but I don't want to constantly do this. I just want to be able to clear what ever I've painted on the screen and then re-draw everything.

Posted

Why do you even need to call _GDIPlus_GraphicsClear? You are redrawing everything over it anyways.

Posted

Why do you even need to call _GDIPlus_GraphicsClear? You are redrawing everything over it anyways.

Because I wasn't clearing it and it was layering when the time changed.

I fixed it. Thanks though

Created a seperate 'Layer' to work on with the text, it works fine now=)

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