Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
4074 leency 1
dword drawbuf;
2
void DrawBufInit()
3
{
4
	free(drawbuf);
5
	drawbuf = malloc(WB1.width * WB1.line_h +4 * 4 + 8); //+1 for good luck
6
	ESDWORD[drawbuf] = WB1.width;
7
	ESDWORD[drawbuf+4] = WB1.line_h;
8
}
9
void DrawBufFill()
10
{
11
	int i;
12
	for (i=0; i
13
}
14
void DrawBufBar(dword x, y, w, h, color)
15
{
16
	int i, j;
17
	for (j=0; j
18
	{
19
		for (i = y+j*WB1.width+x*4; i
20
	}
21
}
22
 
23
char shift[]={8,8,4,4};
24
void DrawBufSkew(dword x, y, w, h)
25
{
26
	int i, j;
27
	stolbec++;
28
	for (j=0; j<=3; j++)
29
	{
30
		for (i = y+j*WB1.width+x+w+h*4; i>y+j*WB1.width+x+h-12*4 ; i-=4)
31
								ESDWORD[drawbuf+i+8] = ESDWORD[-shift[j]+drawbuf+i+8];
32
	}
33
}
34
 
4190 leency 35
void DrawBufAlignRight(dword x,y,w,h)
36
{
37
	int i, j, l;
38
	int content_width = stolbec * 6;
39
	int content_left = w - content_width / 2;
40
	for (j=0; j
41
	{
42
		for (i=j*w+w-x*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
43
		{
44
			ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l];
45
		}
46
	}
47
}
48
 
49
 
50
void DrawBufAlignCenter(dword x,y,w,h)
51
{
52
	int i, j, l;
53
	int content_width = stolbec * 6;
54
	int content_left = w - content_width / 2;
55
	for (j=0; j
56
	{
57
		for (i=j*w+content_width+content_left*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
58
		{
59
			ESDWORD[drawbuf+8+i] >< ESDWORD[drawbuf+8+l];
60
		}
61
	}
62
}
63
 
64
 
4074 leency 65
void TextGoDown(int left1, top1, width1)
66
{
67
	if (!stroka) DrawBar(WB1.left, WB1.top, WB1.width, 5, bg_color); //çàêðàøèâàåì ôîí íàä ïåðâîé ñòðîêîé
68
	if (top1>=WB1.top) && ( top1 < WB1.height+WB1.top-10)  && (!anchor)
69
	{
4190 leency 70
		if (text_align == ALIGN_CENTER) DrawBufAlignCenter(left1,top1,WB1.width,WB1.line_h);
71
		if (text_align == ALIGN_RIGHT) DrawBufAlignRight(left1,top1,WB1.width,WB1.line_h);
4074 leency 72
		PutPaletteImage(drawbuf+8, WB1.width, WB1.line_h, left1-5, top1, 32,0);
73
		DrawBufFill();
74
	}
4190 leency 75
	stroka++;
76
	if (blq_text) stolbec = 8; else stolbec = 0;
77
	if (li_text) stolbec = li_tab * 5;
4074 leency 78
}