Jump to content



Photo

how to Anti Alias


  • Please log in to reply
2 replies to this topic

#1 PhoenixXL

PhoenixXL

    be what you are, its always the BEST..

  • MVPs
  • 1,561 posts

Posted 15 June 2012 - 07:23 AM

Here is a code
AutoIt         
#include <GUIConstantsEx.au3> #include <GDIPlus.au3> _Main() Func _Main() Local $hGUI, $hGraphic ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) GUISetState() _Curvature($hGUI,160,100,20,20,100,180,0x702E2EFE) _DrawLine($hGui,160,100+(20/2),160,120+40,0x702E2EFE) _Curvature($hGUI,160,160-(20/2),20,20,-100,180,0x702E2EFE) ; Draw arcs ;_GDIPlus_GraphicsDrawArc($hGraphic, 180, 100, 10, 10, 180, 360) ;_GDIPlus_GraphicsDrawArc($hGraphic, 160, 104, 30, 30, 160, -140) ;_GDIPlus_GraphicsDrawArc($hGraphic, 140, 80, 70, 70, 180, 360) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources EndFunc   ;==>_Main Func _DrawLine($Gui,$x1,$y1,$x2,$y2,$sChannel=0x80FFD700) Local  $hGraphic, $hPen ; Draw line _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($Gui) $hPen = _GDIPlus_PenCreate ($sChannel) If Not _GDIPlus_GraphicsDrawLine ($hGraphic, $x1,$y1,$x2,$y2, $hPen) Then ConsoleWrite('Error from GDI+:'&@error&@CRLF) ; Clean up resources _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_ShutDown () ;Done..... EndFunc   ;==>_Main Func _Curvature($hGui, $iX, $iY, $iWidth, $iHeight, $fSweepAngle,$fStartAngle=180, $hPen = 0x80FFD700) _GDIPlus_Startup() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui) $hPen=_GDIPlus_PenCreate($hPen) _GDIPlus_GraphicsDrawArc($hGraphic, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle , $hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc


I want to anti alias the Curves
I have already seen _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $iSmooth)
But it doesnt seem to do anything

Please guide me in the right direction

Thnx for your Time ;)

Edited by PhoenixXL, 15 June 2012 - 07:25 AM.

[color=rgb(255,0,0);]PredictText[/color][color=rgb(255,0,0);]:[/color] Predict Text of an Edit Control Like Scite. [color=rgb(204,153,0);]|[/color] [color=rgb(0,128,0);]Remote Gmail[/color][color=rgb(0,128,0);]: [/color]Execute your Scripts through Gmail. [color=rgb(255,165,0);] [/color][color=rgb(204,153,0);]|[/color] [color=rgb(255,140,0);]StringRegExp[/color][color=rgb(218,165,32);]:[/color][color=rgb(218,165,32);] [/color]Share and learn RegExp. [color=rgb(204,153,0);]| [/color]

[color=rgb(238,130,238);]Run As System[/color][color=rgb(238,130,238);]:[/color] A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). [color=rgb(204,153,0);]| [/color][color=rgb(255,0,0);]Database[/color]: An easier approach for _SQ_LITE beginners. [color=rgb(204,153,0);]| [/color]

[color=rgb(0,100,0);]MathsEx[/color][color=rgb(0,100,0);]:[/color] A UDF for Fractions and LCM, GCF/HCF. [color=rgb(204,153,0);]| [/color][color=rgb(238,130,238);]FloatingText[/color][color=rgb(238,130,238);]:[/color] An UDF for make your text floating. [color=rgb(204,153,0);]| [/color][color=rgb(255,140,0);]Clipboard Extendor[/color][color=rgb(255,140,0);]:[/color] A clipboard monitoring tool. [color=rgb(204,153,0);]|[/color]

