Jump to content

GDI+ edit file w/o GUI


Vort3x
 Share

Recommended Posts

Hey guys ! =)

I have a little question. I'm pretty good in Autoit I guess but I haven't worked with GDI+ for quite some time and I can't get it to work.

I have a simple script without a GUI. In the script directory I habe a file, let's call it "test.bmp".

Now upon execution I want the script draw something (a rect or a line or whatever) into "test.bmp" without opening any windows. Its this possible?

#include <GDIPlus.au3>

$file = @ScriptDir&"\test.bmp"

_GDIPlus_Startup()

;What do I have to add here?

_GDIPlus_GraphicsDrawLine(hGraphic, 10, 10, 50, 50) ;<- how do I make my file the hGraphic?

_GDIPlus_Shutdown()

Exit

Thank you so much for any help!

Link to comment
Share on other sites

like this

#include <GDIPlus.au3>

$file = @ScriptDir&"tc4.jpg"

_GDIPlus_Startup()

$hImage = _GDIPlus_ImageLoadFromFile($file)
If @error Then Exit 1
$hGfx = _GDIPlus_ImageGetGraphicsContext($hImage)
If @error Then Exit 2
$aRet = _GDIPlus_GraphicsDrawString($hGfx, "Hello world", 140, 110)
If Not $aRet Then Exit 3
$fSave = _GDIPlus_ImageSaveToFile($hImage, @ScriptDir&"returned.bmp")
If Not $fSave Then Exit 4
_GDIPlus_Shutdown()

Exit

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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