Subversion Repositories Kolibri OS

Rev

Rev 7266 | Rev 7275 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7260 leency 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 );
6
}
7
 
8
void ScreenCopy_onMouseEvent(int mouseX, int mouseY, int lkm, int pkm) {
9
	dword i;
7271 leency 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
 
7260 leency 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);
7266 leency 34
		if (!CheckActiveProcess(Form.ID)) ActivateWindow(GetProcessSlot(Form.ID));
7260 leency 35
	}
36
}