Jump to content

Question About Drawing


Recommended Posts

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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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