kolibrios-fun/programs/cmm/iconedit/tools/pipette.h
Kirill Lipatov (Leency) 2eda7fed5c tinypad: no optim_save by default
eolite: fix crash on put image h<1
cmm: rename colors to the short one "sc"

git-svn-id: svn://kolibrios.org@7806 a494cfbc-eb01-0410-851d-a64ba20cac60
2020-04-17 23:52:24 +00:00

24 lines
767 B
C

void PipetteTool_activate() {
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
}
void PipetteTool_onKeyEvent() {
if (key_scancode == SCAN_CODE_ESC) setCurrentTool(previousTool);
}
void PipetteTool_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
//if (!canvas.hovered()) return; //TODO: option "Restrict pipette to canvas area"
tool_color = GetPixelUnderMouse();
DrawBar(Form.cwidth-30, 5, 20, 20, tool_color);
if (mouse.down) {
DrawBar(Form.cwidth-30, 5, 20, 20, sc.work);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
if (mouse.key&MOUSE_LEFT) EventSetActiveColor(1, tool_color);
if (mouse.key&MOUSE_RIGHT) EventSetActiveColor(2, tool_color);
setCurrentTool(previousTool);
}
}