[color=rgb(255,0,0);]Custom ScrollBar[/color][color=rgb(255,0,0);]:[/color][color=rgb(255,0,0);] [/color]Scroll Bar made with GDI+, user can use bitmaps instead. [color=rgb(204,153,0);]| [/color][color=#006400;]RestrictEdit_SRE:[/color][color=#006400;] [/color]Restrict text in an Edit Control through a Regular Expression. [color=rgb(204,153,0);]|[/color]








#2 UEZ

UEZ

    Never say never

  • MVPs
  • 5,326 posts

Posted 15 June 2012 - 07:52 AM

Try this:

AutoIt         
#include <guiconstantsex.au3> #include <gdiplus.au3> _GDIPlus_Startup() Global $hGraphic, $hGUI _Main() Func _Main()     ; Create GUI     $hGUI = GUICreate("GDI+", 400, 300)     GUISetState()     $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)     _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2)     _Curvature($hGUI,160,100,20,20,100,180,0x702E2EFE)     _DrawLine($hGui,160,100+(20/2),160,120+40,0x702E2EFE)     _Curvature($hGUI,160,160-(20/2),20,20,-100,180,0x702E2EFE)     ; Draw arcs     ;_GDIPlus_GraphicsDrawArc($hGraphic, 180, 100, 10, 10, 180, 360)     ;_GDIPlus_GraphicsDrawArc($hGraphic, 160, 104, 30, 30, 160, -140)     ;_GDIPlus_GraphicsDrawArc($hGraphic, 140, 80, 70, 70, 180, 360)     ; Loop until user exits     Do     Until GUIGetMsg() = $GUI_EVENT_CLOSE     ; Clean up resources     _GDIPlus_GraphicsDispose ($hGraphic)     _GDIPlus_ShutDown ()     Exit EndFunc   ;==>_Main Func _DrawLine($Gui,$x1,$y1,$x2,$y2,$sChannel=0x80FFD700)     Local $hPen = _GDIPlus_PenCreate ($sChannel)     If Not _GDIPlus_GraphicsDrawLine ($hGraphic, $x1,$y1,$x2,$y2, $hPen) Then ConsoleWrite('Error from GDI+:'&@error&@CRLF)     _GDIPlus_PenDispose ($hPen) EndFunc Func _Curvature($hGui, $iX, $iY, $iWidth, $iHeight, $fSweepAngle,$fStartAngle=180, $hPen = 0x80FFD700)     $hPen=_GDIPlus_PenCreate($hPen)     _GDIPlus_GraphicsDrawArc($hGraphic, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle , $hPen)     _GDIPlus_PenDispose ($hPen) EndFunc


Btw, you don't need to start/shutdown GDI+ in each function. Create a global graphic handle and use it in you functions.


Or use this:
AutoIt         
;coded by UEZ 2012 #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() $iW = 640 $iH = 480 $hgui = GUICreate("GDI+ draw rectangle with round corners", $iW, $iH) GUISetBkColor(0x000020, $hgui) GUISetState() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2) $p = 150 Draw_RoundRect($hGraphic, $p, $p, $iW - $p, $p, $iH - 2 * $p) ;draw rectangle with round corners GUISetOnEvent(-3, "_Exit") While Sleep(100000) WEnd Func Draw_RoundRect($hGfx, $iX1, $iY1, $iX2, $iY2, $iDist, $iArcSize = 40, $iColor = 0xFFFFFFFF, $iPenSize = 2) ;coded by UEZ 2012     Local $hPen = _GDIPlus_PenCreate($iColor, $iPenSize)     _GDIPlus_GraphicsDrawLine($hGfx, $iX1, $iY1, $iX2 + 1, $iY2, $hPen) ;upper horizontal line     _GDIPlus_GraphicsDrawArc($hGfx, $iX1 - $iArcSize / 2, $iY1, $iArcSize + 1, $iArcSize + 1, -90, -90, $hPen) ;left upper corner     _GDIPlus_GraphicsDrawArc($hGfx, $iX2 - $iArcSize / 2, $iY2, $iArcSize, $iArcSize, 0, -90, $hPen) ;right upper corner     _GDIPlus_GraphicsDrawArc($hGfx, $iX1 - $iArcSize / 2, $iY2 + $iDist - $iArcSize, $iArcSize, $iArcSize, 180, -90, $hPen) ;left bottom corner     _GDIPlus_GraphicsDrawArc($hGfx, $iX2 - $iArcSize / 2, $iY2 + $iDist - $iArcSize, $iArcSize, $iArcSize, -270, -90, $hPen) ;right bottom corner     _GDIPlus_GraphicsDrawLine($hGfx, $iX1 - $iArcSize / 2, $iY1 + $iArcSize / 2 - 1, $iX1 - $iArcSize / 2, $iY1 + $iDist - $iArcSize / 2 + 1, $hPen) ;left vertical line     _GDIPlus_GraphicsDrawLine($hGfx, $iX2 + $iArcSize / 2, $iY2 + $iArcSize / 2 - 1, $iX2 + $iArcSize / 2, $iY2 + $iDist - $iArcSize / 2 + 1, $hPen) ;right vertical line     _GDIPlus_GraphicsDrawLine($hGfx, $iX1 - 1, $iY1 + $iDist, $iX2 + 1, $iY2 + $iDist, $hPen) ;lower horizontal line     _GDIPlus_PenDispose($hPen) EndFunc Func _Exit()     GUIDelete()     _GDIPlus_GraphicsDispose($hGraphic)     _GDIPlus_Shutdown()     Exit EndFunc


Br,
UEZ

Edited by UEZ, 15 June 2012 - 08:34 AM.

 
[font="'Comic Sans MS';"][color=#808080;]The own fart smells best![/color][/font] [color=#404040;]✌[/color]
[color=#808080;][font="georgia, serif;"]Her 'sikim hıyar' diyene bir avuç tuz alıp koşma![/color][/font]
[color=#808080;][font="georgia, serif;"]¯_(ツ)_/¯[/color][/font]

#3 PhoenixXL

PhoenixXL

    be what you are, its always the BEST..

  • MVPs
  • 1,561 posts

Posted 15 June 2012 - 12:02 PM

Thnx UEZ it worked ;)

[color=rgb(255,0,0);]PredictText[/color][color=rgb(255,0,0);]:[/color] Predict Text of an Edit Control Like Scite. [color=rgb(204,153,0);]|[/color] [color=rgb(0,128,0);]Remote Gmail[/color][color=rgb(0,128,0);]: [/color]Execute your Scripts through Gmail. [color=rgb(255,165,0);] [/color][color=rgb(204,153,0);]|[/color] [color=rgb(255,140,0);]StringRegExp[/color][color=rgb(218,165,32);]:[/color][color=rgb(218,165,32);] [/color]Share and learn RegExp. [color=rgb(204,153,0);]| [/color]

[color=rgb(238,130,238);]Run As System[/color][color=rgb(238,130,238);]:[/color] A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). [color=rgb(204,153,0);]| [/color][color=rgb(255,0,0);]Database[/color]: An easier approach for _SQ_LITE beginners. [color=rgb(204,153,0);]| [/color]

[color=rgb(0,100,0);]MathsEx[/color][color=rgb(0,100,0);]:[/color] A UDF for Fractions and LCM, GCF/HCF. [color=rgb(204,153,0);]| [/color][color=rgb(238,130,238);]FloatingText[/color][color=rgb(238,130,238);]:[/color] An UDF for make your text floating. [color=rgb(204,153,0);]| [/color][color=rgb(255,140,0);]Clipboard Extendor[/color][color=rgb(255,140,0);]:[/color] A clipboard monitoring tool. [color=rgb(204,153,0);]|[/color]

[color=rgb(255,0,0);]Custom ScrollBar[/color][color=rgb(255,0,0);]:[/color][color=rgb(255,0,0);] [/color]Scroll Bar made with GDI+, user can use bitmaps instead. [color=rgb(204,153,0);]| [/color][color=#006400;]RestrictEdit_SRE:[/color][color=#006400;] [/color]Restrict text in an Edit Control through a Regular Expression. [color=rgb(204,153,0);]|[/color]





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users