매크로

조회 수 1763 추천 0 댓글 3

공부에 도움이 될까하여... 아래는 그림파일이 아닙니다 소스로 그린거에요(제가 그린건 아니지만;;;)


Zj4I3mss.jpg

;;###############################################예제

;;###############################################



#NoEnv?


;=== Create Gui, OnMessage ===

Gui 1: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs

hGui := WinExist()

Gui 1: Show, NA

w := 550, h := 280

OnMessage(0x201, "WM_LBUTTONDOWN")



;===GDI+ prepare ===

pToken := Gdip_Startup()

hbm := CreateDIBSection(w, h), hdc := CreateCompatibleDC(), obm := SelectObject(hdc, hbm)

G := Gdip_GraphicsFromHDC(hdc), Gdip_SetSmoothingMode(G, 4)



;=== Background ===

pBrush := Gdip_CreateLineBrushFromRect(0, 0, w, h, 0xff555555, 0xff050505)

Gdip_FillRectangle(G, pBrush, 0, 0, w, h)

Gdip_DeleteBrush(pBrush)


pBrush := Gdip_BrushCreateHatch(0xff000000, 0x00000000, 8)

Gdip_FillRectangle(G, pBrush, 0, 0, w, h)

Gdip_DeleteBrush(pBrush)



;=== Create path (Bat) ===

pPath := Gdip_CreatePath() ; creates a Path (GraphicsPath object)?


Gdip_StartPathFigure(pPath) ; starts a new figure in this Path

Gdip_AddPathLine(pPath, 110,95, 220,95) ; adds a line to the current figure of this path

Gdip_AddPathBezier(pPath, 220,95, 228,112, 233,120, 262,120) ; adds bezier

Gdip_AddPathLines(pPath, "262,120|265,95|269,110|280,110|284,95|287,120") ; adds lines

Gdip_AddPathBezier(pPath, 287,120, 305,120, 320,120, 330,95)

Gdip_AddPathLine(pPath, 330,95, 439,95)

Gdip_AddPathBeziers(pPath, "439,95|406,108|381,126|389,159|322,157|287,170|275,206|262,170|227,157|160,159|168,126|144,109|110,95") ; adds beziers

Gdip_ClosePathFigure(pPath) ; closes the current figure of this path



;=== Fill & draw path (Bat) === ; now when the path is finished, we can fill it with brushes and outline with pens

;pPen := Gdip_CreatePen(0x22ffffff, 14), Gdip_DrawPath(G, pPen, pPath), Gdip_DeletePen(pPen) ; uncomment to draw extra outline


pBrush := Gdip_CreateLineBrushFromRect(0, 95, w, (h-190)/2, 0xff110000, 0xff664040)

Gdip_FillPath(G, pBrush, pPath) ; fill Bat background 1

Gdip_DeleteBrush(pBrush)


pBrush := Gdip_BrushCreateHatch(0xff000000, 0x00000000, 21)

Gdip_FillPath(G, pBrush, pPath) ; fill Bat background 2

Gdip_DeleteBrush(pBrush)


pPen := Gdip_CreatePen(0xffa5a5a5, 5)

Gdip_DrawPath(G, pPen, pPath) ; draw Bat outline 1

Gdip_DeletePen(pPen)


pPen := Gdip_CreatePen(0xff000000, 1)

Gdip_DrawPath(G, pPen, pPath) ; draw Bat outline 2

Gdip_DeletePen(pPen)


Gdip_DeletePath(pPath) ; delete the Path as it is no longer needed and wastes memory



;=== Update, Delete, Shutdown ===

