Jump to content

Renk Dedektörü


SimpsoN_Bart
 Share

Recommended Posts

Renk kodlarını RGB (Red,Green,Blue) ve Hex olarak size gösteren basit bir uygulama. Form içerisindeki renk paletleri veya imleç rengiyle isteğiniz rengi bulmanız bu programla çok basit.Kendiniz bir renk oluşturmak istiyorsanız renk slider aracıyla isteğiniz rengi elde edebilirsiniz.Yeni başlayan arkadaşlar için kaynak kodları paket
içersine koydum incelemeyi unutmayın.Umarım faydalı bir çalışma olmuştur..

Programdan Görüntüler:

ZpEOL.jpg

ZYIA4.jpg

DN4Eh.jpg

KPJKc.jpg

Kaynak Kodlar:

#NoTrayIcon
#RequireAdmin
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=D:\DIZAYN\İCO,PNG,BMP\icolar\QnextSZ.ico
#AutoIt3Wrapper_Outfile=Renk Dedektörü.exe
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=Renk Dedektörü v1.0
#AutoIt3Wrapper_Res_Description=SK CODER
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=www.tnctr.com
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****

Opt("GUIOnEventMode", 1)

Local $PALET1 = @TempDir & "\palette1.jpg"
Local $PALET2 = @TempDir & "\palette2.jpg"

FileInstall("palette1.jpg", $PALET1, 1)
FileInstall("palette2.jpg", $PALET2, 1)

HotKeySet("+!d", "_CURSOR_INFO_START") ; Shift+ALT+d
HotKeySet("+!s", "_CURSOR_INFO_STOP") ;Shift+ALT+s

$GUI = GUICreate("Renk Dedektörü", 630, 350, -1, -1, 0x00080000, 0x00000008)
$HELP = GUICtrlCreateMenu("?")
$ABOUT = GUICtrlCreateMenuItem("Hakkında", $HELP)
GUICtrlSetOnEvent(-1, "_ABOUT")
$AYIR1 = GUICtrlCreateMenuItem("", $HELP, 2)
$INFO = GUICtrlCreateMenuItem("Yardım", $HELP)
GUICtrlSetOnEvent(-1, "_HELP")
$AYIR2 = GUICtrlCreateMenuItem("", $HELP, 3)
$EXIT = GUICtrlCreateMenuItem("Çıkış", $HELP)
GUICtrlSetOnEvent(-1, "_EXIT")
$RGB_CODE = GUICtrlCreateLabel("RGB Kodu: ", 10, 10, 60)
$L_RED = GUICtrlCreateLabel("Kırmızı : ", 30, 30, 40)
GUICtrlSetColor(-1, 0xff0000)
$T_RED = GUICtrlCreateLabel("0", 75, 30, 30)
$C_GREEN = GUICtrlCreateLabel("Yeşil : ", 30, 50, 40)
GUICtrlSetColor(-1, 0x00ff00)
$T_GREEN = GUICtrlCreateLabel("0", 75, 50, 30)
$L_BLUE = GUICtrlCreateLabel("Mavi : ", 30, 70, 40)
GUICtrlSetColor(-1, 0x0000ff)
$T_BLUE = GUICtrlCreateLabel("0", 75, 70, 30)
$LBL_HEX = GUICtrlCreateLabel("Hex Kodu :", 10, 97, 100)
$L_HEXCOLOR = GUICtrlCreateLabel("000000", 110, 97, 50)
$L_COLOR = GUICtrlCreateLabel("", 160, 10, 130, 100)
GUICtrlSetBkColor(-1, 0x000000)
$LS_RED = GUICtrlCreateLabel("Kırmızı : ", 10, 135, 40)
GUICtrlSetColor(-1, 0xff0000)
$S_RED = GUICtrlCreateSlider(50, 130, 250, 30, 0x0010)
GUICtrlSetLimit(-1, 255, 0)
$S_GREEN = GUICtrlCreateLabel("Yeşil : ", 10, 165, 40)
GUICtrlSetColor(-1, 0x00ff00)
$SL_GREEN = GUICtrlCreateSlider(50, 160, 250, 30, 0x0010)
GUICtrlSetLimit(-1, 255, 0)
$LS_BLUE = GUICtrlCreateLabel("Mavi : ", 10, 195, 40)
GUICtrlSetColor(-1, 0x0000ff)
$S_BLUE = GUICtrlCreateSlider(50, 190, 250, 30, 0x0010)
GUICtrlSetLimit(-1, 255, 0)
$CURSOR_START = GUICtrlCreateButton("Imleç Rengini Başlat", 10, 230, 135, 25)
GUICtrlSetOnEvent(-1, "_CURSOR_INFO_START")
$CURSOR_INFO_STOP = GUICtrlCreateButton("Imleç Rengini Durdur", 155, 230, 135, 25)
GUICtrlSetOnEvent(-1, "_CURSOR_INFO_STOP")
$CHANGE_PALET = GUICtrlCreateButton("Palet Seç", 10, 260, 135, 25)
GUICtrlSetOnEvent(-1, "_PALET")
$COLOR_COPY = GUICtrlCreateButton("Renk Kodunu Kopyala", 155, 260, 135, 25)
GUICtrlSetOnEvent(-1, "_COPY")
$PALET = $PALET1
$IMG = GUICtrlCreatePic($PALET, 305, 10, 310, 275)
GUICtrlSetOnEvent($IMG, "_TEST")
$CURSOR = True
GUISetOnEvent(-3, "_EXIT")
GUISetState(@SW_SHOW)

