找回密码
 加入
搜索
查看: 1860|回复: 0

[图形处理] 帮我看下 PNG边缘有毛边怎么办啊

[复制链接]
发表于 2010-5-21 14:47:06 | 显示全部楼层 |阅读模式
#include <GuiConstantsEX.au3> 
#include <WindowsConstants.au3> 
#include <GDIPlus.au3> 

Global $hGraphic
Global $y
Global $x
Global $a
GUIRegisterMsg($WM_PAINT, "MY_WM_PAINT") 

_GDIPlus_StartUp () 
$hGui = GUICreate("show png", 350, 300,193, 125, $WS_POPUP, $WS_EX_LAYERED) 
$Button = GUICtrlCreateButton("view", 270, 270, 75, 21) 
GUISetState() 
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($hGui, 0xABCDEF)

$x=50
$y=50
$a=1

While $a<10 


$OpenFile = "d:\png"&$a&".png"
$hImage = _GDIPlus_ImageLoadFromFile ($OpenFile) 
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGui)
_WinAPI_InvalidateRect(WinGetHandle($hGui))
Sleep(1000)
$a=$a+1

 WEnd 



Func MY_WM_PAINT($hWnd, $msg, $wParam, $lParam) 
     _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_UPDATENOW) 
     If $hGraphic <> "" Then  _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $x, $y)
     _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) 
     Return $GUI_RUNDEFMSG 
 EndFunc   ;==>MY_WM_PAINT
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
        Local Const $AC_SRC_ALPHA = 1
        Local Const $ULW_ALPHA = 2
        Local Const $LWA_ALPHA = 0x2
        Local Const $LWA_COLORKEY = 0x1
        If Not $isColorRef Then
                $i_transcolor = Hex(String($i_transcolor), 6)
                $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
        EndIf
        Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
        Select
                Case @error
                        Return SetError(@error, 0, 0)
                Case $Ret[0] = 0
                        Return SetError(4, 0, 0)
                Case Else
                        Return 1
        EndSelect
EndFunc   ;==>_API_SetLayeredWindowAttributes
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-15 11:11 , Processed in 0.072951 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表