Jump to content
Sign in to follow this  
UEZ

Some Graphical Examples using GDI+ Vol. I

Recommended Posts

I hate you lol. That is so awesome. Here are my 2 modifications to that.

The first is to make it a little faster for slower pcs and I took out the cosin stuff cause I hated trig and calc when I had to take them in school.

CODE
#include <GUIConstantsEx.au3>

#include <GDIplus.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Bass.au3>

#include <BassConstants.au3>

$userdll = DllOpen("user32.dll")

$bass_dll = DllOpen("BASS.dll")

Global Const $width = 200

Global Const $height = 230

Global $title = "LMP Visualization"

$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

_BASS_Init($bass_dll, 0, -1, 44100, 0, "")

$MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)

If @error Then

MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)

Exit

EndIf

Opt("GUIOnEventMode", 1)

$hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

$pen1 = _GDIPlus_PenCreate(0, 2)

$pen_size = 4

$pen2 = _GDIPlus_PenCreate(0, $pen_size)

$song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)

_BASS_ChannelPlay($bass_dll, $MusicHandle, 1)

$current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)

$percent = Round(($current / $song_length) * 100, 0)

$max_l = 0

$max_r = 0

$fall_speed = 5

$fire_up = 10

Do

$levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)

$LeftChLvl = Round(_HiWord($levels) / $height, 0)

$RightChLvl = Round(_LoWord($levels) / $height, 0)

If $max_l <= $LeftChLvl Then

$max_l = $LeftChLvl + $fire_up

Else

If $max_l > $LeftChLvl + $pen_size + 1 Then $max_l -= $fall_speed

EndIf

If $max_r <= $RightChLvl Then

$max_r = $RightChLvl + $fire_up

Else

If $max_r > $RightChLvl + $pen_size + 1 Then $max_r -= $fall_speed

EndIf

_GDIPlus_GraphicsClear($backbuffer, 0x5F000000)

_GDIPlus_PenSetColor($pen2, 0xEF7F7F7F)

For $l = 0 To $leftChLvl Step 2

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + 30, $height - $l, $pen1)

Next

For $l = 0 To $rightChLvl Step 2

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + 30, $height - $l, $pen1)

Next

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + 30, $height - $max_l, $pen2)

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + 30, $height - $max_r, $pen2)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Sleep(15)

Until False

Func close()

_BASS_Free($bass_dll)

_GDIPlus_PenDispose($pen1)

_GDIPlus_PenDispose($pen2)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

The second is, I think, Just cooler looking.

CODE
#include <GUIConstantsEx.au3>

#include <GDIplus.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Bass.au3>

#include <BassConstants.au3>

$userdll = DllOpen("user32.dll")

$bass_dll = DllOpen("BASS.dll")

Global Const $width = 200

Global Const $height = 230

Global $title = "LMP Visualization"

$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

_BASS_Init($bass_dll, 0, -1, 44100, 0, "")

$MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)

If @error Then

MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)

Exit

EndIf

Opt("GUIOnEventMode", 1)

$hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

$pen1 = _GDIPlus_PenCreate(0, 1)

$pen_size = 4

$pen2 = _GDIPlus_PenCreate(0, $pen_size)

$song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)

_BASS_ChannelPlay($bass_dll, $MusicHandle, 1)

$current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)

$percent = Round(($current / $song_length) * 100, 0)

$max_l = 0

$max_r = 0

$fall_speed = 5

$fire_up = 10

Do

$levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)

$LeftChLvl = Round(_HiWord($levels) / $height, 0)

$RightChLvl = Round(_LoWord($levels) / $height, 0)

If $max_l <= $LeftChLvl Then

$max_l = $LeftChLvl + $fire_up

Else

If $max_l > $LeftChLvl + $pen_size + 1 Then $max_l -= $fall_speed

EndIf

If $max_r <= $RightChLvl Then

$max_r = $RightChLvl + $fire_up

Else

If $max_r > $RightChLvl + $pen_size + 1 Then $max_r -= $fall_speed

EndIf

_GDIPlus_GraphicsClear($backbuffer, 0x5F000000)

_GDIPlus_PenSetColor($pen2, 0xEF7F7F7F)

For $l = 0 To $leftChLvl Step 5

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + 30, $height - $l, $pen1)

Next

For $l = 0 To $rightChLvl Step 5

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + 30, $height - $l, $pen1)

Next

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + 30, $height - $max_l, $pen2)

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + 30, $height - $max_r, $pen2)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Sleep(15)

Until False

Func close()

_BASS_Free($bass_dll)

_GDIPlus_PenDispose($pen1)

_GDIPlus_PenDispose($pen2)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close


Giggity

Share this post


Link to post
Share on other sites

I hate you lol. That is so awesome. Here are my 2 modifications to that.

The first is to make it a little faster for slower pcs and I took out the cosin stuff cause I hated trig and calc when I had to take them in school.

CODE
#include <GUIConstantsEx.au3>

#include <GDIplus.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Bass.au3>

#include <BassConstants.au3>

$userdll = DllOpen("user32.dll")

$bass_dll = DllOpen("BASS.dll")

Global Const $width = 200

Global Const $height = 230

Global $title = "LMP Visualization"

$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

_BASS_Init($bass_dll, 0, -1, 44100, 0, "")

$MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)

If @error Then

MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)

Exit

EndIf

Opt("GUIOnEventMode", 1)

$hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

$pen1 = _GDIPlus_PenCreate(0, 2)

$pen_size = 4

$pen2 = _GDIPlus_PenCreate(0, $pen_size)

$song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)

_BASS_ChannelPlay($bass_dll, $MusicHandle, 1)

$current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)

$percent = Round(($current / $song_length) * 100, 0)

$max_l = 0

$max_r = 0

$fall_speed = 5

$fire_up = 10

Do

$levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)

$LeftChLvl = Round(_HiWord($levels) / $height, 0)

$RightChLvl = Round(_LoWord($levels) / $height, 0)

If $max_l <= $LeftChLvl Then

$max_l = $LeftChLvl + $fire_up

Else

If $max_l > $LeftChLvl + $pen_size + 1 Then $max_l -= $fall_speed

EndIf

If $max_r <= $RightChLvl Then

$max_r = $RightChLvl + $fire_up

Else

If $max_r > $RightChLvl + $pen_size + 1 Then $max_r -= $fall_speed

EndIf

_GDIPlus_GraphicsClear($backbuffer, 0x5F000000)

_GDIPlus_PenSetColor($pen2, 0xEF7F7F7F)

For $l = 0 To $leftChLvl Step 2

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + 30, $height - $l, $pen1)

Next

For $l = 0 To $rightChLvl Step 2

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + 30, $height - $l, $pen1)

Next

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + 30, $height - $max_l, $pen2)

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + 30, $height - $max_r, $pen2)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Sleep(15)

Until False

Func close()

_BASS_Free($bass_dll)

_GDIPlus_PenDispose($pen1)

_GDIPlus_PenDispose($pen2)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

