Hallo,
hier ein paar GDI+ Beispiele, die ich programmiert habe, um ein bißchen mehr über GDI+ zu lernen.
Es ist nichts bombastisches, aber vielleicht gefällt's euch ja
Codes wurden mit AutoIt v3.3.0.0 erstellt:
#01 - Fliegende Perlenkette:
Spoiler anzeigen
;coded by UEZ 2009-01-09 - thanks to smashly for _GDIPlus_BrushSetSolidColor() function
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=del "Flying Pearl Necklaces_Obfuscated.au3"
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Global Const $Pi = 4 * ATan(1)
Global Const $width = 400
Global Const $height = $width
Global $hGUI, $Graphic, $ParticleBitmap, $ParticleBuffer, $Brush1, $Brush2
Global $starting_point, $i, $j, $k, $l, $xcoord1, $ycoord1, $xcoord2, $ycoord2, $size, $red, $green, $blue, $min_size
$hGUI = GUICreate("GDI+: Flying Pearl Necklaces by UEZ 2009", $width, $height)
GUISetState(@SW_SHOW)
_GDIPlus_Startup ()
$Graphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI) ;create graphic
$ParticleBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $Graphic) ;create bitmap
$ParticleBuffer = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap) ;create buffer
_GDIPlus_GraphicsSetSmoothingMode($ParticleBuffer, 4) ;Antialiasing
_GDIPlus_GraphicsClear($ParticleBuffer) ;clear buffer
$Brush1 = _GDIPlus_BrushCreateSolid(0)
$Brush2 = _GDIPlus_BrushCreateSolid(0)
$i = -650
$l = $i
$starting_point = 0
$min_size = 10
Do
_GDIPlus_GraphicsClear($ParticleBuffer, 0xFFFFFFFF) ;clear buffer
$k = 2^12
$starting_point -= 0.05
For $j = 0 To $k Step 32
$red = ((Sin(2^1 * ($i + $j) / 2^10) + 1) / 2) * 256
$green = ((Sin(2^2 * ($i + $j) / 2^9) + 1) / 2) * 256
$blue = ((Sin(2^3 * ($i + $j) / 2^8) + 1) / 2) * 256
_GDIPlus_BrushSetSolidColor($Brush1, "0xCF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2))
_GDIPlus_BrushSetSolidColor($Brush2, "0xCF" & Hex($blue, 2) & Hex($red, 2) & Hex($green, 2))
$size = $i - $j
$xcoord1 = $width / 2 - (($i - $j) / 2) + Sin($starting_point) * -Sin(($i - $j) * $Pi / 90) * 64
$ycoord1 = $height / 2 - (($i - $j) / 2) + -Cos($starting_point) * Cos(($i - $j) * $Pi / 90) * 32
_GDIPlus_GraphicsFillEllipse($ParticleBuffer, $xcoord1, $ycoord1, $size / 6, $size / 6, $Brush1)
$xcoord2 = $width / 2 - (-($i - $j) / -1.75) - Sin($starting_point) * Sin(($i - $j) * $Pi / 120) * 32
$ycoord2 = $height / 2 - (($i - $j) / -1.75) - Cos($starting_point) * Cos(($i - $j) * $Pi / 75) * 16
_GDIPlus_GraphicsFillEllipse($ParticleBuffer, $xcoord2, $ycoord2, $size / 8 , $size / 8, $Brush2)
Next
_GDIPlus_GraphicsDrawImageRect($Graphic, $ParticleBitmap, 0, 0, $width, $height) ;copy to bitmap
$i += 3
If $i > $k + Abs($l) Then $i = $l
Sleep(20)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_BrushDispose($Brush1)
_GDIPlus_BrushDispose($Brush2)
_GDIPlus_GraphicsDispose ($Graphic)
_GDIPlus_BitmapDispose($ParticleBitmap)
_GDIPlus_GraphicsDispose($ParticleBuffer)
_GDIPlus_Shutdown ()
Exit
; #FUNCTION# ====================================================================
; Name...........: _GDIPlus_BrushSetSolidColor
; Description ...: Set the color of a Solid Brush object
; Syntax.........: _GDIPlus_BrushSetSolidColor($hBrush, [$iARGB = 0xFF000000])
; Parameters ....: $hBrush - Handle to a Brush object
; $iARGB - Alpha, Red, Green and Blue components of brush
; Return values .: Success - True
; Failure - False
; Author ........:
; Modified.......: smashly
; Remarks .......:
; Related .......:
; Link ..........; @@MsdnLink@@ GdipSetSolidFillColor
; Example .......; Yes
; ================================================================================
Func _GDIPlus_BrushSetSolidColor($hBrush, $iARGB = 0xFF000000)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipSetSolidFillColor", "hwnd", $hBrush, "int", $iARGB)
If @error Then Return SetError(@error, @extended, 0)
Return SetError($aResult[0], 0, $aResult[0] = 0)
EndFunc ;==>_GDIPlus_BrushSetSolidColor
#02 - Fliegende Quadrate:
Spoiler anzeigen
;coded by UEZ 2009-01-08
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=del "Flying Squares_Obfuscated.au3"
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global Const $Pi = 4 * ATan(1)
Global Const $width = 400
Global Const $height = 400
Global $hGUI, $hWnd, $hGraphic, $ParticleBitmap, $ParticleBuffer, $hBrush0, $Brush, $hBrush2, $Pen
Global $frequenz, $i, $j, $k, $xcoord, $ycoord, $size, $red, $green, $blue, $start
; Create GUI
$hGUI = GUICreate("GDI+: Flying Squares by UEZ 2009", $width, $height)
$hWnd = WinGetHandle($hGUI)
GUISetState()
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd) ;create graphic
$ParticleBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic) ;create bitmap
$ParticleBuffer = _GDIPlus_ImageGetGraphicsContext($ParticleBitmap) ;create buffer
;~ $Brush = _GDIPlus_BrushCreateSolid(0xAF777777)
$Pen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_GraphicsClear($ParticleBuffer) ;clear buffer
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$start = -64
$i = $start
$frequenz = 0
; Loop until user exits
Do
_GDIPlus_GraphicsClear($ParticleBuffer, 0xCF000000) ;clear buffer
$k = 768 ;amount of squares
$frequenz -= 0.025 ;smaller value = less frequency
For $j = $k To 0 Step -32
$red = ((Sin(2 ^ 0 * ($j - $i) / 2 ^ 5) + 1) / 2) * 256
$green = ((Sin(2 ^ 0 * ($j - $i) / 2 ^ 7) + 1) / 2) * 256
$blue = ((Sin(2 ^ 0 * ($j - $i) / 2 ^ 9) + 1) / 2) * 256
;~ $Brush = _GDIPlus_BrushCreateSolid("0x0F" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2))
_GDIPlus_PenSetColor($Pen, "0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2))
$size = $i - $j
$xcoord = $width / 2 - (($i - $j) / 2) + Sin($frequenz) * -Sin(($i - $j) * $Pi / 180) * 64
$ycoord = $height / 2 - (($i - $j) / 2) + -Cos($frequenz) * Cos(($i - $j) * $Pi / 150) * 32
If $size <= 2 * $width + 4 And $size <= 2 * $height Then _GDIPlus_GraphicsDrawRect($ParticleBuffer, $xcoord, $ycoord, $size, $size, $Pen)
;~ _GDIPlus_GraphicsFillRect($ParticleBuffer, $xcoord, $ycoord, $size, $size, $Brush);filled squares
Next
;~_GDIPlus_BrushDispose($Brush)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $ParticleBitmap, 0, 0, $width, $height) ;copy to bitmap
$i += 3
If $i > $k + 2^9 Then $i = $start
Until Not Sleep(20)
Func _Exit()
; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_BitmapDispose($ParticleBitmap)
_GDIPlus_GraphicsDispose($ParticleBuffer)
;~ _GDIPlus_BrushDispose($Brush)
_GDIPlus_Shutdown ()
Exit
EndFunc
#03 - Rotierende Quadrate:
Spoiler anzeigen
;coded by UEZ 2009-01-12
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=del /f /q "Rotating Squares_Obfuscated.au3"
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
Opt('MustDeclareVars', 1)
Global Const $Pi = 4 * ATan(1)
Global Const $width = @DesktopWidth / 2
Global Const $height = @DesktopHeight / 2
Global $hGUI, $hGraphic, $Bitmap, $GDI_Buffer, $Pen, $Brush, $ellipse_size, $ellipse_size_double
Global $i, $j, $k, $xcoord, $ycoord, $red, $green, $blue
Global $x1, $x2, $x3, $x4, $y1, $y2, $y3, $y4
$hGUI = GUICreate("GDI+: Rotating Squares by UEZ 2009", $width, $height)
GUISetState(@SW_SHOW)
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI) ;create graphic
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphic) ;create bitmap
$GDI_Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap) ;create buffer
$Pen = _GDIPlus_PenCreate(0, 2)
$Brush = _GDIPlus_BrushCreateSolid(0xFF000000)
_GDIPlus_GraphicsSetSmoothingMode($GDI_Buffer, 4)
_GDIPlus_GraphicsClear($GDI_Buffer)
$ellipse_size = 1.025
$ellipse_size_double = $ellipse_size * 2
$i = 1
Do
;~ _GDIPlus_GraphicsClear($GDI_Buffer) ;clear buffer
_GDIPlus_GraphicsFillEllipse($GDI_Buffer, $width / 2 - $ellipse_size * $k, $height / 2 - $ellipse_size* $k, $ellipse_size_double * $k, $ellipse_size_double * $k, $Brush) ;clear only area where the squares are drawn
If $k <= 3 * $width / 7 Then $k += 1
For $j = 8 To $k Step 24 + Cos($i * $Pi / 60) * 12
$red = ((Sin(2^0 * ($j - $i) / 2^5) + 1) / 2) * 256
$green = ((Sin(2^0 * ($j - $i) / 2^7) + 1) / 2) * 256
$blue = ((Sin(2^0 * ($j - $i) / 2^9) + 1) / 2) * 256
_GDIPlus_PenSetColor($Pen, "0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2)) ;Set the pen color
$xcoord = $j ;+ Sin($i * $Pi / 60) * 8
$ycoord = $j ;+ Cos($i * $Pi / 60) * 8
Square($xcoord, $ycoord, $j * Sin($i / $k * $Pi * 4) * 2 / 3)
Next
_GDIPlus_GraphicsDrawImageRect($hGraphic, $Bitmap, 0, 0, $width, $height) ;copy to bitmap
$i += 1.5
Sleep(30)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_PenDispose($Pen)
_GDIPlus_BitmapDispose($Bitmap)
_GDIPlus_GraphicsDispose($GDI_Buffer)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
Func Square($xx1, $yy1, $i) ;coded by UEZ
Local $degree = 45
Local Const $pi_Div_180 = 4 * ATan(1) / 180
$x1 = $xx1 * Cos(($i + $degree + 0) * $pi_Div_180) + $width / 2
$y1 = $yy1 * Sin(($i + $degree + 0) * $pi_Div_180) + $height / 2
$x2 = $xx1 * Cos(($i + $degree + 90) * $pi_Div_180) + $width / 2
$y2 = $yy1 * Sin(($i + $degree + 90) * $pi_Div_180) + $height / 2
$x3 = $xx1 * Cos(($i + $degree + 180) * $pi_Div_180) + $width / 2
$y3 = $yy1 * Sin(($i + $degree + 180) * $pi_Div_180) + $height / 2
$x4 = $xx1 * Cos(($i + $degree + 270) * $pi_Div_180) + $width / 2
$y4 = $yy1 * Sin(($i + $degree + 270) * $pi_Div_180) + $height / 2
_GDIPlus_GraphicsDrawLine($GDI_Buffer, $x1, $y1, $x2, $y2, $Pen)
_GDIPlus_GraphicsDrawLine($GDI_Buffer, $x2, $y2, $x3, $y3, $Pen)
_GDIPlus_GraphicsDrawLine($GDI_Buffer, $x3, $y3, $x4, $y4, $Pen)
_GDIPlus_GraphicsDrawLine($GDI_Buffer, $x4, $y4, $x1, $y1, $Pen)
EndFunc
#05 - L-System Fraktale:
Spoiler anzeigen
;coded by UEZ 2009-01-17 -=> recursion is very slow with AutoIt !!!
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=del "L-System Fractals_Obfuscated.au3"
#include <Array.au3>
#include <GDIPlus.au3>
#Include <Misc.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $dll = DllOpen("user32.dll")
Global Const $Pi = 4 * ATan(1)
Global Const $Pi_Div_180 = $Pi / 180
Global Const $width = 800
Global Const $height = 600
Global $hGUI, $hWnd, $hGraphic, $Bitmap, $Pen
Global $angle = 0, $x1, $y1, $x2, $y2, $random
Global $length, $depth, $dir, $degree, $dist_rel
Global $font_size, $String_Format, $Font_Family, $Font, $Text_Layout, $Brush, $text
$hGUI = GUICreate("GDI+: L-System Fractals by UEZ 2009 (press F9 to save current image)", $width, $height)
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "_Exit")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$Pen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) ; AntiAlias
$font_size = 7
$String_Format = _GDIPlus_StringFormatCreate ()
$Font_Family = _GDIPlus_FontFamilyCreate ("Arial")
$Font = _GDIPlus_FontCreate ($Font_Family, $font_size, 2)
$Brush = _GDIPlus_BrushCreateSolid (0xDF000000) ;text color
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$random = Random(1, 11, 1)
[/autoit] [autoit][/autoit] [autoit]AdlibEnable("Save_PIC", 50)
[/autoit] [autoit][/autoit] [autoit]While 1
Switch $random
Case 1 ;Dragon Curve
$x1 = $width / 4.2
$y1 = $height / 2.8
$length = 500
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Dragon Curve, Recursion Depth = " & $depth
Draw_Text()
Dragon($length, $depth, $dir)
Case 2 ;Levy-C Curve
$x1 = $width / 3.65
$y1 = $height / 2.875
$length = 475
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Levy-C Curve, Recursion Depth = " & $depth
Draw_Text()
Levy_C($length, $depth, $dir)
Case 3 ;Koch Curve
$x1 = $width / 5.3
$y1 = $height / 1.35
$x2 = ""
$y2 = ""
$length = 500
$depth = Random(2, 8, 1)
$dir = 1
$angle = 0
$text = "Koch Curve, Recursion Depth = " & $depth
Draw_Text()
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Case 4 ;Peano Curve
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 5, 1)
$dir = 1
$angle = 0
$text = "Peano Curve, Recursion Depth = " & $depth
Draw_Text()
Peano($length, $depth, $dir)
Case 5 ;Triangle
$x1 = $width / 10.8
$y1 = $height / 1.03
$length = 1300
$depth = Random(2, 10, 1)
$dir = 1
$angle = 0
$text = "Triangle, Recursion Depth = " & $depth
Draw_Text()
Triangle($length, $depth, $dir)
Case 6 ;Arrowhead Curve
$x1 = $width / 10.80
$y1 = $height / 1.05
$length = 650
$depth = Random(3, 9, 1)
$dir = 1
$angle = 0
$text = "Arrowhead Curve, Recursion Depth = " & $depth
Draw_Text()
Arrowhead_R($length, $depth, $dir) ;R
Case 7 ;Penta Plexity
$x1 = $width / 3.55
$y1 = $height / 15
$length = 350
$depth = Random(1, 6, 1)
$dir = 1
$angle = 0
$text = "Penta Plexity, Recursion Depth = " & $depth
Draw_Text()
;F++F++F++F++F
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Case 8 ;Sierpinski Carpet
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 6, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Carpet, Recursion Depth = " & $depth
Draw_Text()
Sierpinski_Carpet($length, $depth, $dir) ;F
Case 9 ;Gosper Curve
$depth = Random(4, 6, 1)
$x1 = $width / 1.45
$y1 = $height / 7 - $depth
$length = 480
$dir = 1
$angle = 0
$text = "Gosper Curve, Recursion Depth = " & $depth
Draw_Text()
Gosper_R($length, $depth, $dir) ;R
Case 10 ;Sierpinski Triangle
$x1 = $width / 10.666
$y1 = $height / 1.05
$length = 325
$depth = Random(2, 9, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Triangle, Recursion Depth = " & $depth
Draw_Text()
;FXF--FF--FF
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_X($length, $depth, $dir) ;X
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Case 11 ;Pythagoras Tree
$x1 = $width / 2
$y1 = $height / 1.1
$length = 110
$depth = Random(5, 15, 1)
$dir = 1
$angle = 5
$text = "Pythagoras Tree, Recursion Depth = " & $depth
Draw_Text()
Pythagoras($length, $depth, $dir)
EndSwitch
$random += 1
If $random = 12 Then $random = 1
Sleep(4000)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
Wend
Func Pythagoras($length, $split, $dir)
[/autoit] [autoit][/autoit] [autoit]If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Pythagoras_Square($length)
Else
$dist_rel = Sqrt(3) / 2
$degree = 30
Pythagoras_Square($length)
Forward_Only($length)
Turn(-$dir * 1 * $degree)
Pythagoras($length * $dist_rel, $split - 1, 1)
Turn($dir * 3 * $degree)
Forward_Only($length * $dist_rel)
Pythagoras($length / 2, $split - 1, 1)
Forward_Only(-$length * $dist_rel)
Turn(-$dir * 2 * $degree)
Forward_Only(-$length)
EndIf
;Sleep(0)
EndFunc
Func Pythagoras_Square($length)
Local $i
For $i = 1 To 4
Draw_and_Forward($length)
Turn($dir * 90)
Next
EndFunc
Func Sierpinski_X($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
;~ Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_F($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Gosper_R($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Gosper_L($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet($length, $split, $dir)
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 1 * $degree) ;+
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet_Forward_Only($length / $dist_rel, $split - 1, 1) ;f
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet_Forward_Only($length, $split, $dir) ;f
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
;Sleep(0)
EndFunc
Func Penta_Plexity($length, $split, $dir)
;F++F++F++F++F
;F -> F++F++F|F-F++F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = ((Sqrt(5) + 1) / 2)^2
$degree = 36
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 5 * $degree) ;180°
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_R($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_L($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Triangle($length, $split, $dir)
;F--F--F
;F -> F--F--F--ff
;ff -> ff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
EndIf
;Sleep(0)
EndFunc
Func Dragon($length, $split, $dir)
;F -> R
;R -> +R--L+
;L -> -R++L-
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = Sqrt(2)
Turn($dir * $degree) ;+
Dragon($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Dragon($length / $dist_rel, $split - 1, -1) ;L
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Levy_C($length, $split, $dir)
;F
;F -> +F--F+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = 1.45
Turn($dir * $degree) ;+
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Koch($length, $split, $dir)
;F--F--F
;F -> F+F--F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 60
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Peano($length, $split, $dir)
;F
;F -> F-F+F+F+F-F-F-F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Turn ($degrees)
$angle = $angle + ($degrees * $Pi_Div_180)
EndFunc
Func Draw_and_Forward($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
;~ Local $red = 0 ;((Cos(1 * $x1 / 2^6) + 1) / 2) * 256
;~ Local $green = 0;((Cos(1.25 * $y2 / 2^6) + 1) / 2) * 256
;~ Local $blue = 0;((Cos(1.5 * $x2 / 2^6) + 1) / 2) * 256
;~ _GDIPlus_PenSetColor($Pen, "0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2)) ;Set the pen color
_GDIPlus_PenSetColor($Pen, "0x60000000") ;Set the pen color
_GDIPlus_GraphicsDrawLine($hGraphic, $x1, $y1, $x2, $y2, $Pen)
$x1 = $x2
$y1 = $y2
EndFunc
Func Forward_Only($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
$x1 = $x2
$y1 = $y2
EndFunc
Func Draw_Text()
Local $Text_Layout2
Local $text_info = "UEZ 2009 ;-)"
$Text_Layout = _GDIPlus_RectFCreate (0, $height - 1.75 * $font_size, 0, 0)
$Text_Layout2 = _GDIPlus_RectFCreate ($width - StringLen($text_info) * $font_size * 0.67, $height - 1.75 * $font_size, 0, 0)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text, $Font, $Text_Layout, $String_Format, $Brush)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text_info, $Font, $Text_Layout2, $String_Format, $Brush)
EndFunc
Func Save_PIC()
If _IsPressed("78", $dll) Then
_GDIPlus_Save_to_Image(@ScriptDir & "\L-SF-Screenshot_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC, $hGUI)
If @error Then MsgBox(16, "ERROR", "Image was not saved!", 10)
EndIf
EndFunc
; #FUNCTION# =============================================================================
; Name...........: _GDIPlus_Save_to_Image
; Description ...: INTERNAL FUNCTION - save drawn image to file
; Syntax.........: _GraphGDIPlus_Reference_Pixel($file, $hWnd)
; Parameters ....: $file - filename
; $hWnd - handle to GUI
; Autor .........: ptrex, ProgAndy, UEZ
; =========================================================================================
Func _GDIPlus_Save_to_Image($file, $hWnd, $CLSID = "PNG")
Local $hDC, $memBmp, $memDC, $hImage, $w, $h, $size, $sCLSID
If $file <> "" Or $hWnd <> "" Then
$size = WinGetClientSize($hWnd)
$w = $size[0]
$h = $size[1]
$hDC = _WinAPI_GetDC($hWnd)
$memDC = _WinAPI_CreateCompatibleDC($hDC)
$memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $w, $h)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $w, $h, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
$sCLSID = _GDIPlus_EncodersGetCLSID ($CLSID)
;~ _GDIPlus_ImageSaveToFile($hImage, $file)
_GDIPlus_ImageSaveToFileEx ($hImage, $file & "." & StringLower($CLSID), $sCLSID)
If @error Then
Return SetError(1, 0, 0)
Else
Return SetError(0, 0, 0)
EndIf
_GDIPlus_ImageDispose ($hImage)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject ($memBmp)
Else
Return SetError(1, 0, 0)
EndIf
EndFunc
Func _Exit()
AdlibDisable()
; Clean up resources
_GDIPlus_PenDispose($Pen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_FontDispose ($Font)
_GDIPlus_FontFamilyDispose ($Font_Family)
_GDIPlus_StringFormatDispose ($String_Format)
_GDIPlus_BrushDispose($Brush)
_GDIPlus_Shutdown ()
DllClose($dll)
Exit
EndFunc
#06 - Sinus Laufschrift:
Spoiler anzeigen
;coded by UEZ 2009-01-29
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=del /f /q "Sinus Scroller_Obfuscated.au3"
#include <GUIConstantsEx.au3>
#include <GDIplus.au3>
Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)
Global Const $width = Int(@DesktopWidth * (@DesktopHeight / @DesktopWidth) * 0.666)
Global Const $height = Int(@DesktopHeight * (@DesktopHeight / @DesktopWidth) * 0.666)
Global Const $pi = 4 * ATan(1)
Global Const $pi_div_m170 = $pi / - 270
Global Const $pi_div_10 = $pi / 10
Global Const $pi_div_180 = $pi / 180
Global Const $height_div_2 = $height / 2
Global Const $width_div_2 = $width / 2
Global Const $font_size = Int(($width + $height) / 16)
Global Const $font_size2 = Int(($width + $height) / 32)
Global $hGUI, $graphics, $bitmap, $GDI_Buffer
Global $hBrush, $hFormat, $hFamily, $hFont, $hFont2, $text_color, $text_sin, $text_scroller, $tLayout, $pen, $brush
Global $i, $j, $k, $l
Global $m, $n, $x, $y, $z, $color
Global $arr_text_sin, $letter_distance, $x, $y, $lenght, $end, $scroller_length
Global $dc, $ScreenDc, $gdibitmap
Global $title = "GDI+: Sinus Scroller by UEZ 2009"
$hGUI = GUICreate($title, $width, $height)
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$GDI_Buffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($GDI_Buffer, 4)
$ScreenDc = _WinAPI_GetDC($hGUI)
$text_color = 0xEFD0D0FF
$hBrush = _GDIPlus_BrushCreateSolid($text_color)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, $font_size, 2)
$hFont2 = _GDIPlus_FontCreate($hFamily, $font_size2, 2)
$pen = _GDIPlus_PenCreate(0)
$brush = _GDIPlus_BrushCreateSolid(0)
$text_scroller = "YES, another GDI+ example, SINUS SCROLLER, by UEZ in 01/2009! Let's start... "
$text_sin = "I was inspired by the old good intro school on C64 when I was 15 and did some assembler intros :-). "
$text_sin &= "Greetings to all forum members at http://www.autoitscript.com and http://www.autoit.de. I hope you like it! The END."
$arr_text_sin = StringSplit($text_sin, "")
Global $stars = 128
Dim $arr_stars_x[$stars]
Dim $arr_stars_y[$stars]
Dim $aFont_Sized[Int($height / 4)]
Global Const $min_size = 4
Global Const $max_size = UBound($aFont_Sized) - 1
For $n = 0 To UBound($aFont_Sized) - 1
$aFont_Sized[$n] = _GDIPlus_FontCreate($hFamily, $n + $min_size, 0)
Next
For $n = 0 To UBound($arr_stars_y) - 1
$arr_stars_y[$n] = Random(1, $height - 1, 1)
Next
For $n = 0 To UBound($arr_stars_x) - 1
$arr_stars_x[$n] = Random(-$width * 1.5, -1, 1)
Next
Dim $arr_star_speed[8]
$arr_star_speed[0] = 1.00
$arr_star_speed[1] = 1.33
$arr_star_speed[2] = 1.66
$arr_star_speed[3] = 2.00
$arr_star_speed[4] = 2.33
$arr_star_speed[5] = 2.66
$arr_star_speed[6] = 3.33
$arr_star_speed[7] = 4.50
_GDIPlus_GraphicsSetSmoothingMode($GDI_Buffer, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
[/autoit] [autoit][/autoit] [autoit]Scroller_Ini()
[/autoit] [autoit][/autoit] [autoit]Do
Sinus_Scroller()
Until False
Func Stars()
$m = 0
For $n = 0 To UBound($arr_stars_x) - 1
Switch $arr_star_speed[$m]
Case 1.00
$color = 0xAF888888
Case 1.33
$color = 0xBF999999
Case 1.66
$color = 0xCFAAAAAA
Case 2.00
$color = 0xCFBBBBBB
Case 2.33
$color = 0xDFCCCCCC
Case 2.66
$color = 0xDFDDDDDD
Case 3.33
$color = 0xEFEEEEEE
Case 4.50
$color = 0xEFFFFFFF
EndSwitch
;~ If $arr_stars_x[$n] >= 0 And $arr_stars_x[$n] <= $width Then Set_Pixel($arr_stars_x[$n], $arr_stars_y[$n], $color)
If $arr_stars_x[$n] >= 0 And $arr_stars_x[$n] <= $width Then _GDIPlus_BitmapSetPixel($bitmap, $arr_stars_x[$n], $arr_stars_y[$n], $color)
$arr_stars_x[$n] += $arr_star_speed[$m]
$m += 1
If $m = UBound($arr_star_speed) - 1 Then $m = 0
If $arr_stars_x[$n] >= $width Then
$arr_stars_y[$n] = Random(1, $height - 1, 1)
$arr_stars_x[$n] = 0
EndIf
Next
Sleep(5)
EndFunc ;==>Stars
Func Sinus_Scroller()
$letter_distance = 32
$l = 0
For $k = $width To 0 - (StringLen($text_sin) * $letter_distance * 1.1) Step -1.5
_GDIPlus_GraphicsClear($GDI_Buffer, 0xFF000000)
For $i = 1 To UBound($arr_text_sin) - 1
$x = $k + ($i * $letter_distance) + ($width_div_2 * Cos($l - ($i * $pi / ATan($i * $pi_div_m170) * - 0.25))) * 0.4
$y = ($height_div_2 - 1.666 * $font_size2) + ($height * Sin($l - ($i * $pi_div_10))) * 0.35
$l += 0.00025
If $x > -$max_size And $x <= $width Then
DllStructSetData($tLayout, "x", $x)
DllStructSetData($tLayout, "y", $y)
$z = Sin(($y * 0.25) * $pi_div_180) * $max_size
If $z < 0 Then Abs($z)
_GDIPlus_GraphicsDrawStringEx($GDI_Buffer, $arr_text_sin[$i], $aFont_Sized[$z], $tLayout, $hFormat, $hBrush)
EndIf
Next
Sleep(5)
Stars()
;~ _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
_WinAPI_SelectObject($dc, $gdibitmap)
_WinAPI_DeleteObject($gdibitmap)
_WinAPI_BitBlt($ScreenDc, 0, 0, $Width, $Height, $dc, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
_WinAPI_DeleteDC($dc)
Next
EndFunc ;==>Sinus_Scroller
Func Scroller_Ini() ;very simple scroller
$letter_distance = $font_size
$lenght = $font_size * 1.666 * 0.36
$k = $width
$end = 0
$scroller_length = StringLen($text_scroller) * $lenght
$y = -($font_size * 0.2) + ($height_div_2 - $font_size * 0.5) ;center scroller
AdlibEnable("Scroller", 15)
While Not $end
Sleep(10)
WEnd
EndFunc ;==>Scroller
Func Scroller()
_GDIPlus_GraphicsClear($GDI_Buffer, 0xFF000000)
$x = $k + $letter_distance
DllStructSetData($tLayout, "x", $x)
DllStructSetData($tLayout, "y", $y)
_GDIPlus_GraphicsDrawStringEx($GDI_Buffer, $text_scroller, $hFont, $tLayout, $hFormat, $hBrush)
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
$k -= 2
If -$scroller_length >= $k Then
$end = 1
AdlibDisable()
EndIf
EndFunc
Func _GDIPlus_BitmapSetPixel($hBitmap, $iX, $iY, $iARGB = 0xFF000000)
Local $aRet
$aRet = DllCall($ghGDIPDll, "int", "GdipBitmapSetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "dword", $iARGB)
Return
EndFunc ;==>_GDIPlus_BitmapSetPixel
;~ Func _GDIPlus_BrushSetSolidColor($hBrush, $iARGB = 0xFF000000)
;~ Local $aResult
;~ $aResult = DllCall($ghGDIPDll, "int", "GdipSetSolidFillColor", "hwnd", $hBrush, "int", $iARGB)
;~ If @error Then Return SetError(@error, @extended, 0)
;~ Return SetError($aResult[0], 0, $aResult[0] = 0)
;~ EndFunc ;==>_GDIPlus_BrushSetSolidColor
Func _Exit()
_WinAPI_ReleaseDC($hGUI, $ScreenDc)
_WinAPI_DeleteObject ($gdibitmap)
For $n = 0 To UBound($aFont_Sized) - 1
_GDIPlus_FontDispose($aFont_Sized[$n])
Next
_GDIPlus_PenDispose($pen)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_BrushDispose($brush)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($GDI_Buffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
AiO Download Link (kompilierte Exes + Quellcode)
Was gefällt euch von den GDI+ Beispielen am besten?
Gruß,
UEZ;-)
PS: viel mehr Beispiele im engl. Forum!
2009-01-23: Perspektive im Code von Fliegende Quadrate korrigiert. Nun zeichnet es von hinten nach vorne!
2009-01-30: Sinus Laufschrift hunzugefügt
2009-02-02: #01 - Fliegende Perlenkette modifiziert (seperate Farbe für jede Kugel)
2009-02-05: Dreick und Pfeilspitze in #05 - L-System Fraktale hinzugefügt
2009-02-06: Sierpinski Dreieck, Gosper Kurve, Sierpinski Teppich und Penta Plexity in #05 - L-System Fraktale (10 Module nun) hinzugefügt
2009-02-07: Pythagoras Baum in #05 - L-System Fraktale (11 Module nun) hinzugefügt
2009-02-08: Sterne Scrolling in #06 - Sinus Laufschrift hinzugefügt
2009-03-03: AiO Link hinzugefügt
2009-11-14: #01 - #06 aktualisiert
2009-11-23: Screenshot (F9) in #05 - L-System Fraktale hinzugefügt