像素图片 CreateDDB() demo.ahk
; https://www.autohotkey.com/boards/viewtopic.php?p=405591#p405591 #NoEnv #Warn #SingleInstance, Force SetBatchLines, -1 GoSub, CreatePixelData Gui, New,, CreateDDB() demo Gui, Color, FFF0EE Gui, Margin, 24, 24 Gui, Font, S10, Segoe UI Gui, Add, Picture, xm ym w196 h196 hwndhPic1 0x4E hBM := CreateDDB(PixelData1, 8, 8) GuiControl,,%hpic1%, *w0 *h0 HBITMAP:%hBM% Gui, Add, Picture, x+m yp wp hp hwndhPic2 0x4E hBM := CreateDDB(PixelData2, 8, 8) GuiControl,,%hpic2%, *w0 *h0 HBITMAP:%hBM% Gui, Add, Text, xm y+12 wp h24 Center, 32bpp RGB (non-alpha bitmap) Gui, Add, Text, x+m yp wp hp Center, 32bpp ARGB (Opaque) Gui, Add, Picture, xm y+24 wp h196 hwndhPic3 0x4E hBM := CreateDDB(PixelData3, 8, 8) GuiControl,,%hpic3%, *w0 *h0 HBITMAP:%hBM% Gui, Add, Picture, x+m yp wp hp hwndhPic4 0x4E hBM := CreateDDB(PixelData4, 8, 8) GuiControl,,%hpic4%, *w0 *h0 HBITMAP:%hBM% Gui, Add, Text, xm y+12 wp h24 Center, 32bpp ARGB (Transparency) Gui, Add, Text, x+m yp wp hp Center, 32bpp ARGB (Transparency) Gui, Show Return CreatePixelData: PixelData1 := " ( LTrim Join| FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000 000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000 000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000 000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000 000000|FFFFFF|000000|FFFFFF|000000|FFFFFF|000000|FFFFFF )" PixelData2 := " ( LTrim Join| FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000 FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000 FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000 FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000 FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF )" PixelData3 := " ( LTrim Join| FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000|FFFFFFFF|FF000000 DD000000|DDFFFFFF|DD000000|DDFFFFFF|DD000000|DDFFFFFF|DD000000|DDFFFFFF BBFFFFFF|BB000000|BBFFFFFF|BB000000|BBFFFFFF|BB000000|BBFFFFFF|BB000000 99000000|99FFFFFF|99000000|99FFFFFF|99000000|99FFFFFF|99000000|99FFFFFF 77FFFFFF|77000000|77FFFFFF|77000000|77FFFFFF|77000000|77FFFFFF|77000000 55000000|55FFFFFF|55000000|55FFFFFF|55000000|55FFFFFF|55000000|55FFFFFF 33FFFFFF|33000000|33FFFFFF|33000000|33FFFFFF|33000000|33FFFFFF|33000000 11000000|11FFFFFF|11000000|11FFFFFF|11000000|11FFFFFF|11000000|11FFFFFF )" PixelData4 := " ( LTrim Join| 00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000 FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF 00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000 FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF 00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000 FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF 00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000 FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF|FF000000|00FFFFFF )" Return CreateDDB(PixelData, W, H) { ; v0.50 by SKAN on D39B/D39C Local n:=VarSetCapacity(BMBITS, W*H*4), pBMBITS:=&BMBITS ; @ tiny.cc/createddb Loop, Parse, PixelData, |, %A_Space% pBMBITS := NumPut("0x" . A_LoopField, pBMBITS+0, "Int") Return DllCall("CreateBitmap", "Int",W, "Int",H, "Int",1, "Int",32, "Ptr",&BMBITS, "UPtr") }
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)