The second is, I think, Just cooler looking.

CODE
#include <GUIConstantsEx.au3>

#include <GDIplus.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Bass.au3>

#include <BassConstants.au3>

$userdll = DllOpen("user32.dll")

$bass_dll = DllOpen("BASS.dll")

Global Const $width = 200

Global Const $height = 230

Global $title = "LMP Visualization"

$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

_BASS_Init($bass_dll, 0, -1, 44100, 0, "")

$MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)

If @error Then

MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)

Exit

EndIf

Opt("GUIOnEventMode", 1)

$hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

$pen1 = _GDIPlus_PenCreate(0, 1)

$pen_size = 4

$pen2 = _GDIPlus_PenCreate(0, $pen_size)

$song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)

_BASS_ChannelPlay($bass_dll, $MusicHandle, 1)

$current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)

$percent = Round(($current / $song_length) * 100, 0)

$max_l = 0

$max_r = 0

$fall_speed = 5

$fire_up = 10

Do

$levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)

$LeftChLvl = Round(_HiWord($levels) / $height, 0)

$RightChLvl = Round(_LoWord($levels) / $height, 0)

If $max_l <= $LeftChLvl Then

$max_l = $LeftChLvl + $fire_up

Else

If $max_l > $LeftChLvl + $pen_size + 1 Then $max_l -= $fall_speed

EndIf

If $max_r <= $RightChLvl Then

$max_r = $RightChLvl + $fire_up

Else

If $max_r > $RightChLvl + $pen_size + 1 Then $max_r -= $fall_speed

EndIf

_GDIPlus_GraphicsClear($backbuffer, 0x5F000000)

_GDIPlus_PenSetColor($pen2, 0xEF7F7F7F)

For $l = 0 To $leftChLvl Step 5

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + 30, $height - $l, $pen1)

Next

For $l = 0 To $rightChLvl Step 5

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + 30, $height - $l, $pen1)

Next

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + 30, $height - $max_l, $pen2)

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + 30, $height - $max_r, $pen2)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Sleep(15)

Until False

Func close()

_BASS_Free($bass_dll)

_GDIPlus_PenDispose($pen1)

_GDIPlus_PenDispose($pen2)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

Nice solution for the color gradient - I like it :)

Btw, I have no "slow" pc to test the code.

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

The color gradient took me a second. At first I was thinking the way I had it before, where it was from 0-100 for percentage reasons. Then I had it so the top was red, and the bottom was green, no matter how big or small the bar was. That one looked pretty neat. Then it hit me how to do it when I looked at how you were calculating the right and left values. The sad part is it took me way to long to figure out the green part :). When I got it right I was like how did I not see this lol.

I don't have a slow pc either :-P but I figure drawing all them lines, so I cut the for loop in half, still looks almost as smooth. I just figure going through them for loops would be killer on an older pc.

another modification:

CODE
#include <GUIConstantsEx.au3>

#include <GDIplus.au3>

#include <WindowsConstants.au3>

#include <Misc.au3>

#include <Bass.au3>

#include <BassConstants.au3>

$userdll = DllOpen("user32.dll")

$bass_dll = DllOpen("BASS.dll")

Global Const $width = 200

Global Const $height = 230

Global $title = "LMP Visualization"

$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")

_BASS_Init($bass_dll, 0, -1, 44100, 0, "")

$MusicHandle = _BASS_StreamCreateFile($bass_dll, False, $file, 0, 0, 0)

If @error Then

MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)

Exit

EndIf

Opt("GUIOnEventMode", 1)

$hwnd = GUICreate($title, $width, $height, -1, -1, Default, $WS_EX_TOOLWINDOW)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsClear($backbuffer)

$pen1 = _GDIPlus_PenCreate(0, 1)

$pen_size = 4

$pen2 = _GDIPlus_PenCreate(0, $pen_size)

$song_length = _BASS_ChannelGetLength($bass_dll, $MusicHandle, $BASS_POS_BYTE)

_BASS_ChannelPlay($bass_dll, $MusicHandle, 1)

$current = _BASS_ChannelGetPosition($bass_dll, $MusicHandle, $BASS_POS_BYTE)

$percent = Round(($current / $song_length) * 100, 0)

$max_l = 0

$max_r = 0

$fall_speed = 5

$fire_up = 10

Do

$levels = _BASS_ChannelGetLevel($bass_dll, $MusicHandle)

$LeftChLvl = Round(_HiWord($levels) / $height, 0)

$RightChLvl = Round(_LoWord($levels) / $height, 0)

If $max_l <= $LeftChLvl Then

$max_l = $LeftChLvl + $fire_up

Else

If $max_l > $LeftChLvl + $pen_size + 1 Then $max_l -= $fall_speed

EndIf

If $max_r <= $RightChLvl Then

$max_r = $RightChLvl + $fire_up

Else

If $max_r > $RightChLvl + $pen_size + 1 Then $max_r -= $fall_speed

EndIf

_GDIPlus_GraphicsClear($backbuffer, 0x5F000000)

_GDIPlus_PenSetColor($pen2, 0xEF7F7F7F)

$pen1 = _GDIPlus_PenCreate(0, 2)

For $l = 0 To $leftChLvl Step 2 + (($leftchlvl/$height)*10)

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $l, $width / 5 + 30, $height - $l, $pen1)

Next

For $l = 0 To $rightChLvl Step 2 + (($rightchlvl/$height)*10)

$r = $l/($height) * 256

$g = 256 - $r

$b = 0

_GDIPlus_PenSetColor($pen1, "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2))

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $l, 3 * $width / 5 + 30, $height - $l, $pen1)

Next

_GDIPlus_GraphicsDrawLine($backbuffer, $width / 5, $height - $max_l, $width / 5 + 30, $height - $max_l, $pen2)

_GDIPlus_GraphicsDrawLine($backbuffer, 3 * $width / 5, $height - $max_r, 3 * $width / 5 + 30, $height - $max_r, $pen2)

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

_GDIPlus_PenDispose($pen1)

Sleep(15)

Until False

Func close()

_BASS_Free($bass_dll)

_GDIPlus_PenDispose($pen1)

_GDIPlus_PenDispose($pen2)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close


Giggity

Share this post


Link to post
Share on other sites

youknowwho4eva inspired me to create another visualization (Analog Meter) :P :

Download compiled version + source code here: CLICK ME or check out my 1st post.

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@UEZ

Seems to be nice but my script crashes at start :P

Cheers, FireFox.

Hmmm, sounds strange! Did you download it from my post #84 and tried it from there?

The posted source code alone will not work!

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

@UEZ

yes... :P

Sounds realy nice ! :unsure:

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Here some GDI+ examples made for fun (my 1st GDI+ codes):

Just found this post - You are a GDI god. :P

One note though, on the "L-System Fractals" example it seems very slow until I changed the GraphicsClear.

- something about continually redrawing a non-opaque background just isn't quick for me.

Could just be my hardware though.

0xFFFFFFFF (opaque white) seemed to work quickly as a workaround.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

