Subversion Repositories Kolibri OS

Rev

Rev 7271 | Rev 7444 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. dword screen_copy;
  2.  
  3. void ScreenCopy_activate() {
  4.         SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
  5.         screen_copy = malloc(image.columns * image.rows * 3 +4);
  6. }
  7.  
  8. void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
  9.         dword i;
  10.         int x, y;
  11.  
  12.         x = mouse.x + Form.left + 5 - calc(image.columns/2);
  13.         y = mouse.y + Form.top + skin_height - calc(image.rows/2);
  14.  
  15.         CopyScreen(
  16.                 screen_copy,
  17.                 math.in(x, 0, screen.width - image.columns),
  18.                 math.in(y, 0, screen.height - image.rows),
  19.                 image.columns,
  20.                 image.rows
  21.         );
  22.  
  23.         for (i = 0; i < image.columns*image.rows; i++;)
  24.         {
  25.                 image.mas[i] = ESDWORD[i*3+screen_copy] & 0xFFFFFF;
  26.         }
  27.         DrawCanvas();
  28.        
  29.         if (mouse.down) {
  30.                 screen_copy = free(screen_copy);
  31.                 SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE+EVM_MOUSE_FILTER);
  32.                 actionsHistory.saveCurrentState();
  33.                 setCurrentTool(previousTool);
  34.                 if (!CheckActiveProcess(Form.ID)) ActivateWindow(GetProcessSlot(Form.ID));
  35.         }
  36. }
  37.