UpdateLayeredWindow(hGui, hdc, (A_ScreenWidth-w)//2, (A_ScreenHeight-h)//2, w, h)

SelectObject(hdc, obm), DeleteObject(hbm), DeleteDC(hdc)

Gdip_DeleteGraphics(G)

Gdip_Shutdown(pToken)

return



Esc::ExitApp



;===Functions===========================================================================

#Include Gdip.ahk


WM_LBUTTONDOWN() {

? ?PostMessage, 0xA1, 2

}


;#####################################################################################

; GraphicsPath functions added by Learning one

;#####################################################################################


; Function ? ? ? ? ? ? ?Gdip_AddPathBeziers

; Description ? ? ? ? ? Adds a sequence of connected B?zier splines to the current figure of this path.

;

; pPath ? ? ? ? ? ? ? ? Pointer to the GraphicsPath

; Points ? ? ? ? ? ? ? ?the coordinates of all the points passed as x1,y1|x2,y2|x3,y3.....

;

; return ? ? ? ? ? ? ? ?status enumeration. 0 = success


; Notes ? ? ? ? ? ? ? ? The first spline is constructed from the first point through the fourth point in the array and uses the second and third points as control points. Each subsequent spline in the sequence needs exactly three more points: the ending point of the previous spline is used as the starting point, the next two points in the sequence are control points, and the third point is the ending point.

?

Gdip_AddPathBeziers(pPath, Points) {

StringSplit, Points, Points, |

VarSetCapacity(PointF, 8*Points0) ??

Loop, %Points0%

{

StringSplit, Coord, Points%A_Index%, `,

NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")

}

return DllCall("gdiplus\GdipAddPathBeziers", "uint", pPath, "uint", &PointF, "int", Points0)

}


Gdip_AddPathBezier(pPath, x1, y1, x2, y2, x3, y3, x4, y4) { ; Adds a B?zier spline to the current figure of this path

return DllCall("gdiplus\GdipAddPathBezier", "uint", pPath

, "float", x1, "float", y1, "float", x2, "float", y2

, "float", x3, "float", y3, "float", x4, "float", y4)

}


; Function ? ? ? ? ? ? ?Gdip_AddPathLines

; Description ? ? ? ? ? Adds a sequence of connected lines to the current figure of this path.

;

; pPath ? ? ? ? ? ? ? ? Pointer to the GraphicsPath

; Points ? ? ? ? ? ? ? ?the coordinates of all the points passed as x1,y1|x2,y2|x3,y3.....

;

; return ? ? ? ? ? ? ? ?status enumeration. 0 = success


Gdip_AddPathLines(pPath, Points) {

StringSplit, Points, Points, |

VarSetCapacity(PointF, 8*Points0) ??

Loop, %Points0%

{

StringSplit, Coord, Points%A_Index%, `,

NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")

}

return DllCall("gdiplus\GdipAddPathLine2", "uint", pPath, "uint", &PointF, "int", Points0)

}


Gdip_AddPathLine(pPath, x1, y1, x2, y2) {

return DllCall("gdiplus\GdipAddPathLine", "uint", pPath

, "float", x1, "float", y1, "float", x2, "float", y2)

}


Gdip_AddPathArc(pPath, x, y, w, h, StartAngle, SweepAngle) {

return DllCall("gdiplus\GdipAddPathArc", "uint", pPath, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)

}


Gdip_AddPathPie(pPath, x, y, w, h, StartAngle, SweepAngle) {

return DllCall("gdiplus\GdipAddPathPie", "uint", pPath, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)

}


Gdip_StartPathFigure(pPath) { ; Starts a new figure without closing the current figure. Subsequent points added to this path are added to the new figure.

return DllCall("gdiplus\GdipStartPathFigure", "uint", pPath)

}


Gdip_ClosePathFigure(pPath) { ; Closes the current figure of this path.

return DllCall("gdiplus\GdipClosePathFigure", "uint", pPath)

}


; Function ? ? ? ? ? ? ?Gdip_DrawPath

; Description ? ? ? ? ? draws a sequence of lines and curves defined by a GraphicsPath object

;

; pGraphics ? ? ? ? ? ? Pointer to the Graphics of a bitmap

; pPen ? ? ? ? ? ? ? ? ?Pointer to a pen

; pPath ? ? ? ? ? ? ? ? Pointer to a Path

;

; return ? ? ? ? ? ? ? ?status enumeration. 0 = success


Gdip_DrawPath(pGraphics, pPen, pPath) {

return DllCall("gdiplus\GdipDrawPath", "uint", pGraphics, "uint", pPen, "uint", pPath)

}


Gdip_WidenPath(pPath, pPen, Matrix=0, Flatness=1) { ; Replaces this path with curves that enclose the area that is filled when this path is drawn by a specified pen. This method also flattens the path.

return DllCall("gdiplus\GdipWidenPath", "uint", pPath, "uint", pPen, "uint", Matrix, "float", Flatness)

}


Gdip_ClonePath(pPath) {

DllCall("gdiplus\GdipClonePath", "uint", pPath, "uint*", pPathClone)

return pPathClone

}














































  • 모바게 2014.12.02 18:34

    gdip를 이용해 그리기가 되는군요..

    감사합니다 ㅋ

  • 따기따기 2014.12.02 22:15
    유용하게 사용하세요^^
  • 로우얄 2014.12.12 15:24

    gdip 어디 배울곳 없을까요?

    강력한 기능인거같은데...

    좀만 응용하면 구이도 이쁘게

    이미지서치도 강력하게

    여러 프로그램 이팩트도 강렬하게 만들 수 있을꺼같은데...


List of Articles
분류 제목 글쓴이 최근변경 추천
질문 Hide 관련 질문 5 파더 2014.11.29 0/0
자유 에휴...고생해서 만든것들이 다 날라갔어요 ㅠㅠ 2 flem 2014.12.01 0/0
자유 오늘도 그냥 지나가기 심심해서 팁 하나 올려요. 이미... 2 swksd 2014.11.30 0/0
질문 변수에 관한 질문 5 파더 2014.11.30 0/0
질문 몬스터 길들이기 패치후에. 4 페르니코 2017.12.18 0/0
질문 스크립트 좀더 간략하게 작성방법이 있을까요. 8 우후훅 2014.12.04 0/0
질문 비활성마우스클릭 질문드려요 단키와 합성키 12 성인남자 2014.12.02 0/0
정보 그리기 / DRAW / GDIP 화면에 선 도형 그리기 (예제) 3 따기따기 2014.12.12 0/0
질문 지니모션은 인터넷에 돌아다니는거아무거나사용해도되... 2 튀니지사람들 2014.12.02 0/0
질문 혹시 1004 매크로 1920 * 1080 해상도를 세나에 맞춰 ... 인사왕바이킹 2014.12.01 0/0
질문 어떤 이미지를 찾을때 같은 이미지가 있을때 대한 처리 7 프로구라머 2014.12.07 0/0
정보 스크린샷 캡춰방법 (마지막이야기님 요청) 14 호로록뚝딱 2015.03.24 3/0
질문 리스트박스 관련질문 4 파더 2014.12.03 0/0
질문 체크박스 if 에대해서 6 파더 2014.12.04 0/0
질문 오토핫키 이미지서치좀 봐주세요ㅡ모비즌연동 8 뀨잉여기좋아 2014.12.05 0/0
질문 1004매크로 1 dlalsrb86 2014.12.04 0/0
자유 오토핫키컴파일 이후 Themida 패킹 사용하면되는건가요? 파더 2014.12.04 0/0
자유 아주 간단한건데.. 하면 이쁜 gui 색입히기... 2 로우얄 2017.12.19 0/0
질문 VMProtect Unpack 17 외치기 2017.03.19 0/0
질문 와 ,,,핫오토키는 뭔가여... 3 찬쓰찬쓰 2014.12.12 1/0
Board Pagination Prev 1 ... 67891011121314 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글