Just found this post - You are a GDI god. :(

One note though, on the "L-System Fractals" example it seems very slow until I changed the GraphicsClear.

- something about continually redrawing a non-opaque background just isn't quick for me.

Could just be my hardware though.

0xFFFFFFFF (opaque white) seemed to work quickly as a workaround.

Thanks for feedback!

I thought that I've updated the code with it but it is still an older version - maybe in the downloads is the updated version :unsure: -=> Updated ;)

The issue with the "L-System Fractals" is the recursion. Recursion with AutoIt is very slow (look here)

A simple example with Fibonacci numbers for demonstration:

$n = 25

$bench_start = TimerInit()
ConsoleWrite(Fibonacci_i($n)  & @CRLF)
$bench_end_i = Round(TimerDiff($bench_start), 4)

$bench_start = TimerInit()
ConsoleWrite(Fibonacci_r($n) & @CRLF)
$bench_end_r = Round(TimerDiff($bench_start), 4)

ConsoleWrite(@CRLF & "Iterative: " & $bench_end_i & " ms" & @CRLF & "Recursive: " & $bench_end_r & " ms" & @CRLF & "Diff: " & Abs($bench_end_i - $bench_end_r) & " ms !" & @CRLF & @CRLF)

Func Fibonacci_i($f)
    Dim $arr_fib[3]
    $arr_fib[0] = 0
    $arr_fib[1] = 1
    For $i = 2 To $f
        $arr_fib[2] = $arr_fib[1] + $arr_fib[0]
        $arr_fib[0] = $arr_fib[1]
        $arr_fib[1] = $arr_fib[2]
    Next
    Return $arr_fib[2]
EndFunc

Func Fibonacci_r($f)
    If $f = 0 Then Return 0
    If $f = 1 Then Return 1
    Return Fibonacci_r($f - 1) + Fibonacci_r($f - 2)
EndFunc

If you tough enough try to convert L-System Fractals recursion to iteration ;)

These are simple GDI+ examples, so surely I'm not a GDI+ god :D Mostly the challenge is the mathematics... :P

Currently I'm trying to rotate a 3D cube with (3x3x3) balls but this is cracking my brain... :D

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

I've forgotten to add also BassConstants.au3 which will be loaded by Bass.au3! Thanks to GtaSpider for the hint :P

I will update the download resource soon... Done.

Sorry,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

UEZ, awesome job :unsure: I like the mesmerizing screensaver.. and the sinus scroller was cool for about a minute haha :P Really good job overall


Share this post


Link to post
Share on other sites

Wow, no kidding about recursive being SLOW.

Results from that bench test:

75025

75025

Iterative: 0.8227 ms

Recursive: 943.8691 ms

Diff: 943.0464 ms !

Iterative is over 1000x faster than recursive.

Edit:

Hmm thinking about this its not entirely autoits fault that the recursive method is slow. If you draw out the recursive tree it doubles the number of functions that are called for each increase of n so that auto it calls the recursive function about 2^n times where as the iterative method only adds a single iteration per increase of n the the work load is n.

Edited by smstroble

MUHAHAHAHAHA

Share this post


Link to post
Share on other sites

UEZ, awesome job :unsure: I like the mesmerizing screensaver.. and the sinus scroller was cool for about a minute haha :P Really good job overall

Thanks for your feedback! :D

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Wow, no kidding about recursive being SLOW.

Results from that bench test:

75025

75025

Iterative: 0.8227 ms

Recursive: 943.8691 ms

Diff: 943.0464 ms !

Iterative is over 1000x faster than recursive.

Edit:

Hmm thinking about this its not entirely autoits fault that the recursive method is slow. If you draw out the recursive tree it doubles the number of functions that are called for each increase of n so that auto it calls the recursive function about 2^n times where as the iterative method only adds a single iteration per increase of n the the work load is n.

Yes, of course the runtime depends on the recursion depth and probably has exponential runtime as you mentioned (O(2^n)) but fact is that recursion is much slower than iteration! The challenge is to convert the fractals from recursion to iteration to speed it up.

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hope you don't mind me lending your thread a little, but I just made this little animation and I don't think it qualifies in its own thread.

Posted Image

CODE
#include <GUIConstantsEx.au3>

#include <GDIPlus.au3>

Opt("GUIOnEventMode", 1)

Global Const $width = 800

Global Const $height = 500

$hWnd = GUICreate("SineWorm", $width, $height)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsSetSmoothingMode($backbuffer,4)

$inc = 0

Local $aFact[4] = [0.0, 0.25, 0.5, 1]

$lgbrush = _GDIPlus_CreateLineBrushFromRect(0, 00, $width, $height, $aFact, -1, 0xFF00FF00, 0xFF0000FF,0)

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Cos($inc / 2+$i/25) * 100

$ymod = Sin($inc / 2+$i/25) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

Func close()

_GDIPlus_BrushDispose($lgbrush)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

;==== GDIPlus_CreateLineBrushFromRect ===

;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

; $aFactors - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors. Each number in the array

; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0.

;$aPositions - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array

; indicates a percentage of the distance between the starting boundary and the ending boundary

; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the

; gradient and 1.0 indicates the ending boundary. There must be at least two positions

; specified: the first position, which is always 0.0, and the last position, which is always

; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a

; line, parallel to the boundary lines, that is a certain fraction of the distance from the

; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates

; the line that is 70 percent of the distance from the starting boundary to the ending boundary.

; The color is constant on lines that are parallel to the boundary lines.

; $iArgb1 - First Top color in 0xAARRGGBB format

; $iArgb2 - Second color in 0xAARRGGBB format

; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000,

; LinearGradientModeVertical = 0x00000001,

; LinearGradientModeForwardDiagonal = 0x00000002,

; LinearGradientModeBackwardDiagonal = 0x00000003

; $WrapMode - WrapModeTile = 0,

; WrapModeTileFlipX = 1,

; WrapModeTileFlipY = 2,

; WrapModeTileFlipXY = 3,

; WrapModeClamp = 4

; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2,

; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient)

; Reference: http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx

;

Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _

$iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF

If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000

If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001

If $WrapMode = -1 Then $WrapMode = 1

$tRect = DllStructCreate("float X;float Y;float Width;float Height")

$pRect = DllStructGetPtr($tRect)

DllStructSetData($tRect, "X", $iX)

DllStructSetData($tRect, "Y", $iY)

DllStructSetData($tRect, "Width", $iWidth)

DllStructSetData($tRect, "Height", $iHeight)

;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined

$aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _

"int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]

If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]

$iCount = UBound($aPositions)

$tFactors = DllStructCreate("float[" & $iCount & "]")

$pFactors = DllStructGetPtr($tFactors)

For $iI = 0 To $iCount - 1

DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)

Next

$tPositions = DllStructCreate("float[" & $iCount & "]")

$pPositions = DllStructGetPtr($tPositions)

For $iI = 0 To $iCount - 1

DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)

Next

$hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _

"ptr", $pFactors, "ptr", $pPositions, "int", $iCount)

Return $aRet[6]; Handle of Line Brush

EndFunc ;==>_GDIPlus_CreateLineBrushFromRect

:P

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Nice work monoceres (as usual) :P

Of course I don't mind when other members are posting their examples into this thread!

Btw, I made some updates to the Analog Meter code -> you can now open a song by pressing O, pause the song with P and continue it with C (look to the 1st post)!

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Here another small one!

Particle Catapult:

Source code moved to my 1st post!

I don't know whether you want to see more of this kind of examples or just saying "STOP, no more boring stuff"!

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hope you don't mind me lending your thread a little, but I just made this little animation and I don't think it qualifies in its own thread.

Posted Image

CODE
#include <GUIConstantsEx.au3>

#include <GDIPlus.au3>

Opt("GUIOnEventMode", 1)

Global Const $width = 800

Global Const $height = 500

$hWnd = GUICreate("SineWorm", $width, $height)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsSetSmoothingMode($backbuffer,4)

$inc = 0

Local $aFact[4] = [0.0, 0.25, 0.5, 1]

$lgbrush = _GDIPlus_CreateLineBrushFromRect(0, 00, $width, $height, $aFact, -1, 0xFF00FF00, 0xFF0000FF,0)

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Cos($inc / 2+$i/25) * 100

$ymod = Sin($inc / 2+$i/25) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

Func close()

_GDIPlus_BrushDispose($lgbrush)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

;==== GDIPlus_CreateLineBrushFromRect ===

;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

; $aFactors - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors. Each number in the array

; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0.

;$aPositions - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array

; indicates a percentage of the distance between the starting boundary and the ending boundary

; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the

; gradient and 1.0 indicates the ending boundary. There must be at least two positions

; specified: the first position, which is always 0.0, and the last position, which is always

; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a

; line, parallel to the boundary lines, that is a certain fraction of the distance from the

; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates

; the line that is 70 percent of the distance from the starting boundary to the ending boundary.

; The color is constant on lines that are parallel to the boundary lines.

; $iArgb1 - First Top color in 0xAARRGGBB format

; $iArgb2 - Second color in 0xAARRGGBB format

; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000,

; LinearGradientModeVertical = 0x00000001,

; LinearGradientModeForwardDiagonal = 0x00000002,

; LinearGradientModeBackwardDiagonal = 0x00000003

; $WrapMode - WrapModeTile = 0,

; WrapModeTileFlipX = 1,

; WrapModeTileFlipY = 2,

; WrapModeTileFlipXY = 3,

; WrapModeClamp = 4

; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2,

; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient)

; Reference: http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx

;

Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _

$iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF

If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000

If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001

If $WrapMode = -1 Then $WrapMode = 1

$tRect = DllStructCreate("float X;float Y;float Width;float Height")

$pRect = DllStructGetPtr($tRect)

DllStructSetData($tRect, "X", $iX)

DllStructSetData($tRect, "Y", $iY)

DllStructSetData($tRect, "Width", $iWidth)

DllStructSetData($tRect, "Height", $iHeight)

;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined

$aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _

"int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]

If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]

$iCount = UBound($aPositions)

$tFactors = DllStructCreate("float[" & $iCount & "]")

$pFactors = DllStructGetPtr($tFactors)

For $iI = 0 To $iCount - 1

DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)

Next

$tPositions = DllStructCreate("float[" & $iCount & "]")

$pPositions = DllStructGetPtr($tPositions)

For $iI = 0 To $iCount - 1

DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)

Next

$hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _

"ptr", $pFactors, "ptr", $pPositions, "int", $iCount)

Return $aRet[6]; Handle of Line Brush

EndFunc ;==>_GDIPlus_CreateLineBrushFromRect

:D
If you switch around the functions you get some other really neat results. (lines 28 and 29) I changed them both to Tangent, that was pretty neat. I tried a few others. All were really interesting. I think my favorite is

$xmod = Sin($inc / 2+$i/25) * 100
$ymod = Tan($inc / 2+$i/25) * 100

Edit: Made this for quick switching. use 1-9 to switch it up. also changed the math up a little.

CODE
#include <GUIConstantsEx.au3>

#include <GDIPlus.au3>

HotKeySet("1","tantan")

HotKeySet("2","tancos")

HotKeySet("3","tansin")

HotKeySet("4","sintan")

HotKeySet("5","costan")

HotKeySet("6","sinsin")

HotKeySet("7","sincos")

HotKeySet("8","coscos")

HotKeySet("9","cossin")

Opt("GUIOnEventMode", 1)

Global Const $width = 800

Global Const $height = 500

$hWnd = GUICreate("SineWorm", $width, $height)

GUISetOnEvent($GUI_EVENT_CLOSE, "close")

GUISetState()

_GDIPlus_Startup()

$graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)

$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)

$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)

_GDIPlus_GraphicsSetSmoothingMode($backbuffer,4)

$inc = 0

Local $aFact[4] = [0.0, 0.25, 0.5, 1]

$lgbrush = _GDIPlus_CreateLineBrushFromRect(0, 00, $width, $height, $aFact, -1, 0xFF00FF00, 0xFF0000FF,0)

tantan()

Func tantan()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Tan($inc / 2+$i/15) * 200

