1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • PathWarp To Path bzw. Text zu Bezierkurve biegen

    • UEZ
    • 2. Mai 2013 um 09:42

    Wie gesagt hängt es an DEP, ob DEP aktiviert ist oder nicht. Das Problem ist, dass der ASM Teil direkt in den Speicher schreibt und ausführt; DEP verhindert dies.

    Einfach mal DEP einschalten und eines der Beispiele starten. Das Intro sollte davon nicht betroffen sein. ;)

    Gruß,
    UEZ

  • PathWarp To Path bzw. Text zu Bezierkurve biegen

    • UEZ
    • 1. Mai 2013 um 17:18

    eukalyptus: der Dank gehört dir! Die paar Zeilen Code von mir sind da nicht erwähnenswert! Dein Auffassungsvermögen ist schon echt irre! :thumbup:

    Andy: den "Verbeuge" Smiley gibt's bestimmt irgendwo, aber der hier tut's auch: [Blockierte Grafik: http://www.smileygarden.de/smilie/Sonstige/bowdown.gif]

    @Pee: unter http://www.smileygarden.de gibt's tonnenweise Smileys. Wie wäre's mit ein paar Neuen?

    Gruß,
    UEZ

  • 8 Bit zu 3 Bit | Bitaufteilung

    • UEZ
    • 30. April 2013 um 19:13

    Probiere es mal damit:

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $array = _AscToDua('AutoIt')
    $a3bit = StringRegExp($array[0][0], ".{3}", 3)
    _ArrayDisplay($a3bit)

    [/autoit] [autoit][/autoit] [autoit]

    Func _AscToDua($sString)
    Local $asAsc = StringToASCIIArray($sString)
    Local $aiDua[UBound($asAsc) + 1][8]
    Local $iA, $iB, $bin

    [/autoit] [autoit][/autoit] [autoit]

    For $iA = 0 To UBound($asAsc) - 1
    For $iB = UBound($aiDua, 2) - 1 To 0 Step - 1
    $aiDua[$iA + 1][$iB] = Int(BitAND($asAsc[$iA], BitShift(1, $iB * -1)) <> 0)
    $bin &= $aiDua[$iA + 1][$iB]
    Next
    Next
    $aiDua[0][0] = $bin
    Return $aiDua
    EndFunc

    [/autoit]

    Gruß,
    UEZ

  • PathWarp To Path bzw. Text zu Bezierkurve biegen

    • UEZ
    • 29. April 2013 um 20:17

    Hier ein kleines Intro ala AAAAAAAMMMMMMMMIIIIIIIIIIIGGGGGGGGGAAAAAAAA! :rock:

    Source Code: http://pastebin.com/U24ACRAr

    Basiert auf Example 7.

    Der ASM Teil läuft anscheinend nur auf Win7 oder höheren Betriebssystemen (bitte mal testen)! Liegt daran, dass DEP eingeschaltet ist. Sollte jetzt ab WinXP funzen!

    Gruß,
    UEZ

    Dateien

    Text to Bezier Intro.au3 251,17 kB – 751 Downloads
  • PathWarp To Path bzw. Text zu Bezierkurve biegen

    • UEZ
    • 29. April 2013 um 11:19

    FETT! 8o

    Example 7 gefällt mir am besten!

    Wäre die Laufzeit ohne ASM zu langsam? Interessant wäre auch der Maschinencode in ASM Code dargestellt. ;)

    Gruß,
    UEZ :thumbup:

  • OpenCL meets OpenGL in AutoIt

    • UEZ
    • 28. April 2013 um 13:44

    Andy: die OpenGL Beispiele von minx funzen bei mir und hier der Output zu Post#19:

    Spoiler anzeigen
    Code
    @@ Debug(194) : $ret = 
    >Error code: 0
    @@ Debug(45) : $a = 1
    >Error code: 0
    @@ Debug(64) : $gl_context = 65536
    >Error code: 0
    @@ Debug(67) : $gl_hdc = 3506513099
    >Error code: 0
    @@ Debug(194) : $ret = 
    >Error code: 0
    @@ Debug(71) : $init = 0
    >Error code: 0
    @@ Debug(72) : $ret = No error
    >Error code: 0
    @@ Debug(87) : $vendor = Intel
    >Error code: 0
    @@ Debug(90) : $renderer = Intel(R) HD Graphics
    >Error code: 0
    @@ Debug(92) : $version = 2.1.0 - Build 8.15.10.2413
    >Error code: 0
    @@ Debug(95) : $version = 1.20  - Intel Build 8.15.10.2413
    >Error code: 0
    @@ Debug(98) : $extensions = GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_blend_color GL_EXT_abgr GL_EXT_texture3D GL_EXT_clip_volume_hint GL_EXT_compiled_vertex_array GL_SGIS_texture_edge_clamp GL_SGIS_generate_mipmap GL_EXT_draw_range_elements GL_SGIS_texture_lod GL_EXT_rescale_normal GL_EXT_packed_pixels GL_EXT_texture_edge_clamp GL_EXT_separate_specular_color GL_ARB_multitexture GL_EXT_texture_env_combine GL_EXT_bgra GL_EXT_blend_func_separate GL_EXT_secondary_color GL_EXT_fog_coord GL_EXT_texture_env_add GL_ARB_texture_cube_map GL_ARB_transpose_matrix GL_ARB_texture_env_add GL_IBM_texture_mirrored_repeat GL_EXT_multi_draw_arrays GL_NV_blend_square GL_ARB_texture_compression GL_3DFX_texture_compression_FXT1 GL_EXT_texture_filter_anisotropic GL_ARB_texture_border_clamp GL_ARB_point_parameters GL_ARB_texture_env_combine GL_ARB_texture_env_dot3 GL_ARB_texture_env_crossbar GL_EXT_texture_compression_s3tc GL_ARB_shadow GL_ARB_window_pos GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_ARB_vertex_program GL_EXT_texture_rectangle GL_ARB_fragment_program GL_EXT_stencil_two_side GL_ATI_separate_stencil GL_ARB_vertex_buffer_object GL_EXT_texture_lod_bias GL_ARB_occlusion_query GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_texture_non_power_of_two GL_ARB_vertex_shader GL_NV_texgen_reflection GL_ARB_point_sprite GL_EXT_blend_equation_separate GL_ARB_depth_texture GL_ARB_texture_rectangle GL_ARB_draw_buffers GL_ARB_color_buffer_float GL_ARB_half_float_pixel GL_ARB_texture_float GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_EXT_draw_buffers2 GL_WIN_swap_hint GL_EXT_texture_sRGB GL_EXT_packed_float GL_EXT_texture_shared_exponent GL_ARB_texture_rg GL_ARB_texture_compression_rgtc GL_NV_conditional_render GL_EXT_texture_swizzle GL_ARB_framebuffer_sRGB GL_EXT_packed_depth_stencil GL_ARB_depth_buffer_float GL_EXT_transform_feedback GL_EXT_framebuffer_blit GL_ARB_vertex_array_object 
    >Error code: 0
    @@ Debug(194) : $ret = 
    >Error code: 0
    @@ Debug(104) : $a = 0
    >Error code: 0
    @@ Debug(167) : get_glew_address("__glewGenBuffers") = 268611568
    >Error code: 0
    @@ Debug(121) : $genbuff = 1
    >Error code: 0
    @@ Debug(123) : $textur_Obj = 1
    >Error code: 0
    @@ Debug(174) : get_glew_address("__glewBindBuffer") = 268611504
    >Error code: 0
    @@ Debug(126) : $bind = 0
    >Error code: 0
    @@ Debug(174) : get_glew_address("__glewBindBuffer") = 268611504
    >Error code: 0
    @@ Debug(131) : $bind = 0
    >Error code: 0
    @@ Debug(182) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(185) : $aCall = 
    >Error code: 0
    @@ Debug(138) : $a = 0
    >Error code: 0
    @@ Debug(139) : glewbufferdata = No error
    >Error code: 0
    @@ Debug(182) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(185) : $aCall = 
    >Error code: 0
    @@ Debug(142) : $a = 0
    >Error code: 0
    @@ Debug(143) : glewbufferdata = No error
    >Error code: 0
    @@ Debug(182) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(185) : $aCall = 
    >Error code: 0
    @@ Debug(148) : $a = 0
    >Error code: 0
    @@ Debug(149) : glewbufferdata = No error
    >Error code: 0
    @@ Debug(182) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(185) : $aCall = 
    >Error code: 0
    @@ Debug(152) : $a = 0
    >Error code: 0
    @@ Debug(153) : glewbufferdata = No error
    >Error code: 0
    Alles anzeigen

    Gruß,
    UEZ

  • OpenCL meets OpenGL in AutoIt

    • UEZ
    • 27. April 2013 um 23:55

    Und hier das von mir:

    Spoiler anzeigen
    Code
    @@ Debug(141) : $ret = 
    >Error code: 0
    @@ Debug(44) : $a = 1
    >Error code: 0
    @@ Debug(141) : $ret = 
    >Error code: 0
    @@ Debug(64) : $a = 0
    >Error code: 0
    @@ Debug(114) : get_glew_address("__glewGenBuffers") = 268611568
    >Error code: 0
    @@ Debug(81) : $genbuff = 1
    >Error code: 0
    @@ Debug(83) : $textur_Obj = 1
    >Error code: 0
    @@ Debug(121) : get_glew_address("__glewBindBuffer") = 268611504
    >Error code: 0
    @@ Debug(87) : $bind = 0
    >Error code: 0
    @@ Debug(129) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(132) : $aCall = 
    >Error code: 0
    @@ Debug(94) : $a = 0
    >Error code: 0
    @@ Debug(95) : glewbufferdata = No error
    >Error code: 0
    @@ Debug(129) : get_glew_address("__glewBufferData") = 268611632
    >Error code: 0
    @@ Debug(132) : $aCall = 
    >Error code: 0
    @@ Debug(98) : $a = 0
    >Error code: 0
    @@ Debug(99) : glewbufferdata = No error
    >Error code: 0
    Alles anzeigen

    Gruß,
    UEZ

  • OpenCL meets OpenGL in AutoIt

    • UEZ
    • 27. April 2013 um 20:48

    Ich sehe nur schwarz. Es wird zwar was berechnet, aber die GUI bleibt schwarz (GLCL_mandelbrot_flug.au3). Vielleicht häng's an meiner Onboard Gfx Karte...

    Bei den anderen Beispielen tunnelflug_GLCL_*.au3 und wuerfel_GLCL_*.au3 bekomme ich eine Menge Fehlermeldungen.

    Gruß,
    UEZ

  • Bit-Anzeiger

    • UEZ
    • 27. April 2013 um 20:45
    Zitat von Andy

    pff, kürzer :D

    [autoit]

    $aButtons[$i] = GUICtrlCreateButton("0", $iX+(($i>3)*10) + $i * 24, 16, 19, 25, $WS_GROUP)
    ;If $i = 3 Then $iX += 10

    [/autoit]

    so macht man das :D
    und in der Case kann man auch noch drei Zeilen rausschinden, aber ansonsten :thumbup:

    und btw.:

    [autoit]

    ;~ If GUICtrlRead(@GUI_CtrlId) = "0" Then
    GUICtrlSetData(@GUI_CtrlId, 1*(not(number(GUICtrlRead(@GUI_CtrlId)))))
    ;~ Else
    ;~ GUICtrlSetData(@GUI_CtrlId, "0")
    ;~ EndIf

    [/autoit]
    Alles anzeigen


    Das mit

    [autoit]


    $aButtons[$i] = GUICtrlCreateButton("0", $iX + (($i > 3) * 10) + $i * 24, 16, 19, 25, $WS_GROUP)

    [/autoit]


    ist eine klasse Idee! Warum bin ich nicht selbst darauf gekommen? Kann sein, dass es an der Uhrzeit hing. ;)

    Die 3 Zeilen rauszuschmeißen macht die Sache leider unübersichtlich und nicht wirklich kürzer, eher länger, außer die Anzahl der Zeilennummern, denn man wiederholt immer wieder Teile von den Zeilen.

    Gruß,
    UEZ

  • Bit-Anzeiger

    • UEZ
    • 27. April 2013 um 01:09
    Zitat von minx

    OK, es geht noch kürzer :D

    ;)

    Gruß,
    UEZ

  • Bit-Anzeiger

    • UEZ
    • 27. April 2013 um 01:05

    Ich war mal so frei und habe dein Skript ein wenig gekürzt:

    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    $Form1_1 = GUICreate("Bit Anzeiger", 226, 83, 192, 114)
    $Label1 = GUICtrlCreateLabel("•", 112, 32, 8, 18)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    Global $aButtons[8], $aBits[8], $iX = 16, $iVal, $i
    For $i = 0 To 7
    $aButtons[$i] = GUICtrlCreateButton("0", $iX + $i * 24, 16, 19, 25, $WS_GROUP)
    If $i = 3 Then $iX += 10
    Next
    $out = GUICtrlCreateInput("", 16, 48, 65, 21)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit]

    While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
    Case $GUI_EVENT_CLOSE
    GUIDelete()
    Exit
    Case $aButtons[0] To $aButtons[7]
    $iPos = $iMsg - $aButtons[0]
    $iBit = BitXOR($aBits[$iPos], 1)
    $aBits[$iPos] = $iBit
    GUICtrlSetData($aButtons[$iPos], $iBit)
    For $i = 7 To 0 Step - 1
    $iVal += 2 ^ (7 - $i) * $aBits[$i]
    Next
    GUICtrlSetData($out, $iVal)
    $iVal = 0
    EndSwitch
    WEnd

    [/autoit]

    Gruß,
    UEZ

  • Bildpunkte erkennen

    • UEZ
    • 16. April 2013 um 19:15
    Zitat von Scriptinator

    Hallo

    Nach dem Start einer Testumgebung (Server), muss ich händisch oftmals auf neuen VMs die IP, Hostname etc anpassen. Das möchte ich versuchen etwas zu vereinfachen. Außerdem das Installieren von Rollen auf Servern wäre recht nett. Brauche nur eben anfangs immer einen Startpunkt, falls das Fenster eben mal nicht mittig ist.
    Ist vielleicht nicht die einfachste Methode aber ich möchte es dennoch mal so versuchen.

    LG

    Normalerweise ist das nicht der Weg, um die VMs zu konfigurieren. Dafür gibt es PowerShell Scriptlets (vSphere PowerCLI).

    Gruß,
    UEZ

  • FotoSort

    • UEZ
    • 16. April 2013 um 16:20

    2 Dinge sind mir noch aufgefallen:

    1) die Funktion _DrawBgColor() ist so performanter

    [autoit]


    Func _DrawBgColor($iLeft, $iTop, $iWidth, $iHeight)
    Switch $iBgColor
    Case 0
    _GDIPlus_GraphicsFillRect($hGraphicBuff, $iPreviewLeft, $iPreviewTop, $iPreviewWidth, $iPreviewHeight, $hTexture)
    Case 1
    _GDIPlus_GraphicsFillRect($hGraphicBuff, $iPreviewLeft, $iPreviewTop, $iPreviewWidth, $iPreviewHeight, $ahBrush[3])
    Case 2
    _GDIPlus_GraphicsFillRect($hGraphicBuff, $iPreviewLeft, $iPreviewTop, $iPreviewWidth, $iPreviewHeight, $ahBrush[2])
    EndSwitch
    EndFunc

    [/autoit]

    2) Apropos Performance _ShowStatus() ist ziemlich langsam. Beim Blättern benötige die Funktion um die 400 ms. Da ist bestimmt noch Raum für Optimierungen. ;)

    Gruß,
    UEZ

  • FotoSort

    • UEZ
    • 16. April 2013 um 10:59

    Du könntest folgende Funktion nehmen, um das Pattern schneller zu erzeugen:

    [autoit]


    Func _DrawPattern($iLeft, $iTop, $iWidth, $iHeight)
    Local $iBrush = True, $iStep = 8
    _GDIPlus_GraphicsFillRect($hGraphicBuff, $iPreviewLeft, $iPreviewTop, $iPreviewWidth, $iPreviewHeight, $ahBrush[2])
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", 2 * $iStep, "int", 2 * $iStep, "int", 0, "int", $GDIP_PXF32ARGB, "ptr", 0, "int*", 0)
    Local $hBitmap = $aResult[6]
    Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iStep, $iStep, $ahBrush[0])
    _GDIPlus_GraphicsFillRect($hCtxt, $iStep, 0, $iStep, $iStep, $ahBrush[1])
    _GDIPlus_GraphicsFillRect($hCtxt, 0, $iStep, $iStep, $iStep, $ahBrush[1])
    _GDIPlus_GraphicsFillRect($hCtxt, $iStep, $iStep, $iStep, $iStep, $ahBrush[0])
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "handle", $hBitmap, "int", 0, "int*", 0)
    Local $hTexture = $aResult[3]
    _GDIPlus_GraphicsFillRect($hGraphicBuff, $iPreviewLeft, $iPreviewTop, $iPreviewWidth, $iPreviewHeight, $hTexture)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BrushDispose($hTexture)
    _GDIPlus_BitmapDispose($hBitmap)
    EndFunc

    [/autoit]

    Ferner könntest du das Pattern einmal erstellen und nur die Bitmap kopieren, als immer das Pattern neu zu erstellen, denn es ändert sich nichts daran.

    Gruß,
    UEZ

  • Pipeline DLL - die einfachste Art der Prozess-Kommunikation

    • UEZ
    • 15. April 2013 um 10:13

    Zeigst du uns bitte auch noch den Source Code der DLL? :D

    Gruß,
    UEZ

  • FotoSort

    • UEZ
    • 14. April 2013 um 21:38

    Ganz nettes Tools :thumbup:

    Vielleicht könnte man den Hintergrund für transparente Bilder anders Darstellen als das schlichte schwarz, wie z.B. das klassische Schachbrettmuster.

    Gruß,
    UEZ

  • Bild mit 256 Farben erstellen

    • UEZ
    • 14. April 2013 um 12:21

    Man sollte hier zwischen 256 Farben und einer 8 Bit Bitmap differenzieren. Ein 24-bit Bild kann theoretisch auch nur 256 Farben beinhalten, aber ein 8 Bit Bild niemals mehr als 256 Farben.

    Hier 2 kleine Snippets.

    1) Benötigt kein GDI+ v1.1:

    Spoiler anzeigen
    [autoit]


    #include <GDIPlus.au3>
    $sFile = FileOpenDialog("Bitte ein Bild selektieren", "", "Bilder (*.jpg;*.bmp;*.png)", 3)
    If @error Then Exit
    _GDIPlus_Startup()
    $hBitmap = _GDIPlus_BitmapCreateFromFile($sFile)
    $iWidth = _GDIPlus_ImageGetWidth($hBitmap)
    $iHeight = _GDIPlus_ImageGetHeight($hBitmap)
    $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", $GDIP_PXF08INDEXED, "ptr", 0, "int*", 0)
    $hBmp8bit = $aResult[6]
    $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmp8bit)
    _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBitmap, 0, 0, $iWidth, $iHeight)
    _GDIPlus_GraphicsDispose($hCtxt)
    _GDIPlus_BitmapDispose($hBitmap)
    $sOutputFile = @ScriptDir & "\Test_8bit.png"
    _GDIPlus_ImageSaveToFile($hBmp8bit, $sOutputFile)
    _GDIPlus_BitmapDispose($hBmp8bit)
    _GDIPlus_Shutdown()
    ShellExecute($sOutputFile)

    [/autoit]

    2) Benötigt GDI+ v1.1 (Vista oder höhere):

    Spoiler anzeigen
    [autoit]


    #include <ScreenCapture.au3>

    [/autoit] [autoit][/autoit] [autoit]

    If @OSBuild < 6000 Then Exit MsgBox(16, "Error", "GDI+ v1.1 needed -> Vista+ OS!", 10)

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $GDIP_PXF32CMYK = 0x0000200F
    Global Const $GDIP_PXFMAX = 0x00000010

    [/autoit] [autoit][/autoit] [autoit]

    Global Enum $DitherTypeNone = 0, $DitherTypeSolid, $DitherTypeOrdered4x4, $DitherTypeOrdered8x8, $DitherTypeOrdered16x16, $DitherTypeOrdered91x91, $DitherTypeSpiral4x4, $DitherTypeSpiral8x8, $DitherTypeDualSpiral4x4, $DitherTypeDualSpiral8x8, $DitherTypeErrorDiffusion
    Global Enum $PaletteTypeCustom = 0, $PaletteTypeOptimal, $PaletteTypeFixedBW, $PaletteTypeFixedHalftone8, $PaletteTypeFixedHalftone27, $PaletteTypeFixedHalftone64, $PaletteTypeFixedHalftone125, $PaletteTypeFixedHalftone216, $PaletteTypeFixedHalftone252, $PaletteTypeFixedHalftone256

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    $iW = 300
    $iH = 300
    $hHBitmap = _ScreenCapture_Capture("", 0, 0, $iW, $iH) ;24 bit screen capture
    $hBitmap_screen = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) ;convert bitmap format

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $iColorCount = 1024
    $DitherType = $DitherTypeDualSpiral8x8
    $PaletteType = $PaletteTypeFixedHalftone256
    $PixelFormat = $GDIP_PXF08INDEXED

    [/autoit] [autoit][/autoit] [autoit]

    $tPalette = DllStructCreate("uint Flags; uint Count; uint Entries[" & $iColorCount & "];")
    DllStructSetData($tPalette, "Flags", $PaletteType)
    DllStructSetData($tPalette, "Count", $iColorCount)

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite("> Init Palette: " & _GDIPlus_InitializePalette($tPalette, $PaletteType, 0, True, 0) & @CRLF)
    ConsoleWrite("! Error: " & @error & " Extended: " & @extended & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite("> Convert: " & _GDIPlus_BitmapConvertFormat($hBitmap_screen, $PixelFormat, $DitherType, $PaletteType, $tPalette, 0) & @CRLF)
    ConsoleWrite("! Error: " & @error & " Extended: " & @extended & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_ImageSaveToFile($hBitmap_screen, @ScriptDir & "\Test.png")
    _WinAPI_DeleteObject($hHBitmap)
    _GDIPlus_BitmapDispose($hBitmap_screen)
    _GDIPlus_Shutdown()
    ShellExecute(@ScriptDir & "\Test.png")
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_BitmapConvertFormat($hBitmap, $iPixelFormat, $iDitherType, $iPaletteType, $tPalette, $falphaThresholdPercent = 0) ;http://msdn.microsoft.com/en-us/library/…6(v=VS.85).aspx
    Local $aResult = DllCall($ghGDIPDll, "bool", "GdipBitmapConvertFormat", "handle", $hBitmap, "long", $iPixelFormat, "long", $iDitherType, "long", $iPaletteType, "struct*", $tPalette, "float", $falphaThresholdPercent)
    If @error Then Return SetError(@error, @extended, -1)
    Return $aResult[0]
    EndFunc ;==>_GDIPlus_BitmapConvertFormat

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _GDIPlus_InitializePalette($tPalette, $iPaletteType, $iOptimalColors = 0, $bUseTransparentColor = True, $hBitmap = 0) ;http://msdn.microsoft.com/en-us/library/…9(v=vs.85).aspx
    Local $aResult = DllCall($ghGDIPDll, "bool", "GdipInitializePalette", "struct*", $tPalette, "long", $iPaletteType, "int", $iOptimalColors, "bool", $bUseTransparentColor, "handle", $hBitmap)
    If @error Then Return SetError(@error, @extended, -1)
    Return $aResult[0]
    EndFunc ;==>_GDIPlus_InitializePalette

    [/autoit] [autoit][/autoit] [autoit]

    #cs
    http://msdn.microsoft.com/en-us/library/…6(v=vs.85).aspx
    VOID Example_ConvertFormat(HDC hdc)
    {
    Graphics graphics(hdc);
    Bitmap myBitmap(L"Photo.jpg");
    INT width = myBitmap.GetWidth();
    INT height = myBitmap.GetHeight();

    [/autoit] [autoit][/autoit] [autoit]

    graphics.DrawImage(&myBitmap, 20, 20, width, height);

    [/autoit] [autoit][/autoit] [autoit]

    // PaletteTypeFixedHalftone27 has 36 entries. A ColorPalette structure has
    // room for one entry, so space is allocated for an additional 35 entries.
    ColorPalette* pal = (ColorPalette*)malloc(sizeof(ColorPalette) + 35*sizeof(ARGB));
    pal->Count = 36;
    pal->Flags = 0;

    [/autoit] [autoit][/autoit] [autoit]

    Bitmap::InitializePalette(pal, PaletteTypeFixedHalftone27, 0, TRUE, NULL);

    [/autoit] [autoit][/autoit] [autoit]

    myBitmap.ConvertFormat(
    PixelFormat8bppIndexed,
    DitherTypeOrdered8x8,
    PaletteTypeFixedHalftone27,
    pal,
    0);

    [/autoit] [autoit][/autoit] [autoit]

    graphics.DrawImage(&myBitmap, width + 40, 20, width, height);

    [/autoit] [autoit][/autoit] [autoit]

    free(pal);
    }
    #ce

    [/autoit]

    Es gibt bestimmt noch andere Möglichkeiten 8 Bit Bilder zu erstellen (siehe Andy's kommentar).

    Gruß,
    UEZ

  • AutoIt-only 3D Engine. Mit Farb-Shading, Models aus Dateien, Rotation, Zoom, uvm.

    • UEZ
    • 12. April 2013 um 18:54

    Wenn du noch eine Texture drauf packen kannst, dann AAAAAAAAMMMMMMMMMMMMMMIIIIIIIIIIIIIIIIIIIIIIIIIIIIIGGGGGGGGGGGGGAAAAAAAAAAAAAAAA! :rock:

    Ansonsten top! :thumbup:

    Gruß,
    UEZ

  • Icons glätten?

    • UEZ
    • 11. April 2013 um 23:29

    GuiCtrlCreatePic() dient nur zum Anzeigen des GDI+ Bildes, um das Resultat zu vergleichen. Besser wäre es, das GDI+ Bild an den Control zu schicken, dann würde das Bild auch nicht gelöscht.

    Suche dir das Beste aus. ;)


    Gruß,
    UEZ

  • Icons glätten?

    • UEZ
    • 11. April 2013 um 22:37

    Hier ein Beispiel:

    Spoiler anzeigen
    [autoit]


    #include <WindowsConstants.au3>
    #include <GDIPlus.au3>
    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()
    Global Const $STM_SETIMAGE = 0x0172

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGUI, $Msg, $Button, $Icon, $hIcon, $iPic, $hPic, $hGraphics, $Index = 0, $iBGColor = 0xF0F0F0
    Global $hIcon300x300 = _WinAPI_ShellExtractIcon("C:\Windows\system32\mobsync.exe", $Index, 300, 300)
    Global $hHBitmap256x256 = _WinAPI_GetFileIcon("C:\Windows\system32\mobsync.exe", $Index, 256, 256, $iBGColor)
    Global $hBitmapIcon256x256 = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap256x256)
    Global $hBitmapIcon300x300 = _GDIPlus_BitmapCreateFromScan0(300, 300)
    Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmapIcon300x300)
    _GDIPlus_GraphicsSetInterpolationMode($hContext, 7)
    _GDIPlus_GraphicsDrawImageRect($hContext, $hBitmapIcon256x256, 0, 0, 300, 300)
    _GDIPlus_GraphicsDispose($hContext)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $hGUI = GUICreate("MyGUI", 610, 300)
    GUISetBkColor($iBGColor)
    $Icon = GUICtrlCreateIcon("", 0, 0, 0, 300, 300)
    $hIcon = GUICtrlGetHandle(-1)
    $iPic = GUICtrlCreatePic("", 310,0, 300, 300)
    $hPic = GUICtrlGetHandle(-1)
    GUISetState()
    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hPic)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmapIcon300x300, 0, 0, 300, 300)
    _WinAPI_DestroyIcon(_SendMessage($hIcon, $STM_SETIMAGE, 1, $hIcon300x300))

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case -3
    _GDIPlus_BitmapDispose($hBitmapIcon256x256)
    _GDIPlus_BitmapDispose($hBitmapIcon300x300)
    _WinAPI_DestroyIcon($hIcon300x300)
    _WinAPI_DeleteObject($hHBitmap256x256)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    ExitLoop
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _WinAPI_GetFileIcon($sFile, $iIndex = 0, $iW = 18, $iH = 18, $iColor = -1)
    Local $aRet, $hIcon, $hHBitmap
    Local $hDC, $hBackDC, $hBackSv

    [/autoit] [autoit][/autoit] [autoit]

    $aRet = DllCall("shell32.dll", "int", "SHExtractIconsW", "wstr", $sFile, "int", $iIndex, "int", $iW, "int", $iH, "ptr*", 0, "ptr*", 0, "int", 1, "int", 0)
    If @error Then Return SetError(6, @extended, 0)
    $hIcon = $aRet[5]

    [/autoit] [autoit][/autoit] [autoit]

    $hDC = _WinAPI_GetDC(0)
    $hBackDC = _WinAPI_CreateCompatibleDC($hDC)
    If $iColor = -1 Then $iColor = _WinAPI_GetSysColor($COLOR_MENU)
    $hHBitmap = _WinAPI_CreateSolidBitmap(0, $iColor, $iW, $iH)
    $hBackSv = _WinAPI_SelectObject($hBackDC, $hHBitmap)
    _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, $iW, $iH)
    _WinAPI_DestroyIcon($hIcon)

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_SelectObject($hBackDC, $hBackSv)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_DeleteDC($hBackDC)
    Return $hHBitmap
    EndFunc ;==>_GUICtrlMenu_CreateBitmap

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _WinAPI_ShellExtractIcon
    ; Description....: Extracts the icon with the specified dimension from the specified file.
    ; Syntax.........: _WinAPI_ShellExtractIcon ( $sIcon, $iIndex, $iWidth, $iHeight )
    ; Parameters.....: $sIcon - Path and name of the file from which the icon are to be extracted.
    ; $iIndex - The zero-based index of the icon to extract. If this value is a negative number, the function extracts
    ; the icon whose resource identifier is equal to the absolute value of $iIndex.
    ; $iWidth - Horizontal icon size wanted.
    ; $iHeight - Vertical icon size wanted.
    ; Return values..: Success - Handle to the extracted icon.
    ; Failure - 0 and sets the @error flag to non-zero.
    ; Author.........: Yashied
    ; Modified.......:
    ; Remarks........: If the icon with the specified dimension is not found in the file, it will choose the nearest appropriate icon
    ; and change to the specified dimension.
    ;
    ; When you are finished using the icon, destroy it using the _WinAPI_DestroyIcon() function.
    ; Related........:
    ; Link...........: @@MsdnLink@@ SHExtractIcons
    ; Example........: Yes
    ; ===============================================================================================================================
    Func _WinAPI_ShellExtractIcon($sIcon, $iIndex, $iWidth, $iHeight)
    Local $Ret = DllCall("shell32.dll", "int", "SHExtractIconsW", "wstr", $sIcon, "int", $iIndex, "int", $iWidth, "int", $iHeight, "ptr*", 0, "ptr*", 0, "int", 1, "int", 0)
    If (@error) Or (Not $Ret[0]) Or (Not $Ret[5]) Then
    Return SetError(1, 0, 0)
    EndIf
    Return $Ret[5]
    EndFunc ;==>_WinAPI_ShellExtractIcon

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_BitmapCreateFromScan0
    ; Description ...: Creates a Bitmap object based on an array of bytes along with size and format information
    ; Syntax.........: _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight[, $iStride = 0[, $iPixelFormat = 0x0026200A[, $pScan0 = 0]]])
    ; Parameters ....: $iWidth - The bitmap width, in pixels
    ; $iHeight - The bitmap height, in pixels
    ; $iStride - Integer that specifies the byte offset between the beginning of one scan line and the next. This
    ; +is usually (but not necessarily) the number of bytes in the pixel format (for example, 2 for 16 bits per pixel)
    ; +multiplied by the width of the bitmap. The value passed to this parameter must be a multiple of four
    ; $iPixelFormat - Specifies the format of the pixel data. Can be one of the following:
    ; |$GDIP_PXF01INDEXED - 1 bpp, indexed
    ; |$GDIP_PXF04INDEXED - 4 bpp, indexed
    ; |$GDIP_PXF08INDEXED - 8 bpp, indexed
    ; |$GDIP_PXF16GRAYSCALE - 16 bpp, grayscale
    ; |$GDIP_PXF16RGB555 - 16 bpp; 5 bits for each RGB
    ; |$GDIP_PXF16RGB565 - 16 bpp; 5 bits red, 6 bits green, and 5 bits blue
    ; |$GDIP_PXF16ARGB1555 - 16 bpp; 1 bit for alpha and 5 bits for each RGB component
    ; |$GDIP_PXF24RGB - 24 bpp; 8 bits for each RGB
    ; |$GDIP_PXF32RGB - 32 bpp; 8 bits for each RGB. No alpha.
    ; |$GDIP_PXF32ARGB - 32 bpp; 8 bits for each RGB and alpha
    ; |$GDIP_PXF32PARGB - 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied
    ; $pScan0 - Pointer to an array of bytes that contains the pixel data. The caller is responsible for
    ; +allocating and freeing the block of memory pointed to by this parameter.
    ; Return values .: Success - Returns a handle to a new Bitmap object
    ; Failure - 0 and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: After you are done with the object, call _GDIPlus_ImageDispose to release the object resources
    ; Related .......: _GDIPlus_ImageDispose
    ; Link ..........; @@MsdnLink@@ GdipCreateBitmapFromScan0
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $iStride = 0, $iPixelFormat = $GDIP_PXF32RGB, $pScan0 = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[6]
    EndFunc ;==>_GDIPlus_BitmapCreateFromScan0

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_GraphicsSetInterpolationMode
    ; Description ...: Sets the interpolation mode of a Graphics object
    ; Syntax.........: _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    ; Parameters ....: $hGraphics - Pointer to a Graphics object
    ; $iInterpolationMode - Interpolation mode:
    ; |0 - Default interpolation mode
    ; |1 - Low-quality mode
    ; |2 - High-quality mode
    ; |3 - Bilinear interpolation. No prefiltering is done
    ; |4 - Bicubic interpolation. No prefiltering is done
    ; |5 - Nearest-neighbor interpolation
    ; |6 - High-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking
    ; |7 - High-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking
    ; Return values .: Success - True
    ; Failure - False and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: The interpolation mode determines the algorithm that is used when images are scaled or rotated
    ; Related .......: _GDIPlus_GraphicsGetInterpolationMode
    ; Link ..........; @@MsdnLink@@ GdipSetInterpolationMode
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $iInterpolationMode)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hGraphics, "int", $iInterpolationMode)
    If @error Then Return SetError(@error, @extended, False)
    Return $aResult[0] = 0
    EndFunc ;==>_GDIPlus_GraphicsSetInterpolationMode

    [/autoit]

    Kannst das Beispiel entsprechend ändern und die Bitmap in 24x24 erstellen und abspeichern. Die Quali sollte besser sein.

    Gruß,
    UEZ

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™