While 1
Sleep(100)
Local $GET_POS = WinGetPos("Renk Dedektörü")
Local $GET_CURSOR = GUIGetCursorInfo()
If Not @error Then
$X = $GET_CURSOR[0]
$Y = $GET_CURSOR[1]
If $Y >= 230 And $Y <= 255 Then
If $X >= 10 And $X <= 145 Then
ToolTip("Başlat : Shift+Alt+D", $X + 12 + $GET_POS[0], $Y + 50 + $GET_POS[1])
Else
If $X >= 155 And $X <= 290 Then
ToolTip("Durdur : Shift+Alt+S", $X + 12 + $GET_POS[0], $Y + 50 + $GET_POS[1])
Else
ToolTip("")
EndIf
EndIf
Else
ToolTip("")
EndIf
If $Y >= 10 And $Y <= 285 Then
If $X >= 305 And $X <= 615 Then
ToolTip("İstediğiniz renk üstüne tıklayın.", $X + 12 + $GET_POS[0], $Y + 50 + $GET_POS[1])
EndIf
EndIf

If $CURSOR = False Then
$M_POS = MouseGetPos()
$P_GETCOLOR = PixelGetColor($M_POS[0], $M_POS[1])
GUICtrlSetBkColor($L_COLOR, "0x" & Hex($P_GETCOLOR, 6))
GUICtrlSetData($L_HEXCOLOR, Hex($P_GETCOLOR, 6))
GUICtrlSetData($T_RED, Dec(StringLeft(Hex($P_GETCOLOR, 6), 2)))
GUICtrlSetData($T_GREEN, Dec(StringMid(Hex($P_GETCOLOR, 6), 3, 2)))
GUICtrlSetData($T_BLUE, Dec(StringRight(Hex($P_GETCOLOR, 6), 2)))
GUICtrlSetData($S_RED, GUICtrlRead($T_RED))
GUICtrlSetData($SL_GREEN, GUICtrlRead($T_GREEN))
GUICtrlSetData($S_BLUE, GUICtrlRead($T_BLUE))
Else
$RED = Hex(GUICtrlRead($S_RED), 2)
GUICtrlSetData($T_RED, GUICtrlRead($S_RED))
$GREEN = Hex(GUICtrlRead($SL_GREEN), 2)
GUICtrlSetData($T_GREEN, GUICtrlRead($SL_GREEN))
$BLUE = Hex(GUICtrlRead($S_BLUE), 2)
GUICtrlSetData($T_BLUE, GUICtrlRead($S_BLUE))
$HEXCOLOR = $RED & $GREEN & $BLUE
GUICtrlSetBkColor($L_COLOR, "0x" & $HEXCOLOR)
GUICtrlSetData($L_HEXCOLOR, $HEXCOLOR)
EndIf
EndIf
;~