$ymod = Tan($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func tancos()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Tan($inc / 2+$i/15) * 200

$ymod = Cos($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func tansin()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Tan($inc / 2+$i/15) * 200

$ymod = Sin($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func sintan()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Sin($inc / 2+$i/15) * 200

$ymod = Tan($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func costan()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Cos($inc / 2+$i/15) * 200

$ymod = Tan($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func sinsin()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Sin($inc / 2+$i/15) * 200

$ymod = Sin($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func sincos()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Sin($inc / 2+$i/15) * 200

$ymod = Cos($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func coscos()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Cos($inc / 2+$i/15) * 200

$ymod = Cos($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func cossin()

Do

_GDIPlus_GraphicsClear($backbuffer, 0xFF000000)

$inc += 0.15

For $i = 125 To $width - 125 Step 6

$xmod = Cos($inc / 2+$i/15) * 200

$ymod = Sin($inc / 2+$i/5) * 100

_GDIPlus_GraphicsFillEllipse($backbuffer, $xmod + $i + 10, $ymod + $height / 2 - 25 + Sin($inc + $i / 100) * 0, 8, 8, $lgbrush)

Next

_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)

Until Not Sleep(20)

EndFunc

Func close()

_GDIPlus_BrushDispose($lgbrush)

_GDIPlus_GraphicsDispose($backbuffer)

_GDIPlus_BitmapDispose($bitmap)

_GDIPlus_GraphicsDispose($graphics)

_GDIPlus_Shutdown()

Exit

EndFunc ;==>close

;==== GDIPlus_CreateLineBrushFromRect ===

;Description - Creates a LinearGradientBrush object from a set of boundary points and boundary colors.

; $aFactors - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors. Each number in the array

; specifies a percentage of the ending color and should be in the range from 0.0 through 1.0.

;$aPositions - If non-array, default array will be used.

; Pointer to an array of real numbers that specify blend factors' positions. Each number in the array

; indicates a percentage of the distance between the starting boundary and the ending boundary

; and is in the range from 0.0 through 1.0, where 0.0 indicates the starting boundary of the

; gradient and 1.0 indicates the ending boundary. There must be at least two positions

; specified: the first position, which is always 0.0, and the last position, which is always

; 1.0. Otherwise, the behavior is undefined. A blend position between 0.0 and 1.0 indicates a

; line, parallel to the boundary lines, that is a certain fraction of the distance from the

; starting boundary to the ending boundary. For example, a blend position of 0.7 indicates

; the line that is 70 percent of the distance from the starting boundary to the ending boundary.

; The color is constant on lines that are parallel to the boundary lines.

; $iArgb1 - First Top color in 0xAARRGGBB format

; $iArgb2 - Second color in 0xAARRGGBB format

; $LinearGradientMode - LinearGradientModeHorizontal = 0x00000000,

; LinearGradientModeVertical = 0x00000001,

; LinearGradientModeForwardDiagonal = 0x00000002,

; LinearGradientModeBackwardDiagonal = 0x00000003

; $WrapMode - WrapModeTile = 0,

; WrapModeTileFlipX = 1,

; WrapModeTileFlipY = 2,

; WrapModeTileFlipXY = 3,

; WrapModeClamp = 4

; GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, ARGB color1, ARGB color2,

; LinearGradientMode mode, GpWrapMode wrapMode, GpLineGradient **lineGradient)

; Reference: http://msdn.microsoft.com/en-us/library/ms534043(VS.85).aspx

;

Func _GDIPlus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _

$iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0)

Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount

If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF

If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000

If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001

If $WrapMode = -1 Then $WrapMode = 1

$tRect = DllStructCreate("float X;float Y;float Width;float Height")

$pRect = DllStructGetPtr($tRect)

DllStructSetData($tRect, "X", $iX)

DllStructSetData($tRect, "Y", $iY)

DllStructSetData($tRect, "Width", $iWidth)

DllStructSetData($tRect, "Height", $iHeight)

;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined

$aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _

"int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0)

If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0]

If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0]

$iCount = UBound($aPositions)

$tFactors = DllStructCreate("float[" & $iCount & "]")

$pFactors = DllStructGetPtr($tFactors)

For $iI = 0 To $iCount - 1

DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1)

Next

$tPositions = DllStructCreate("float[" & $iCount & "]")

$pPositions = DllStructGetPtr($tPositions)

For $iI = 0 To $iCount - 1

DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1)

Next

$hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _

"ptr", $pFactors, "ptr", $pPositions, "int", $iCount)

Return $aRet[6]; Handle of Line Brush

EndFunc ;==>_GDIPlus_CreateLineBrushFromRect

Edited by youknowwho4eva

