Sign in to follow this  
Followers 0
XxXFaNtA

Question About Drawing

7 posts in this topic

Hi everone :(

I've a small simple Question:

Is there something like ImageDraw in AutoIt?

For example:

$pic = FileOpenDialog("Picture Source", @ScriptDir , "Pictures only (*.*)", 3)

$image = ImageOpen($image)

$newimage = ImageDraw($image, $x, $y, 0x0000FF)

This would be quiet helpfull for making a something i'm planning :think:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Not without using DLL Calls (GDI/GDI+).

Unless you use a GUI. For example:

#Include <Misc.au3>;Beta Au3

;Starting positions
Global $X = 100
Global $Y = 100

;Picture size
Global $width = 150;Width of the picture
Global $height = 100;Height of the picture

;Create an empty GUI screen with no border and make it stay on top
Global $PicGUI = GUICreate("A Picture Box",$width,$height,$X,$Y,$WS_POPUP,$WS_EX_TOPMOST)

;Load our picture and place it in our picture box
Global $MyPic = GUICtrlCreatePic("MyPic.jpg",0,0,$width,$height)

;Alrighty, now show it:
GUISetState(@SW_SHOW,$PicGUI)

;Do some stuff with it:
;If the Left Mouse button is pressed, let's move the Image down 10 pixels
If (_IsPressed("01")) Then
    $Y += 10
    WinMove("A Picture Box","",$X,$Y)
;If the MiddleMouse button is pressed, let's move the image to the left 10 pixels
ElseIf (_IsPressed("04")) Then
    $X += 10
    WinMove("A Picture Box","",$X,$Y)
EndIf

;If a certain window is open, let's hide the picture, otherwise show it:
If (WinExists("AutoIt Help")) Then
    GUISetState(@SW_HIDE,$PicGUI)
Else
    GUISetState(@SW_SHOW,$PicGUI)
EndIf
    
;Alrighty, we are done, let's get rid of it:
GUIDelete($PicGUI)

Seems like alot of code for something simple, but I guess that's the way it goes sometimes.

-CMR

[EDIT] Just so you know, the Misc.au3 is only there for the _IsPressed() function. You could use HotKeySet with the same results, just tacks on more code and HotKeys tend to... take control...[/EDIT]

Edited by CodeMaster Rapture

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hm...i'll try this...

but there's one small problem:

I need the same Picture with the changes saved as a picture (*.jpg,*.bmp,...).

I have no problems using a DLL, but i don't know how to make a DllCall :think: ^^

Edit: in your code, neither $WS_POPUP nor $WS_EX_TOPMOST is declared

Edited by XxXFaNtA

Share this post


Link to post
Share on other sites

Hmm,

So you want to load a picture, modify it, display it, and save it?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Load Picture

Modify it

Save it

It doesn't have to be displayed

Edited by XxXFaNtA

Share this post


Link to post
Share on other sites

Hrm...

Sounds easy enough, but I don't think AutoIt currently has any built-in functions for that kind of work unless you can use FileOpen/Close and write to it that way. Altho, I'm not sure how it would turn out.

Share this post


Link to post
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
Sign in to follow this  
Followers 0