kolibrios-fun/programs/cmm/iconedit/tools/screen_copy.h
Kirill Lipatov (Leency) 668f8c2bdb IconEdit 0.50: new tool "Screen copy"
git-svn-id: svn://kolibrios.org@7260 a494cfbc-eb01-0410-851d-a64ba20cac60
2018-04-25 19:09:26 +00:00

24 lines
711 B
C

dword screen_copy;
void ScreenCopy_activate() {
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
screen_copy = malloc(image.columns * image.rows * 3 );
}
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
dword i;
CopyScreen(screen_copy, mouse.x + Form.left + 5, mouse.y + Form.top + skin_height, image.columns, image.rows);
for (i = 0; i < image.columns*image.rows; i++;)
{
image.mas[i] = ESDWORD[i*3+screen_copy] & 0xFFFFFF;
}
DrawCanvas();
if (mouse.down) {
screen_copy = free(screen_copy);
SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
actionsHistory.saveCurrentState();
setCurrentTool(previousTool);
}
}