Giggity

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By UEZ
      This project has been discontinued!
       
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from cannot be downloaded although they are visible on the web site!
       
      Here the download link of the source code only:  AutoIt Sysinternal Tools Synchronizer v0.99.6 build 2020-09-21 beta.7z (1548 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • By UEZ
      Here another example to mark the desktop to get the marked region for capturing. This example is not perfect and not very fast (room for improvements).
      ;Coded by UEZ build 2020-08-07 beta ;Code cleanup up mLipok ; ;Short instruction: mark area on your desktop and press return key to capture. #include <APISysConstants.au3> #include <Array.au3> ;#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> ; enum _PROCESS_DPI_AWARENESS -> https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx Global Enum $DPI_AWARENESS_INVALID = -1, $PROCESS_DPI_UNAWARE = 0, $PROCESS_SYSTEM_DPI_AWARE, $PROCESS_PER_MONITOR_DPI_AWARE ;https://docs.microsoft.com/en-us/windows/desktop/hidpi/dpi-awareness-context Global Enum $Context_UnawareGdiScaled = -5, $Context_PerMonitorAwareV2, $Context_PerMonitorAware, $Context_SystemAware, $Context_Unaware _WinAPI_SetProcessDpiAwarenessContext($Context_PerMonitorAware) Global $__g_hGUI_MarkArea, $__g_hGUI_Bg, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _ $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4, $__g_bSelectionDone = False Global $aRect = _GDIPlus_MarkScreenRegionAnimated() Global $hImage_Capture = _ScreenCapture_Capture(@TempDir & "\Test.png", $aRect[0], $aRect[1], $aRect[0] + $aRect[2] - 1, $aRect[1] + $aRect[3] - 1, False) ShellExecute(@TempDir & "\Test.png") ;_ArrayDisplay($aRect, "Marked area coordinates") Func _GDIPlus_MarkScreenRegionAnimated($bAnim = True) _GDIPlus_Startup() Local Const $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]") Local Const $aFullScreen = WinGetPos($hFullScreen) $__g_hGUI_Bg = GUICreate("", $aFullScreen[2], $aFullScreen[3], $aFullScreen[0], $aFullScreen[1], BitOR($WS_CLIPCHILDREN, $WS_POPUP), $WS_EX_TOPMOST) ;to avoid cursor flickering and for proper control read WinSetTrans($__g_hGUI_Bg, "", 0x01) $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $bAnim ? $WS_POPUP : BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED), $__g_hGUI_Bg) GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea) If Not $bAnim Then $__g_iColor_ResizeDots = 0xFF0000 $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) GUISetState(@SW_SHOWNA, $__g_hGUI_Bg) GUISetState(@SW_SHOW, $__g_hGUI_MarkArea) $__g_iOldCursor = MouseGetCursor() GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0) Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $aOldWinPos, $aOldMPos, $bMoved Local $aGUIStartPos, $iKey_Exit = GUICtrlCreateButton("", $aFullScreen[0] - 10, $aFullScreen[1] - 10, 1, 1), $aAccelKeys[1][2] = [["{ENTER}", $iKey_Exit]] GUISetAccelerators($aAccelKeys, $__g_hGUI_Bg) GUISetAccelerators($aAccelKeys, $__g_hGUI_MarkArea) #forceref $bMoved Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iKey_Exit If $bAnim Then GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID) GUIRegisterMsg($WM_ERASEBKGND, "") EndIf _GDIPlus_Shutdown() Local $aResult = WinGetPos($__g_hGUI_MarkArea) $aResult[2] = WinGetClientSize($__g_hGUI_MarkArea)[0] $aResult[3] = WinGetClientSize($__g_hGUI_MarkArea)[1] GUIDelete($__g_hGUI_MarkArea) GUIDelete($__g_hGUI_Bg) If Not $__g_bSelectionDone Then $aResult = 0 Return $aResult EndSwitch $aMPos = MouseGetPos() If ($aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1]) And (Not $__g_bSelectionDone) Then WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1]) $aPrevMPos = $aMPos EndIf $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If $aCI[2] And (Not $__g_bSelectionDone) Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $bAnim Then GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND") GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 50, "ptr", 0)[0] EndIf While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) $aMPos = MouseGetPos() $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1 $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1 If $aMPos[0] < $aGUIStartPos[0] Then $iX = $aMPos[0] Else $iX = $aGUIStartPos[0] EndIf If $aMPos[1] < $aGUIStartPos[1] Then $iY = $aMPos[1] Else $iY = $aGUIStartPos[1] EndIf WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH) UpdateCtrlPos($bAnim) WEnd $__g_bSelectionDone = True GUISetCursor(3, 1, $__g_hGUI_MarkArea) ElseIf $aCI[3] And $__g_bSelectionDone Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aGUIStartPos[0], $aGUIStartPos[1], $aGUIStartPos[0] + $aGUIStartPos[2], $aGUIStartPos[1] + $aGUIStartPos[3]) Then $aMPos = MouseGetPos() $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) While $aCI[3] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aGUIStartPos[0] - ($aMPos[0] - MouseGetPos(0)), $aGUIStartPos[1] - ($aMPos[1] - MouseGetPos(1)), $__g_iW, $__g_iH) GUISetCursor(0, 1, $__g_hGUI_Bg) GUISetCursor(0, 1, $__g_hGUI_MarkArea) WEnd GUISetCursor(3, 1, $__g_hGUI_Bg) GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndIf EndIf If $__g_bSelectionDone Then $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If @error Then ContinueLoop Switch $aCI[4] Case $__g_iLabel_TL GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), MouseGetPos(1), $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BR GUISetCursor(12, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TR GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BL GUISetCursor(10, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_LM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", MouseGetPos(0), $aOldWinPos[1], $aOldWinPos[2] + ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_RM GUISetCursor(13, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2] - ($aOldMPos[0] - MouseGetPos(0)), $aOldWinPos[3]) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_TM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], MouseGetPos(1), $aOldWinPos[2], $aOldWinPos[3] + ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case $__g_iLabel_BM GUISetCursor(11, 1, $__g_hGUI_MarkArea) If $aCI[2] Then $aOldWinPos = WinGetPos($__g_hGUI_MarkArea) $aOldMPos = MouseGetPos() While $aCI[2] * Sleep(10) $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) WinMove($__g_hGUI_MarkArea, "", $aOldWinPos[0], $aOldWinPos[1], $aOldWinPos[2], $aOldWinPos[3] - ($aOldMPos[1] - MouseGetPos(1))) WEnd UpdateCtrlPos($bAnim) EndIf Case Else GUISetCursor(3, 1, $__g_hGUI_MarkArea) EndSwitch EndIf Until False EndFunc ;==>_GDIPlus_MarkScreenRegionAnimated Func UpdateCtrlPos($bAnim = True) Local Const $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "") $__g_iW = $aGUIStartPos[2] $__g_iH = $aGUIStartPos[3] ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TL, 0, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder - $__g_iBorder / 2), ($__g_iH - $__g_iBorder - $__g_iBorder / 2), $__g_iBorder, $__g_iBorder) If $__g_bSelectionDone And $bAnim Then GUIRegisterMsg($WM_TIMER, "PlayBorderAnim") EndFunc ;==>UpdateCtrlPos Func PlayBorderAnim() Local $aWinPos = WinGetClientSize($__g_hGUI_MarkArea), $iW = $aWinPos[0], $iH = $aWinPos[1] Local Static $fOffset = 0 Local Const $iSize = $__g_iBorder / 2 Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000 + $__g_iColor_ResizeDots), $hPen3 = _GDIPlus_PenCreate(0xFF000000) _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOT) _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF) ;for faster performance direct dll calls DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen2, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen, "float", 1 + $iSize, "float", 1 + $iSize, "float", $iW - 2 * $iSize - 2, "float", $iH - 2 * $iSize - 2) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", 0, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) / 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", 0, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) / 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) DllCall($__g_hGDIPDll, "int", "GdipDrawRectangle", "handle", $hCanvas, "handle", $hPen3, "float", ($iW - $__g_iBorder) - 2, "float", ($iH - $__g_iBorder) - 2, "float", $__g_iBorder + 1, "float", $__g_iBorder + 1) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) $fOffset += 0.5 _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_PenDispose($hPen3) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>PlayBorderAnim Func WM_ERASEBKGND($hWnd, $iMsgm, $wParam, $lParam) ;suppress repainting to avoid flickering but causes some other side effects #forceref $iMsgm, $wParam, $lParam, $hWnd Local Const $hBrush = _WinAPI_CreateSolidBrush(0xEFCDAB) ;BGR format ;~ _WinAPI_RedrawWindow($__g_hGUI_MarkArea, 0, 0, BitOR($RDW_NOERASE, $RDW_NOCHILDREN, $RDW_NOFRAME, $RDW_VALIDATE)) _WinAPI_SetClassLongEx($__g_hGUI_MarkArea, $GCL_HBRBACKGROUND, $hBrush) _WinAPI_DeleteObject($hBrush) Return 0 EndFunc ;==>WM_ERASEBKGND ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext Func _WinAPI_SetProcessDpiAwarenessContext($DPIAwareContext = $Context_PerMonitorAware, $hGUI = 0, $iMode = 3) ;https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdpiawarenesscontext $DPIAwareContext = ($DPIAwareContext < -5) ? -5 : ($DPIAwareContext > -1) ? -1 : $DPIAwareContext $iMode = ($iMode < 1) ? 1 : ($iMode > 3) ? 3 : $iMode Switch $iMode Case 1 Local $hDC = _WinAPI_GetDC($hGUI) Local $aResult1 = DllCall("user32.dll", "ptr", "GetDpiFromDpiAwarenessContext", "ptr", $hDC) If @error Or Not IsArray($aResult1) Then Return SetError(11, 0, 0) _WinAPI_ReleaseDC(0, $hDC) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult1[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(12, 0, 0) Case 2 ;~ If Not $hGUI Then $hGUI = WinGetHandle(AutoItWinGetTitle()) Local $aResult2 = DllCall("user32.dll", "int", "GetWindowDpiAwarenessContext", "ptr", $hGUI) If @error Or Not IsArray($aResult2) Then Return SetError(21, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetProcessDpiAwarenessContext", "int", $aResult2[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(22, 0, 0) Case 3 Local $aResult31 = DllCall("user32.dll", "ptr", "GetThreadDpiAwarenessContext") If @error Or Not IsArray($aResult31) Then Return SetError(31, 0, 0) Local $aResult32 = DllCall("user32.dll", "ptr", "GetAwarenessFromDpiAwarenessContext", "ptr", $aResult31[0]) If @error Or Not IsArray($aResult32) Then Return SetError(32, 0, 0) Local $aResult = DllCall("user32.dll", "Bool", "SetThreadDpiAwarenessContext", "int", $aResult32[0] + $DPIAwareContext) If @error Or Not IsArray($aResult) Then Return SetError(33, 0, 0) EndSwitch Return 1 EndFunc ;==>_WinAPI_SetProcessDpiAwarenessContext  
      Just press the lmb and move your mouse. When lmb is released you can adjust the size of the window by dragging the white rectangle to any direction. Rmb will move the marked area.
      Press ESC to get the coordinates of the marked region.
      If you have any improvements, please post it here.
       
      Tested on Win10 x64 only.
       
    • By Bilgus
      This is an update or derivative work of Beege 's Scrolling Line Graph UDF
      https://www.autoitscript.com/forum/topic/109599-scrolling-line-graph-udf
       
      I noticed a few issues for my use case with the UDF one being that adding a sample required updating the waveform
      High CPU usage went hand in hand with that requirement
      Another issue was just how long updating took to complete
      I've hopefully rectified that with this version
       
      There are a few changes (only 1 line per graph for instance)
      The addition of a function AddSample (uses graphics paths to speed up drawing samples on update) Gridlines are only generated once A sample finished line can be added UpdateGraph allows you to compress the discarded portion of the graph (it looks kinda cool but uses more CPU) Lower Cpu usage Uses real Control Ids - it is a label control underneath so you get click events and can display text when control is disabled Example (Waveform.au3)
       
      Example 2 (peak.au3)
      UDF
      Updated:
      Previous Downloads [38 / 38/ 0]
      SSLG.au3 waveform.au3 Peak.au3
    • By nacerbaaziz
      hello autoit team
      please i've a question for you.
      am creating a audio player
      and in this audio player i want to show the current trac info
      such as the total time and the position ... etc
      i know i can show it as label
      but the screen reader for the blind read the text every change
      because it have a screen scan
      what i want is to show this informations but such image or icon
      i mean i need to create
      GUICtrlCreatepic or GUICtrlCreateicon ....
      or some thing as that
      and show this informations as image on it
      i think that i can do that with the 
      _GDIPlus functions
      but i couldn't find the currect way to do it
      i tried the _GDIPlus_GraphicsDrawString
      but i couldn't know how it work
      what i need is a small example that create a GUI
      and add a multy line text to it as graphic or image.
      so i need a simple way because it will changed every sec
      i hope any one can help me to do that
      global $GUI = GUICreate("text", 400, 400) global $label = GUICtrlCreateLabel(GetText(), 10, 10, 380, 380) GUISetState() do sleep(100) until GUIGetMSG() = -3 exit func GetText() return StringFormat("file name is test.mp3 \r\n total time is 00:30:00 \r\n position is 00:05:50") endFunc  
    • By UEZ
      I was inspired by a CSS example to create a procedural graphic without any shader or ray tracing technique.
      Here the result using GDI+ only:

       
      Blue Orb.au3
      ;Inspired from https://codepen.io/bradleytaunt/details/VwvzKyb ;Coded by UEZ build 2020-05-07 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If @OSBuild < 7600 Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "ERROR", "This demo requires GDIPlus v1.1", 10) _GDIPlus_Startup() Global Const $iW = 1200, $iH = 700, $iSize_globe = 450 Global Const $hGUI = GUICreate("GDI+ Procedural Gfx / Blue Orb v1.20 by UEZ", $iW, $iH, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) Global Const $hCanvas = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Global Const $hGfx = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGfx, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) ;~ _GDIPlus_GraphicsSetCompositingQuality($hGfx, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) _GDIPlus_GraphicsSetInterpolationMode($hGfx, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, $GDIP_PIXELOFFSETMODE_HALF) ;draw background Global Const $hBrush_bg = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xFF1E88E5, 0xFF1565C0, 2) _GDIPlus_LineBrushSetSigmaBlend ($hBrush_bg, 0.95, 1) ;create blurry edge _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hBrush_bg) ;draw blurred text Global Const $hImage_text = _GDIPlus_BitmapCreateFromScan0($iW, $iH / 2) Global Const $hGfx_text = _GDIPlus_ImageGetGraphicsContext($hImage_text) Global Const $hPath_text = _GDIPlus_PathCreate() Global Const $hFamily = _GDIPlus_FontFamilyCreate("Impact") Global Const $hStringFormat = _GDIPlus_StringFormatCreate() Global Const $hBrush_txt = _GDIPlus_LineBrushCreate($iW / 2, 0, $iW / 2, $iH / 2, 0xE0FFFFFF, 0xA01A237E) ;_GDIPlus_BrushCreateSolid(0xF02E86FB) _GDIPlus_LineBrushSetSigmaBlend($hBrush_txt, 0.66, 1) Global Const $hPen_txt = _GDIPlus_PenCreate(0x801A237E, 1) _GDIPlus_StringFormatSetAlign($hStringFormat, 1) _GDIPlus_StringFormatSetLineAlign($hStringFormat, 1) _GDIPlus_GraphicsSetSmoothingMode($hGfx_text, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) _GDIPlus_GraphicsSetTextRenderingHint($hGfx_text, $GDIP_TextRenderingHintAntialias) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx_text, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsSetCompositingQuality($hGfx_text, $GDIP_COMPOSITINGQUALITYHIGHQUALITY) Global $tLayout = _GDIPlus_RectFCreate() $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = -$iH * 0.05 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt) _GDIPlus_GraphicsDrawPath($hGfx_text, $hPath_text, $hPen_txt) Global Const $hEffect_blur_text = _GDIPlus_EffectCreateBlur(20) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, 0, $iW, $iH / 2) ;draw shadow of the text Global Const $hBrush_txt_shadow = _GDIPlus_BrushCreateSolid(0x40000000) _GDIPlus_GraphicsClear($hGfx_text, 0) _GDIPlus_PathReset($hPath_text) $tLayout.width = $iW $tLayout.height = $iH / 2 $tLayout.y = 0 _GDIPlus_PathAddString($hPath_text, "AutoIt rulez!", $tLayout, $hFamily, 0, $iW / 8, $hStringFormat) _GDIPlus_GraphicsFillPath($hGfx_text, $hPath_text, $hBrush_txt_shadow) Global Const $hEffect_blur_text_shadow = _GDIPlus_EffectCreateBlur(60) _GDIPlus_BitmapApplyEffect($hImage_text, $hEffect_blur_text_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_text, 0, $iH * 0.55, $iW, $iH / 8) ;draw shadow Global Const $iW_shadow1 = $iSize_globe * 0.85, $iH_shadow1 = $iSize_globe * 0.1, $iW_shadow2 = $iSize_globe * 0.60, _ $iW_shadow_Img = $iW_shadow1 * 2, $iH_shadowImg = $iH_shadow1 * 4 Global Const $hImage_shadow = _GDIPlus_BitmapCreateFromScan0($iW_shadow_Img, $iH_shadowImg) Global Const $hGfx_shadow = _GDIPlus_ImageGetGraphicsContext($hImage_shadow) _GDIPlus_GraphicsSetSmoothingMode($hGfx_shadow, $GDIP_SMOOTHINGMODE_ANTIALIAS8X8) Global Const $hBrush_shadow = _GDIPlus_BrushCreateSolid(0x66000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow1) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow1, $iH_shadow1, $hBrush_shadow) _GDIPlus_BrushSetSolidColor($hBrush_shadow, 0xB3000000) _GDIPlus_GraphicsFillEllipse($hGfx_shadow, ($iW_shadow_Img - $iW_shadow2) / 2, ($iH_shadowImg / 4 + $iH_shadow1), $iW_shadow2, $iH_shadow1, $hBrush_shadow) Global Const $hEffect_blur_shadow = _GDIPlus_EffectCreateBlur(32) _GDIPlus_BitmapApplyEffect($hImage_shadow, $hEffect_blur_shadow) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_shadow, ($iW - $iW_shadow_Img) / 2, $iH / 2 + $iH_shadow1 * 2.20, $iW_shadow_Img, $iH_shadowImg) ;draw globe Global Const $hPath_globe = _GDIPlus_PathCreate() _GDIPlus_PathAddEllipse($hPath_globe, ($iW - $iSize_globe) / 2, ($iH - $iSize_globe) / 2, $iSize_globe, $iSize_globe) Global Const $hLBrush_globe1 = _GDIPlus_LineBrushCreate($iW / 2, ($iH - $iSize_globe) / 2, $iW / 2, ($iH + $iSize_globe) / 2, 0, 0, 1) Global $aInterpolations[5][2] $aInterpolations[0][0] = 4 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFFEEEEEE $aInterpolations[2][1] = 0.10 $aInterpolations[3][0] = 0xFF2E86FB $aInterpolations[3][1] = 0.50 $aInterpolations[4][0] = 0xFF1A237E $aInterpolations[4][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe1, $aInterpolations) _GDIPlus_GraphicsFillPath($hGfx, $hPath_globe, $hLBrush_globe1) Global Const $iSize_globe2 = $iSize_globe * 0.85, $iSize_globe2_Img = $iSize_globe2 * 1.5 Global Const $hImage_globe2 = _GDIPlus_BitmapCreateFromScan0($iSize_globe2_Img, $iSize_globe2_Img) Global Const $hGfx_globe2 = _GDIPlus_ImageGetGraphicsContext($hImage_globe2) Global Const $hBrush_globe2 = _GDIPlus_BrushCreateSolid(0x7F000000) ;draw shadow and blur it Global Const $px = ($iSize_globe2_Img - $iSize_globe2) / 2, $py = ($iSize_globe2_Img - $iSize_globe2) / 2 _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py + ($iSize_globe - $iSize_globe2) * 0.25, $iSize_globe2, $iSize_globe2, $hBrush_globe2) Global Const $hEffect_blur_shadow2 = _GDIPlus_EffectCreateBlur(15) _GDIPlus_BitmapApplyEffect($hImage_globe2, $hEffect_blur_shadow2) ;draw 2nd smaller globe and blur it, too Global Const $hLBrush_globe2 = _GDIPlus_LineBrushCreate($iW / 2, $py, $iW / 2, $py + $iSize_globe2, 0, 0) Dim $aInterpolations[4][2] $aInterpolations[0][0] = 3 $aInterpolations[1][0] = 0xFFFFFFFF $aInterpolations[1][1] = 0 $aInterpolations[2][0] = 0xFF2E86FB $aInterpolations[2][1] = 0.60 $aInterpolations[3][0] = 0xFF283593 $aInterpolations[3][1] = 1.0 _GDIPlus_LineBrushSetPresetBlend($hLBrush_globe2, $aInterpolations) _GDIPlus_GraphicsFillEllipse($hGfx_globe2, $px, $py, $iSize_globe2, $iSize_globe2, $hLBrush_globe2) Global Const $hImage_globe2_blur = _Blur($hImage_globe2, $iSize_globe, $iSize_globe) ;windows gdi+ blur doesn't work properly _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage_globe2_blur, ($iW - $iSize_globe2_Img) / 2 - ($iSize_globe - $iSize_globe2) / 8, ($iH - $iSize_globe2_Img) / 2, $iSize_globe2_Img, $iSize_globe2_Img) GUISetState() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hImage, 0, 0, $iW, $iH) ;~ _GDIPlus_ImageSaveToFile($hImage, @ScriptDir & "\Blue Orb v1.20.png") ;clean-up ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hStringFormat) _GDIPlus_EffectDispose($hEffect_blur_text) _GDIPlus_EffectDispose($hEffect_blur_text_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow) _GDIPlus_EffectDispose($hEffect_blur_shadow2) _GDIPlus_PathDispose($hPath_text) _GDIPlus_PathDispose($hPath_globe) _GDIPlus_PenDispose($hPen_txt) _GDIPlus_BrushDispose($hBrush_txt) _GDIPlus_BrushDispose($hBrush_txt_shadow) _GDIPlus_BrushDispose($hBrush_bg) _GDIPlus_BrushDispose($hLBrush_globe1) _GDIPlus_BrushDispose($hLBrush_globe2) _GDIPlus_BrushDispose($hBrush_globe2) _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hImage_text) _GDIPlus_ImageDispose($hImage_shadow) _GDIPlus_ImageDispose($hImage_globe2) _GDIPlus_ImageDispose($hImage_globe2_blur) _GDIPlus_GraphicsDispose($hCanvas) _GDIPlus_GraphicsDispose($hGfx_text) _GDIPlus_GraphicsDispose($hGfx_shadow) _GDIPlus_GraphicsDispose($hGfx_globe2) _GDIPlus_Shutdown() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func _Blur($hBitmap, $iW, $iH, $fScale = 0.0525, $dx1 = 0, $dy1 = 0, $dx2 = 0, $dy2 = 0, $qual = 6) ; by eukalyptus Local $hBmpSmall = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxSmall = _GDIPlus_ImageGetGraphicsContext($hBmpSmall) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxSmall, $GDIP_PIXELOFFSETMODE_HALF) Local $hBmpBig = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfxBig = _GDIPlus_ImageGetGraphicsContext($hBmpBig) _GDIPlus_GraphicsSetPixelOffsetMode($hGfxBig, $GDIP_PIXELOFFSETMODE_HALF) _GDIPlus_GraphicsScaleTransform($hGfxSmall, $fScale, $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxSmall, $qual) _GDIPlus_GraphicsScaleTransform($hGfxBig, 1 / $fScale, 1 / $fScale) _GDIPlus_GraphicsSetInterpolationMode($hGfxBig, $qual) _GDIPlus_GraphicsDrawImageRect($hGfxSmall, $hBitmap, 0, $dx1, $iW, $iH + $dy1) _GDIPlus_GraphicsDrawImageRect($hGfxBig, $hBmpSmall, 0, $dx2, $iW, $iH + $dy2) _GDIPlus_BitmapDispose($hBmpSmall) _GDIPlus_GraphicsDispose($hGfxSmall) _GDIPlus_GraphicsDispose($hGfxBig) Return $hBmpBig EndFunc ;==>_Blur  
      I hope you like it.
       
      Feel free to post your examples here, too. 
×
×
  • Create New...