sync Rate 60 : dim board(32, 32, 2) : dim template(10) : d3d_font 1, "calibri", 11, 0, 1, 0 : do : cls : colValue = mouseInput(colRed, colGreen, colBlue) : renderScreen(colRed, colGreen, colBlue) : colRed = rgbR(colValue) : colGreen = rgbG(colValue) : colBlue = rgbB(colValue) : sync : loop
function mouseInput(colRed, colGreen, colBlue) : if mouseClick() = 1 : if mouseX() > 5 and mouseX() < 260 : if mouseY() > 100 and mouseY() < 105 : colRed = mouseX() - 5 : endif
if mouseY() > 115 and mouseY() < 120 : colGreen = mouseX() - 5 : endif : if mouseY() > 130 and mouseY() < 135 : colBlue = mouseX() - 5 : endif : endif : if mouseX() > 290 and mouseX() < 610 : if mouseY() > 50 and mouseY() < 370 : xBox = ( mouseX() - 290 ) / 10 : yBox = ( mouseY() - 50 ) / 10 : board(xBox, yBox, 2) = 1 : board(xBox, yBox, 1) = rgb(colRed, colGreen, colBlue) : endif : endif : endif : if mouseClick() = 2 : if mouseX() > 290 and mouseX() < 610 : if mouseY() > 50 and mouseY() < 370 : xBox = ( mouseX() - 290 ) / 10 : yBox = ( mouseY() - 50 ) / 10
board(xBox, yBox, 2) = 0 : board(xBox, yBox, 1) = 0 : endif : endif : endif : colVal = rgb(colRed, colGreen, colBlue) : colVal = SetTemplates(colVal)
EndFunction colVal : function renderScreen(red, green, blue) : d3d_color 0, 0, 0, 255 : d3d_box 0, 0, 640, 480 : d3d_color 150, 150, 150, 255 : d3d_box 1, 1, 638, 478 : returnVal = 0 : temp = drawRed(red) : temp = drawGreen(green) : temp = drawBlue(blue) : temp = drawPreview(red, green, blue) : temp = renderDrawSpace() : temp = drawResetButton() : temp = drawPreviewWindow() : temp = drawTemplates() : drawSaveButton()
EndFunction returnVal : function drawRed(redVal) : d3d_color 0, 0, 0, 255 : d3d_box 5, 100, 269, 105 : d3d_box 5, 100, 269, 105, 0, rgb(255, 0, 0), 0, rgb(255, 0, 0) : d3d_box 7+redVal, 95, 12+redVal, 110 : d3d_color 200, 200, 200, 255 : d3d_box 8+redVal, 96, 11+redVal, 109
endFunction 0 : function drawGreen(greenVal) : d3d_color 0, 0, 0, 255 : d3d_box 5, 115, 269, 120 : d3d_box 5, 115, 269, 120, 0, rgb(0, 255, 0), 0, rgb(0, 255, 0) : d3d_box 7+greenVal, 110, 12+greenVal, 125 : d3d_color 200, 200, 200, 255 : d3d_box 8+greenVal, 111, 11+greenVal, 124
endFunction 0 : function drawBlue(blueVal) : d3d_color 0, 0, 0, 255 : d3d_box 5, 130, 269, 135 : d3d_box 5, 130, 269, 135, 0,rgb(0, 0, 255), 0, rgb(0, 0, 255) : d3d_box 7+blueVal, 125, 12+blueVal, 140 : d3d_color 200, 200, 200, 255 : d3d_box 8+blueVal, 126, 11+blueVal, 139
endFunction 0 : function drawPreview(redVal, greenVal, blueVal) : d3d_color 0, 0, 0, 255 : d3d_box 4, 149, 106, 251 : d3d_color redVal, greenVal, blueVal, 255 : d3d_box 5, 150, 105, 250
endFunction 0 : function renderDrawSpace() : d3d_color 0, 0, 0, 255 : d3d_box 289, 49, 611, 371 : d3d_color 235, 235, 235, 255 : d3d_box 290, 50, 610, 370 : for x = 0 to 31 step 1 : for y = 0 to 31 step 1 : if board(x, y, 2) = 1 : d3d_color rgbR(board(x, y, 1)),rgbG(board(x, y, 1)),rgbB(board(x, y, 1)), 255 : d3d_box (290 + (x*10)), (50 + (y*10)), (300 + (x*10)), (60 + (y*10)) : else : d3d_color 235, 235, 235, 255 : d3d_box (290 + (x*10)), (50 + (y*10)), (295 + (x*10)), (55 + (y*10)) : d3d_box (295 + (x*10)), (55 + (y*10)), (300 + (x*10)), (60 + (y*10))
d3d_color 135, 135, 135, 255 : d3d_Box (295 + (x*10)), (50 + (y*10)), (300 + (x*10)), (55 + (y*10)) : d3d_Box (290 + (x*10)), (55 + (y*10)), (295 + (x*10)), (60 + (y*10)) : endif : next y : next x : d3d_color 255, 255, 255, 255 : for x = 1 to 31 step 1 : for y = 1 to 160 step 1 : xOne = 290 + ( x * 10 ) : yOne = 49 + ( y * 2 ) : xTwo = 289 + ( y * 2 ) : yTwo = 50 + ( x * 10 ) : d3d_dot xOne, yOne : d3d_dot xTwo, yTwo : next y : next x
endFunction 0 : function drawResetButton() : D3D_Color 0, 0, 0, 255 : d3d_box 289, 389, 341, 401 : d3d_color 165, 165, 165, 255 : d3d_box 290, 390, 340, 400 : d3d_color 20, 20, 20, 255 : d3d_startText : d3d_text 1, 315, 389, 1, "RESET" : d3d_endText : if mouseclick() = 1 : if mouseX() > 290 and mouseX() < 340 : if mouseY() > 390 and mouseY() < 400 : d3d_color 0, 0, 0, 125 : d3d_box 290, 390, 340, 400 : for x = 0 to 31 step 1 : for y = 0 to 31 step 1 : board(x, y, 2) = 0 : next y : next x : endif : endif : endif
endFunction 0 : function drawSaveButton() : D3D_Color 0, 0, 0, 255 : d3d_box 349, 389, 451, 401 : d3d_color 165, 165, 165, 255 : d3d_box 350, 390, 450, 400 : d3d_color 20, 20, 20, 255 : d3d_startText : d3d_text 1, 400, 389, 1, "SAVE IMAGE" : d3d_endText : if mouseclick() = 1 : if mouseX() > 350 and mouseX() < 450 : if mouseY() > 390 and mouseY() < 400 : d3d_color 0, 0, 0, 125 : d3d_box 350, 390, 450, 400 : Get Image 1, 5, 255, 37, 287 : Save Image "test.bmp", 1 : endif : endif : endif
endFunction 0 : Function DrawPreviewWindow() : d3d_color 0, 0, 0, 255 : d3d_box 5, 255, 37, 287 : for x = 0 to 31 step 1 : for y = 0 to 31 step 1 : if board(x, y, 2) > 0 : d3d_color rgbR(board(x, y, 1)), rgbG(board(x, y, 1)), rgbB(board(x, y, 1)), 255 : d3d_dot 5+x, 255+y : endif : next y : next x
endfunction 0 : Function DrawTemplates() : d3d_color 0, 0, 0, 255 : d3d_box 114, 149, 225, 161 : for x = 0 to 9 step 1 : d3d_color rgbR(template(x)), rgbG(template(x)), rgbB(template(x)), 255 : d3d_box (115 + (x*11)), 150, (125 + (x * 11)), 160 : next x
endfunction 0 : Function SetTemplates(curCol) : if KEYSTATE(42) > 0 : if KEYSTATE(2) > 0 : template(0) = curCol : endif : if KEYSTATE(3) > 0 : template(1) = curCol : endif : if KEYSTATE(4) > 0 : template(2) = curCol : endif : if KEYSTATE(5) > 0 : template(3) = curCol : endif : if KEYSTATE(6) > 0 : template(4) = curCol : endif : if KEYSTATE(7) > 0 : template(5) = curCol : endif : if KEYSTATE(8) > 0 : template(6) = curCol : endif : if KEYSTATE(9) > 0 : template(7) = curCol : endif : if KEYSTATE(10) > 0 : template(8) = curCol
endif : if KEYSTATE(11) > 0 : template(9) = curCol : endif : endif : if KEYSTATE(42) = 0 : if KEYSTATE(2) > 0 : curCol = template(0) : endif : if KEYSTATE(3) > 0 : curCol = template(1) : endif : if KEYSTATE(4) > 0 : curCol = template(2) : endif : if KEYSTATE(5) > 0 : curCol = template(3) : endif : if KEYSTATE(6) > 0 : curCol = template(4) : endif : if KEYSTATE(7) > 0 : curCol = template(5)
endif : if KEYSTATE(8) > 0 : curCol = template(6) : endif : if KEYSTATE(9) > 0 : curCol = template(7) : endif : if KEYSTATE(10) > 0 : curCol = template(8) : endif
if KEYSTATE(11) > 0 : curCol = template(9) : endif : endif
endfunction curCol
(DBPRO)
Requires d3d plugin to run, did not add any features, just speed, otherwise it would be too slow to run, it is sluggish as is.
Anyways, about:
You can make a 32 x 32 bitmap file with this snippet.
This snippet is compressed from 273 lines no comments.
Controls:
Left Click moves the sliders to select the color and places in the draw area.
Right Click erases.
Shift + 1-0 sets one of ten hot key templates for your current color.
1-10 no Shift switches to the color you set via Shift 1-0
Reset clears the board, but keeps the template.
Save Image saves the image as a bitmap, it is an exact copy of the preview to the left of the screen.
**EDIT**
Just realized I broke the 25 command rule, lemme try to fix that.
**FIXED**