ClipScribble
#1
A paint program with control panels in sperate windows. This uses the clipboard method to communicate between the different programs.

This piece of code is the color picker. The control has a simple slide bar for the red, green, and blue channels.
This will need to be saved and compiled as colorpickmix to be called by the clipscribble main program. 

compile the main program and the control panels. Keep all the exe files in the same folder and it's a multi-window program in QB64.  If you close a control panel by accident just manually open it again, it'll work fine.

colorpickmix
Code: (Select All)
Screen _NewImage(240, 160, 32)
_ScreenMove 600, 50
_Title "colorpickmix"
'a color mixer that sends it's out put to the clipboard
rr = 127
gg = 127
bb = 127
rx = rr / 2 + 50
gx = gg / 2 + 50
bx = bb / 2 + 50
_PrintMode _KeepBackground
Line (10, 10)-(229, 40), _RGB32(rr, gg, bb), BF
_PrintString (1, 60), "[<]": _PrintString (215, 60), "[>]"
_PrintString (1, 90), "[<]": _PrintString (215, 90), "[>]"
_PrintString (1, 120), "[<]": _PrintString (215, 120), "[>]"
Do
    _Limit 100
    Do While _MouseInput 'mouse status changes only
        x = _MouseX
        y = _MouseY
        If _MouseButton(1) Then
            If y >= 59 And y <= 77 Then
                If x <= rx + 8 Then rr = rr - 1 Else rr = rr + 1
                If rr < 1 Then rr = 0
                If rr > 255 Then rr = 255
            End If
            If y >= 89 And y <= 107 Then
                If x <= gx + 8 Then gg = gg - 1 Else gg = gg + 1
                If gg < 1 Then gg = 0
                If gg > 255 Then gg = 255

            End If
            If y >= 119 And y <= 137 Then
                If x <= bx + 8 Then bb = bb - 1 Else bb = bb + 1
                If bb < 1 Then bb = 0
                If bb > 255 Then bb = 255
            End If
            rt$ = packnum$(rr)
            gt$ = packnum$(gg)
            bt$ = packnum$(bb)
            pp$ = "CMX" + rt$ + gt$ + bt$
            _Clipboard$ = pp$
        End If
    Loop
    rx = rr / 2 + 50
    gx = gg / 2 + 50
    bx = bb / 2 + 50
    Line (50, 60)-(202, 76), _RGB32(rr, 0, 0), BF
    _PrintString (rx, 60), _Trim$(Str$(rr))
    Line (50, 90)-(202, 106), _RGB32(0, gg, 0), BF
    _PrintString (gx, 90), _Trim$(Str$(gg))
    Line (50, 120)-(202, 136), _RGB32(0, 0, bb), BF
    _PrintString (bx, 120), _Trim$(Str$(bb))
    Line (10, 10)-(229, 40), _RGB32(rr, gg, bb), BF

    kk$ = InKey$
    inx$ = _Clipboard$
    If inx$ = "QUITCOLORMIX" Then kk$ = Chr$(27)
Loop Until kk$ = Chr$(27)
_Clipboard$ = "colorpickmix quit"
System



Function packnum$ (num)
    pad$ = "000"
    nn$ = _Trim$(Str$(num))
    Select Case Len(nn$)
        Case 1
            Mid$(pad$, 3, 1) = nn$
        Case 2
            Mid$(pad$, 2, 2) = nn$
        Case 3
            pad$ = nn$
    End Select
    packnum$ = pad$
End Function
Reply


Messages In This Thread
ClipScribble - by James D Jarvis - 10-28-2022, 03:51 PM
RE: ClipScribble - by James D Jarvis - 10-28-2022, 03:53 PM
RE: ClipScribble - by James D Jarvis - 10-28-2022, 03:56 PM



Users browsing this thread: 2 Guest(s)