41,7 → 41,7 |
int WriteIntoWindow(); |
int WriteIntoWindowCenter(); |
void WriteIntoBuffer(); |
void show_buf(); |
void ShowBuffer(); |
} label; |
|
:bool LABEL::changeSIZE() |
48,7 → 48,7 |
{ |
dword file_size; |
dword ofs; |
if(size.pt<9) size.pt = 8; |
if(size.pt<9) size.pt = 9; |
font = font_begin; |
ofs = DSDWORD[calc(size.pt-8<<2+font_begin)]; |
if(ofs==-1)return false; |
59,10 → 59,11 |
block = math.ceil(height*width/32); |
return true; |
} |
:dword LABEL::getsize(dword text1) |
:dword LABEL::getsize(byte fontSizePoints, dword text1) |
{ |
size.height = size.width = 0; |
size.offset_x = size.offset_y = -1; |
size.pt = fontSizePoints; |
if(size.pt)if(!changeSIZE())return 0; |
WHILE(DSBYTE[text1]) |
{ |
77,6 → 78,7 |
} |
:byte LABEL::symbol_size(byte s) |
{ |
//return symbol_size(s); |
dword xi,yi; |
dword tmp,_; |
dword iii = 0; |
177,7 → 179,6 |
return false; |
} |
font_begin = label_io.buffer_data; |
size.pt = 9; |
changeSIZE(); |
smooth = true; |
return true; |
220,51 → 221,6 |
} |
} |
|
:int LABEL::WriteIntoWindowCenter(dword x,y,w,h; dword _background, _color; byte fontSizePoints; dword txt) |
{ |
size.pt = fontSizePoints; |
getsize(txt); |
return WriteIntoWindow(w-size.width/2+x,y, _background, _color, fontSizePoints, txt); |
} |
|
:int LABEL::WriteIntoWindow(int x,y; dword _background, _color; byte fontSizePoints; dword text1) |
{ |
signed len=0; |
if(!text1)return false; |
if(size.pt)if(!changeSIZE())return false; |
size.pt = fontSizePoints; |
getsize(text1); |
color = _color; |
background = _background; |
y -= size.offset_y; |
EDX = size.width*size.height*3; |
if(!raw_size) |
{ |
raw_size = EDX; |
raw = malloc(raw_size); |
} |
else if(raw_size<EDX) |
{ |
raw_size = EDX; |
raw = realloc(raw,raw_size); |
} |
// Fill background color { |
EBX = background; |
EAX = raw_size+raw; |
for (EDI=raw; EDI<EAX; EDI+=3) ESDWORD[EDI] = EBX; |
// } |
len = size.offset_x; |
WHILE(DSBYTE[text1]) |
{ |
len+=symbol(len,0,DSBYTE[text1], raw); |
if(bold)len+=math.ceil(size.pt/17); |
text1++; |
} |
IF (smooth) ApplySmooth(); |
show_buf(x,y); |
return len; |
} |
|
:void LABEL::WriteIntoBuffer(int x,y,w,h; dword _background, _color; byte fontSizePoints; dword text1) |
{ |
dword new_raw_size; |
272,8 → 228,7 |
if(size.pt)if(!changeSIZE())return; |
|
if (size.pt != fontSizePoints) { |
size.pt = fontSizePoints; |
getsize(text1); |
getsize(fontSizePoints, text1); |
y -= size.offset_y; |
} |
color = _color; |
302,7 → 257,25 |
return; |
} |
|
:void LABEL::show_buf(dword x, y){ |
:int LABEL::WriteIntoWindow(int x,y; dword _background, _color; byte fontSizePoints; dword text1) |
{ |
if(!text1)return 0; |
getsize(fontSizePoints, text1); |
raw_size = NULL; |
WriteIntoBuffer(0, -size.offset_y, size.width-size.offset_x, |
size.height-size.offset_y, _background, _color, fontSizePoints, text1); |
if (smooth) ApplySmooth(); |
ShowBuffer(x,y); |
return size.offset_x + size.width; |
} |
|
:int LABEL::WriteIntoWindowCenter(dword x,y,w,h; dword _background, _color; byte fontSizePoints; dword text1) |
{ |
getsize(fontSizePoints, text1); |
return WriteIntoWindow(w-size.width/2+x,y, _background, _color, fontSizePoints, text1); |
} |
|
:void LABEL::ShowBuffer(dword x, y){ |
_PutImage(x, y, size.width, size.height, raw); |
} |
|