WEnd

Func _TEST()
If $Y >= 10 And $Y <= 285 Then
If $X >= 305 And $X <= 615 Then
$P_GETCOLOR = PixelGetColor($X + 3 + $GET_POS[0], $Y + 30 + $GET_POS[1])
GUICtrlSetBkColor($L_COLOR, "0x" & Hex($P_GETCOLOR, 6))
GUICtrlSetData($L_HEXCOLOR, Hex($P_GETCOLOR, 6))
GUICtrlSetData($T_RED, Dec(StringLeft(Hex($P_GETCOLOR, 6), 2)))
GUICtrlSetData($T_GREEN, Dec(StringMid(Hex($P_GETCOLOR, 6), 3, 2)))
GUICtrlSetData($T_BLUE, Dec(StringRight(Hex($P_GETCOLOR, 6), 2)))
GUICtrlSetData($S_RED, GUICtrlRead($T_RED))
GUICtrlSetData($SL_GREEN, GUICtrlRead($T_GREEN))
GUICtrlSetData($S_BLUE, GUICtrlRead($T_BLUE))
EndIf
EndIf
EndFunc ;==>_TEST

Func _CURSOR_INFO_START()
$CURSOR = False
$GGCI = GUIGetCursorInfo()
$X = $GGCI[0]
$Y = $GGCI[1]
ToolTip("Shift+Alt+d", $X, $Y)
EndFunc ;==>_CURSOR_INFO_START

Func _CURSOR_INFO_STOP()
$CURSOR = True
EndFunc ;==>_CURSOR_INFO_STOP

Func _PALET()
If $PALET = $PALET1 Then
$PALET = $PALET2
GUICtrlSetImage($IMG, $PALET)
Else
If $PALET = $PALET2 Then
$PALET = $PALET1
GUICtrlSetImage($IMG, $PALET)
EndIf
EndIf
EndFunc ;==>_PALET

Func _COPY()
ClipPut(GUICtrlRead($L_HEXCOLOR))
EndFunc ;==>_COPY

Func _ABOUT()
ShellExecute("www.tnctr.com")
Local $sRet = DllCall("shell32.dll", "long", "ShellAboutA", "ptr", $GUI, "str", "AutoIt Renk Dedektörü v1", "str", "SimpsoN_Bart | Tnctr.com © " & @YEAR, "long", 0)
If @error Then SetError(1, 0, 0)
Return $sRet
EndFunc ;==>_ABOUT

Func _HELP()
MsgBox(32, "Yardım", _
"Bu program basit olarak mouse imleci aracılığıyla nesnelerin." & @CRLF & _
"hangi renk olduğunu hex olarak göstermeye yarar." & @CRLF & _
"Form dışındaki renkleri tespit etmek için Shift+Alt+D, bu özelliği" & @CRLF & _
"kapatmak için Shift+Alt+S kısayollarını kullanın.Palet Değiştirmek" & @CRLF & _
"istiyorsanız Palet Seç butonuna tıklamanız yeterlidir" & @CRLF & _
" " & @CRLF & _
"Soru ve görüşleriniz için www.tnctr.com'u ziyaret edin...." _
, 0, $GUI)
EndFunc ;==>_HELP

Func _EXIT()
Exit
EndFunc ;==>_EXIT

Program + Kaynak Kod:
https://app.box.com/s/326e820d15829ad3975a
Edited by SimpsoN_Bart
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...