TempleOSCDV4.06.ISO
This commit is contained in:
1 parent
6fe38d2d9d
commit
b632ab9a4f
261 files changed
+6282
-5801
No files matched your search
+65
-65
@@ -619,7 +619,7 @@ U8 *GrBitMap1ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
|
||||
public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
CTask *task=NULL)
|
||||
{//Extract new device context rect from device context.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
CTask *win_task;
|
||||
if (x1>x2) SwapI64(&x1,&x2);
|
||||
if (y1>y2) SwapI64(&y1,&y2);
|
||||
@@ -630,10 +630,10 @@ public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
x2+=win_task->pix_left+win_task->scroll_x;
|
||||
y2+=win_task->pix_top +win_task->scroll_y;
|
||||
}
|
||||
result=DCNew(x2-x1+1,y2-y1+1,task);
|
||||
DCFill(result);
|
||||
GrBlot(result,-x1,-y1,dc);
|
||||
return result;
|
||||
res=DCNew(x2-x1+1,y2-y1+1,task);
|
||||
DCFill(res);
|
||||
GrBlot(res,-x1,-y1,dc);
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
@@ -862,10 +862,10 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
|
||||
I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
{//Use $LK,"GrPrint",A="MN:GrPrint"$()
|
||||
I64 x0,ch,result;
|
||||
I64 x0,ch,res;
|
||||
if (!_s) return 0;
|
||||
x0=x;
|
||||
result=0;
|
||||
res=0;
|
||||
while (ch=*_s++) {
|
||||
if (ch=='\n') {
|
||||
x=x0;
|
||||
@@ -873,20 +873,20 @@ I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (ch=='\t')
|
||||
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
|
||||
else {
|
||||
result+=GrPutChar(dc,x,y,ch);
|
||||
res+=GrPutChar(dc,x,y,ch);
|
||||
x+=FONT_WIDTH;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
{//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$()
|
||||
I64 y0,result;
|
||||
I64 y0,res;
|
||||
U8 buf[2];
|
||||
if (!_s) return 0;
|
||||
y0=y;
|
||||
result=0;
|
||||
res=0;
|
||||
|
||||
buf[1]=0;
|
||||
while (*buf=*_s++) {
|
||||
@@ -896,36 +896,36 @@ I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (*buf=='\t')
|
||||
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
|
||||
else {
|
||||
result+=GrPutS(dc,x,y,buf);
|
||||
res+=GrPutS(dc,x,y,buf);
|
||||
y+=FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{//2D. Clipping but not transformation.
|
||||
I64 result;
|
||||
I64 res;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrPutS(dc,x,y,buf);
|
||||
res=GrPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{//2D. Vertical text. Clipping but not transformation.
|
||||
I64 result;
|
||||
I64 res;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrVPutS(dc,x,y,buf);
|
||||
res=GrVPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
{//2D. Width Height. Clipping but not transformation.
|
||||
//Returns cnt of pixs changed.
|
||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||
I64 i,res=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||
leading_pixels,original_leading_pixels,whole_I64s,
|
||||
trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
||||
@@ -1009,13 +1009,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
leading_pixels=w2-w1; //Correct so it's right for result.
|
||||
leading_pixels=w2-w1; //Correct so it's right for res.
|
||||
trailing_pixels=0;
|
||||
}
|
||||
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
||||
color =dc->bkcolor.c0.color;
|
||||
k1=(h1+y)*dc->width_internal+x;
|
||||
result=-dc->collision_cnt;
|
||||
res=-dc->collision_cnt;
|
||||
for (j=h2-h1;j;j--) {
|
||||
for (i=w1;i<w2;i++) {
|
||||
c=dc->body[k1+i];
|
||||
@@ -1024,7 +1024,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
}
|
||||
k1+=dc->width_internal;
|
||||
}
|
||||
result+=dc->collision_cnt;
|
||||
res+=dc->collision_cnt;
|
||||
} else {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
win_z_buf_ptr=NULL;
|
||||
@@ -1051,7 +1051,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
case ROPB_EQU:
|
||||
case ROPB_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
@@ -1059,19 +1059,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1101,12 +1101,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else
|
||||
color.c0=dither_colors.c0;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
@@ -1114,19 +1114,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1156,7 +1156,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else
|
||||
color.c0=dither_colors.c0;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1167,7 +1167,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
case ROPB_EQU:
|
||||
case ROPB_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
@@ -1176,19 +1176,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1213,12 +1213,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
@@ -1227,19 +1227,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1264,7 +1264,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1275,26 +1275,26 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
case ROPB_EQU:
|
||||
case ROPB_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1315,31 +1315,31 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1360,20 +1360,20 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
{
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,c,x3,y3,d;
|
||||
I64 res=0,c,x3,y3,d;
|
||||
U8 *dst,*dst2;
|
||||
Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
CTask *win_task;
|
||||
@@ -1417,19 +1417,19 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
c=*dst;
|
||||
if (not_color) {
|
||||
if (c!=dc->color2) {
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
if (c==dc->color2) {
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
gr_done:
|
||||
return 0;
|
||||
}
|
||||
@@ -1437,7 +1437,7 @@ gr_done:
|
||||
I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
{
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,d,x=*x1,x2,x3,y3,dist;
|
||||
I64 res=0,d,x=*x1,x2,x3,y3,dist;
|
||||
Bool plot,dither,probability_dither,
|
||||
not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
U8 *dst,*dst2;
|
||||
@@ -1551,7 +1551,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
*dst^=c;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
x++;
|
||||
} else
|
||||
break;
|
||||
@@ -1628,12 +1628,12 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
*dst^=c;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
gr_done:
|
||||
return 0;
|
||||
}
|
||||
@@ -1642,7 +1642,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
{//3D. No transformation or pen width.
|
||||
//Returns cnt of pixs changed
|
||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 dist,dx,dz,z,result=0,i,j,d;
|
||||
I64 dist,dx,dz,z,res=0,i,j,d;
|
||||
U8 *dst;
|
||||
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
|
||||
I32 *db;
|
||||
@@ -1779,7 +1779,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
*dst^=c;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
}
|
||||
if (dither) {
|
||||
@@ -1806,5 +1806,5 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
||||
}
|
||||
}
|
||||
gr_done:
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+32
-32
@@ -3,7 +3,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
{//3D. Must be convex.
|
||||
//Returns cnt of pixs changed
|
||||
CD3I32 tri[3];
|
||||
I64 i,j,x,y,z,result=0;
|
||||
I64 i,j,x,y,z,res=0;
|
||||
if (n<3) return 0;
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
for (i=1;i<n-1;i++) {
|
||||
@@ -32,11 +32,11 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
DCReflect(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
}
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
return result;
|
||||
return res;
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=i-1;
|
||||
if (i==1) {
|
||||
@@ -60,9 +60,9 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
@@ -105,7 +105,7 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
||||
{//3D. Transformation with pen width.
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
||||
F64 d;
|
||||
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||
Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
@@ -118,26 +118,26 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
||||
_x2=x2; _y2=y2; _z2=z2;
|
||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
dx=_x2-_x1; dy=_y2-_y1;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
d=w*dc->pen_width/d;
|
||||
result|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
|
||||
res|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
|
||||
_x2,_y2,_z2,&GrPlot3,step);
|
||||
result|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
|
||||
res|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
|
||||
_x2,_y2,_z2,&GrPlot3,step);
|
||||
}
|
||||
was_symmetry=TRUE;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
result|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
dx=x2-x1; dy=y2-y1;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
d=w*dc->pen_width/d;
|
||||
result|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
|
||||
res|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
|
||||
x2,y2,z2,&GrPlot3,step);
|
||||
result|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
|
||||
res|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
|
||||
x2,y2,z2,&GrPlot3,step);
|
||||
}
|
||||
gr_done:
|
||||
@@ -145,14 +145,14 @@ gr_done:
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (was_symmetry)
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *ptr;
|
||||
I64 ch,result,w,w_max,h;
|
||||
I64 ch,res,w,w_max,h;
|
||||
if (!s) return FALSE;
|
||||
ptr=s;
|
||||
w=0; w_max=0; h=FONT_HEIGHT;
|
||||
@@ -170,12 +170,12 @@ public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
w+=FONT_WIDTH;
|
||||
}
|
||||
if (w>w_max) w_max=w;
|
||||
result=GrPrint(dc,x1,y1,"%s",s);
|
||||
result|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
result|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
result|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
result|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
||||
return ToBool(result);
|
||||
res=GrPrint(dc,x1,y1,"%s",s);
|
||||
res|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
res|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
res|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
res|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
||||
return ToBool(res);
|
||||
}
|
||||
|
||||
#define MAX_DIAMOND_SLOPE 2.75
|
||||
@@ -185,7 +185,7 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
Bool first=TRUE;
|
||||
U8 ch,*ptr,*ptr_end,*st,*s;
|
||||
I64 result=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
|
||||
I64 res=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
|
||||
F64 m;
|
||||
if (!_s) return FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
@@ -214,10 +214,10 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
|
||||
w=(StrLen(st)*FONT_WIDTH)>>1;
|
||||
if (first) {
|
||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
first=FALSE;
|
||||
} else
|
||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
if (w) {
|
||||
w+=border;
|
||||
do {
|
||||
@@ -238,11 +238,11 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
}
|
||||
Free(s);
|
||||
|
||||
result|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||
result|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||
result|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
result|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||
return ToBool(result);
|
||||
res|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||
res|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||
res|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
res|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||
return ToBool(res);
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
@@ -250,7 +250,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
||||
I64 tri_cnt,CMeshTri *tri)
|
||||
{//Returns cnt of pixs changed.
|
||||
CColorROPU32 old_color=dc->color;
|
||||
I64 i,x,y,z,result=0;
|
||||
I64 i,x,y,z,res=0;
|
||||
CD3I32 *pt,*pt_sym,*p_sym,*dst;
|
||||
CMeshTri *tri_sym=tri;
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
@@ -276,7 +276,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
||||
for (i=0;i<tri_cnt;i++,tri_sym++) {
|
||||
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
&p_sym[tri_sym->nums[1]],tri_sym->color);
|
||||
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
res+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
&p_sym[tri_sym->nums[1]]);
|
||||
}
|
||||
Free(pt_sym);
|
||||
@@ -286,12 +286,12 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
||||
for (i=0;i<tri_cnt;i++,tri++) {
|
||||
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
|
||||
&p[tri->nums[2]],tri->color);
|
||||
result+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||
res+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||
}
|
||||
mesh_done:
|
||||
dc->color=old_color;
|
||||
Free(pt);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
|
||||
|
||||
+54
-54
@@ -168,41 +168,41 @@ public U0 DCExtentsInit(CDC *dc=NULL)
|
||||
public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
{//Create alias of dc, so can change pen, color, etc.
|
||||
//NULL means gr.dc
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!dc) dc=gr.dc;
|
||||
if (!task) task=Fs;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
throw('Graphics');
|
||||
result=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(result,dc,sizeof(CDC));
|
||||
result->win_task=result->mem_task=task;
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->flags|=DCF_ALIAS;
|
||||
result->alias=dc;
|
||||
return result;
|
||||
res=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(res,dc,sizeof(CDC));
|
||||
res->win_task=res->mem_task=task;
|
||||
res->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(res);
|
||||
res->flags|=DCF_ALIAS;
|
||||
res->alias=dc;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{//Create new width x height device context.
|
||||
//Internally only allows widths which are divisible by 8.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
result->width=width;
|
||||
result->width_internal=(width+7)&~7;
|
||||
result->height=height;
|
||||
res=CAlloc(sizeof(CDC),task);
|
||||
res->win_task=task;
|
||||
res->mem_task=task;
|
||||
res->width=width;
|
||||
res->width_internal=(width+7)&~7;
|
||||
res->height=height;
|
||||
if (null_bitmap)
|
||||
result->flags|=DCF_DONT_DRAW;
|
||||
res->flags|=DCF_DONT_DRAW;
|
||||
else
|
||||
result->body=CAlloc(result->width_internal*result->height,task);
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
return result;
|
||||
res->body=CAlloc(res->width_internal*res->height,task);
|
||||
res->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(res);
|
||||
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 DCDel(CDC *dc)
|
||||
@@ -241,16 +241,16 @@ public U0 DCDepthBufAlloc(CDC *dc)
|
||||
|
||||
public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||
{//Alloc copy of dc, including image body, rot mat and depth buf.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!dc) return NULL;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
throw('Graphics');
|
||||
result=MAllocIdentical(dc,task);
|
||||
DCMat4x4Set(result,Mat4x4New(dc->r,task));
|
||||
result->mem_task=task;
|
||||
result->body=MAllocIdentical(dc->body,task);
|
||||
result->depth_buf=MAllocIdentical(dc->depth_buf,task);
|
||||
return result;
|
||||
res=MAllocIdent(dc,task);
|
||||
DCMat4x4Set(res,Mat4x4New(dc->r,task));
|
||||
res->mem_task=task;
|
||||
res->body=MAllocIdent(dc->body,task);
|
||||
res->depth_buf=MAllocIdent(dc->depth_buf,task);
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 DCMono(CDC *dc,
|
||||
@@ -269,22 +269,22 @@ public U0 DCMono(CDC *dc,
|
||||
|
||||
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
||||
{//Find and replace src color with dst in device context.
|
||||
I64 i,result=0;
|
||||
I64 i,res=0;
|
||||
U8 *dst;
|
||||
dst=dc->body;
|
||||
i=dc->width_internal*dc->height;
|
||||
while (i--)
|
||||
if (*dst==src_color) {
|
||||
*dst++=dst_color;
|
||||
result++;
|
||||
res++;
|
||||
} else
|
||||
dst++;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//Stores device context to mem, perhaps, with compression.
|
||||
U8 *result,*ptr,*body;
|
||||
U8 *res,*ptr,*body;
|
||||
CArcCompress *arc;
|
||||
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
@@ -313,7 +313,7 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
total_size+=NUM_COLORS*sizeof(CBGR48);
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(total_size);
|
||||
ptr=res=MAlloc(total_size);
|
||||
|
||||
#assert !offset(CDC.start)
|
||||
MemCpy(ptr,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||
@@ -331,45 +331,45 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
|
||||
Free(arc);
|
||||
if (_size) *_size=total_size;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
{//Loads device context from mem.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
U8 *ptr=src;
|
||||
CArcCompress *arc;
|
||||
I64 body_size;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
MemCpy(&result->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||
res=CAlloc(sizeof(CDC),task);
|
||||
res->win_task=task;
|
||||
res->mem_task=task;
|
||||
MemCpy(&res->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
|
||||
if (result->flags&DCF_PALETTE) {
|
||||
MemCpy(&result->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
if (res->flags&DCF_PALETTE) {
|
||||
MemCpy(&res->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
} else
|
||||
MemCpy(&result->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
||||
MemCpy(&res->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
||||
|
||||
body_size=result->width_internal*result->height;
|
||||
if (result->flags&DCF_COMPRESSED) {
|
||||
result->flags&=~DCF_COMPRESSED;
|
||||
body_size=res->width_internal*res->height;
|
||||
if (res->flags&DCF_COMPRESSED) {
|
||||
res->flags&=~DCF_COMPRESSED;
|
||||
arc=ptr;
|
||||
result->body=ExpandBuf(arc,task);
|
||||
res->body=ExpandBuf(arc,task);
|
||||
ptr+=arc->compressed_size;
|
||||
} else {
|
||||
result->body=MAlloc(body_size,task);
|
||||
MemCpy(result->body,ptr,body_size);
|
||||
res->body=MAlloc(body_size,task);
|
||||
MemCpy(res->body,ptr,body_size);
|
||||
ptr+=body_size;
|
||||
}
|
||||
result->pen_width=1;
|
||||
result->r=Mat4x4IdentNew(task);
|
||||
result->r_norm.u32[1]=1;
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
res->pen_width=1;
|
||||
res->r=Mat4x4IdentNew(task);
|
||||
res->r_norm.u32[1]=1;
|
||||
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||
if (_size) *_size=ptr-src;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files"
|
||||
|
||||
+2
-2
@@ -60,10 +60,10 @@ U0 GrSetUpTables()
|
||||
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
} else {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
// MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||
|
||||
+4
-4
@@ -465,22 +465,22 @@ public Bool RegPoly(U8 *aux_data,
|
||||
|
||||
#help_index "Graphics/Data Types/D3I32;Math/Data Types/D3I32;Data Types/D3I32"
|
||||
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
{//Dist between p1 and p2.
|
||||
{//Distance
|
||||
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
||||
}
|
||||
|
||||
public I64 D3I32DistSqr(CD3I32 *p1,CD3I32 *p2)
|
||||
{//Dist Squared between p1 and p2.
|
||||
{//Distance Squared
|
||||
return SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z);
|
||||
}
|
||||
|
||||
public F64 D3I32Norm(CD3I32 *p)
|
||||
{//Norm of p.
|
||||
{//Norm
|
||||
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
||||
}
|
||||
|
||||
public I64 D3I32NormSqr(CD3I32 *p)
|
||||
{//Norm Squared of p.
|
||||
{//Norm Squared
|
||||
return SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
|
||||
|
||||
public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
{//VGA has 6-bits for blue, for green, and for red.
|
||||
CBGR48 result=0;
|
||||
CBGR48 res=0;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
@@ -53,12 +53,12 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
result.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CBGR48 gr_palette_std[NUM_COLORS]={
|
||||
|
||||
+77
-77
@@ -135,18 +135,18 @@ This is an easier to understand
|
||||
version of the nonrecursive routine below.
|
||||
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
{
|
||||
I64 result,j,x1,ray_len,ray_len2;
|
||||
I64 res,j,x1,ray_len,ray_len2;
|
||||
|
||||
if (UnusedStk<0x80)
|
||||
Dbg("Stk Overflow",Fs);
|
||||
|
||||
result=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||
res=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||
y--;
|
||||
j=ray_len;
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
||||
result+=GrFloodFillRay(dc,x1,y,z,db);
|
||||
res+=GrFloodFillRay(dc,x1,y,z,db);
|
||||
j-=ray_len2+1;
|
||||
x1-=ray_len2+1;
|
||||
}
|
||||
@@ -155,11 +155,11 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
||||
result+=GrFloodFillRay(dc,x1,y,z,db);
|
||||
res+=GrFloodFillRay(dc,x1,y,z,db);
|
||||
j-=ray_len2+1;
|
||||
x1-=ray_len2+1;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -171,7 +171,7 @@ class CFFRay
|
||||
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
{//See the above commented-out routine for an easier to understand version.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
//We don't dynamically calculate the size to avoid
|
||||
//fragmentation of memory.
|
||||
CFFRay *f_dc=MAlloc(sizeof(CFFRay)*0x80000),*f=f_dc;
|
||||
@@ -182,7 +182,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
switch [f->state] {
|
||||
case 0:
|
||||
f->state++;
|
||||
result+=f->ray_len=GrRayLen(dc,&f->x,f->y,z,db);
|
||||
res+=f->ray_len=GrRayLen(dc,&f->x,f->y,z,db);
|
||||
f->y--;
|
||||
f->j=f->ray_len;
|
||||
f->x1=f->x;
|
||||
@@ -233,7 +233,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
}
|
||||
} while (f>=f_dc);
|
||||
Free(f_dc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
||||
@@ -242,7 +242,7 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equ to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,j,old_flags=dc->flags;
|
||||
I64 res=0,j,old_flags=dc->flags;
|
||||
CColorROPU32 old_color2=dc->color2;
|
||||
CDC *old_brush;
|
||||
if (dc->flags & DCF_DONT_DRAW) //TODO
|
||||
@@ -265,13 +265,13 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
||||
}
|
||||
if (not_color && j!=dc->color2 ||
|
||||
!not_color)
|
||||
result=GrFloodFillRay(dc,x,y,z,db);
|
||||
res=GrFloodFillRay(dc,x,y,z,db);
|
||||
}
|
||||
ff_done:
|
||||
dc->brush=old_brush;
|
||||
dc->flags=old_flags;
|
||||
dc->color2=old_color2;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrPlot3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||
@@ -442,27 +442,27 @@ Bool GrLinePlot(CDC *dc,I64 x,I64 y,I64 z)
|
||||
public Bool GrLine(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||
I64 step=1,I64 start=0)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
if (step==1 && !start && !dc->brush && !dc->depth_buf) {
|
||||
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
res=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
res=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 radius,
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
result=Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
||||
res=Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrEllipse(CDC *dc=gr.dc,
|
||||
@@ -473,13 +473,13 @@ public Bool GrEllipse(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
result=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,
|
||||
res=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||
@@ -490,13 +490,13 @@ public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//2D. Clipping but no transform or pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
result=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||
res=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Gr2Bezier(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
@@ -523,7 +523,7 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
||||
I64 step=1,I64 start=0)
|
||||
{//3D. Transformation with pen width.
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2;
|
||||
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||
Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
@@ -539,9 +539,9 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (DCClipLine(dc,&_x1,&_y1,&_x2,&_y2))
|
||||
result=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||
res=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
was_symmetry=TRUE;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
@@ -549,15 +549,15 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
||||
result|=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
res|=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
result|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
gr_done:
|
||||
if (was_transform)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (was_symmetry)
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
@@ -572,23 +572,23 @@ public Bool GrPutChar3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 ch)
|
||||
public I64 GrPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrPrint(dc,x,y,"%s",buf);
|
||||
res=GrPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrVPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{//3D. Vertical text. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrVPrint(dc,x,y,"%s",buf);
|
||||
res=GrVPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -601,7 +601,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//3D. Transformation with pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -638,13 +638,13 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
result=Ellipse(dc,cx,cy,cz,
|
||||
res=Ellipse(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
result=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
||||
res=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrCircle3(CDC *dc=gr.dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
@@ -666,7 +666,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//3D. Clipping and transform and pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -703,14 +703,14 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
result=RegPoly(dc,cx,cy,cz,
|
||||
res=RegPoly(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
||||
step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
result=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,
|
||||
res=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,
|
||||
rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
@@ -718,7 +718,7 @@ public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equ to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result,old_flags=dc->flags,
|
||||
I64 res,old_flags=dc->flags,
|
||||
_x,_y,_z;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
@@ -728,14 +728,14 @@ public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
_x=x1; _y=y1; _z=z1;
|
||||
DCReflect(dc,&_x,&_y,&_z);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=GrFloodFill(dc,_x,_y,not_color,_z,dc->depth_buf);
|
||||
res=GrFloodFill(dc,_x,_y,not_color,_z,dc->depth_buf);
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
result=GrFloodFill(dc,x1,y1,not_color,z1,dc->depth_buf);
|
||||
res=GrFloodFill(dc,x1,y1,not_color,z1,dc->depth_buf);
|
||||
gr_done:
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics;Graphics/Device Contexts"
|
||||
@@ -750,7 +750,7 @@ public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
adx2,ady2,adz2,
|
||||
x2,y2,z2,x3,y3,z3,
|
||||
dw,reg dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
|
||||
last_x,last_y,result=0;
|
||||
last_x,last_y,res=0;
|
||||
Bool first;
|
||||
CDC *old_brush=dc->brush;
|
||||
|
||||
@@ -855,7 +855,7 @@ public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
_x1+=dx1; _y1+=dy1; _z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
result=1;
|
||||
res=1;
|
||||
normal_image:
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
@@ -945,20 +945,20 @@ normal_image:
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
result=1; //TODO: check off screen
|
||||
res=1; //TODO: check off screen
|
||||
} else
|
||||
result=GrBlot(dc,x1,y1,img);
|
||||
res=GrBlot(dc,x1,y1,img);
|
||||
gr_done:
|
||||
dc->color=old_color;
|
||||
dc->brush=old_brush;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -988,22 +988,22 @@ public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Bezier2(dc,ctrl3,&GrPlot3);
|
||||
res=Bezier2(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=Bezier2(dc,ctrl,&GrPlot3);
|
||||
res|=Bezier2(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -1033,22 +1033,22 @@ public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Bezier3(dc,ctrl3,&GrPlot3);
|
||||
res=Bezier3(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=Bezier3(dc,ctrl,&GrPlot3);
|
||||
res|=Bezier3(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -1078,22 +1078,22 @@ public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
res=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
res|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -1123,22 +1123,22 @@ public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
res=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
res|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
{//3D. Returns cnt of pixs changed
|
||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,result=0,i,y_min,y_max;
|
||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,res=0,i,y_min,y_max;
|
||||
CTask *win_task;
|
||||
//p1 is min x
|
||||
if (p4->x<p2->x)
|
||||
@@ -1219,7 +1219,7 @@ p1y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
while (dy2++) {
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1246,7 +1246,7 @@ p1y
|
||||
}
|
||||
}
|
||||
while (dy2++<=0) {
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1304,7 +1304,7 @@ p4y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
while (dy2--) {
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1331,7 +1331,7 @@ p4y
|
||||
}
|
||||
}
|
||||
while (dy2-->=0) {
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1403,7 +1403,7 @@ p4y
|
||||
}
|
||||
while (dy1++<=0) {
|
||||
if (y<y_max)
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1438,7 +1438,7 @@ p4y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
while (dy1-->=0) {
|
||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||
y--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1448,5 +1448,5 @@ p4y
|
||||
}
|
||||
}
|
||||
ft_done:
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -379,18 +379,18 @@ U0 GrUpdateVGAGraphics()
|
||||
dst=gr.screen_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||
}
|
||||
} else {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64(&vga,&src,d,&dst);
|
||||
|
||||
+13
-13
@@ -331,33 +331,33 @@ public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
|
||||
|
||||
public CDC *Sprite2DC(U8 *elems)
|
||||
{//Convert sprite to device context.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
I64 min_x,max_x,min_y,max_y;
|
||||
SpriteExtents(elems,&min_x,&max_x,&min_y,&max_y);
|
||||
result=DCNew(max_x-min_x+1,max_y-min_y+1);
|
||||
Sprite3(result,-min_x,-min_y,0,elems);
|
||||
return result;
|
||||
res=DCNew(max_x-min_x+1,max_y-min_y+1);
|
||||
Sprite3(res,-min_x,-min_y,0,elems);
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
{//The two CSprite should be identical except for points shifted around.
|
||||
public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||
{//The two CSprite should be ident except for points shifted around.
|
||||
//t ranges from 0.0 to 1.0.
|
||||
I64 i,t1=GR_SCALE*t,t0=GR_SCALE-t1;
|
||||
I32 *ptr0,*ptr1,*ptrr;
|
||||
CD3I32 *p0,*p1,*pr;
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
CSprite *tempg0=elems0-offset(CSprite.start),
|
||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||
if (t<0.5) {
|
||||
i=SpriteSize(elems0),
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems0,i);
|
||||
res=MAlloc(i);
|
||||
MemCpy(res,elems0,i);
|
||||
} else {
|
||||
i=SpriteSize(elems1),
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems1,i);
|
||||
res=MAlloc(i);
|
||||
MemCpy(res,elems1,i);
|
||||
}
|
||||
tempgr=result-offset(CSprite.start);
|
||||
tempgr=res-offset(CSprite.start);
|
||||
while (tempg0->type) {
|
||||
if (tempg0->type!=tempg1->type)
|
||||
throw('Graphics');
|
||||
@@ -447,7 +447,7 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
tempg1(U8 *)+=SpriteElemSize(tempg1);
|
||||
tempgr(U8 *)+=SpriteElemSize(tempgr);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;DolDoc/Output;StdOut/DolDoc"
|
||||
|
||||
@@ -202,7 +202,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
||||
x22,y22,result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
x22,y22,res,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
old_de_flags=doc_e->de_flags;
|
||||
Bool down=FALSE;
|
||||
U8 *st=NULL;
|
||||
@@ -228,10 +228,10 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
case CH_ESC:
|
||||
result=GE_CONT;
|
||||
res=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCScreenCapture(FALSE);
|
||||
@@ -253,13 +253,13 @@ bm_menu:
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
||||
switch (i) {
|
||||
case DOCM_CANCEL:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto bm_done;
|
||||
case GBM_EXIT:
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto bm_done;
|
||||
case GBM_MAIN_MENU:
|
||||
result=GE_CONT;
|
||||
res=GE_CONT;
|
||||
goto bm_done;
|
||||
case GBM_COLOR:
|
||||
i=PopUpColor(,,FALSE);
|
||||
@@ -672,5 +672,5 @@ bm_done:
|
||||
doc_e->de_flags=old_de_flags;
|
||||
*_img=img;
|
||||
*_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+26
-26
@@ -201,7 +201,7 @@ public U0 Sprite2Code(CDoc *doc=NULL,U8 *elems)
|
||||
CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
{
|
||||
I64 i,num1,num2,size;
|
||||
CSprite *result,g;
|
||||
CSprite *res,g;
|
||||
CColorROPU32 color;
|
||||
U8 *st,*ptr;
|
||||
CQueD3I32 rootp,*tempp,*tempa1;
|
||||
@@ -313,8 +313,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
break;
|
||||
sub_switch_end:
|
||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||
result=MAlloc(size);
|
||||
MemCpy(result,&g,size);
|
||||
res=MAlloc(size);
|
||||
MemCpy(res,&g,size);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
@@ -330,9 +330,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexExcept(cc,"Expecting string at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
i=StrLen(st)+1;
|
||||
result=MAlloc(size+i);
|
||||
MemCpy(result,&g,size);
|
||||
MemCpy(result(U8 *)+size,st,i);
|
||||
res=MAlloc(size+i);
|
||||
MemCpy(res,&g,size);
|
||||
MemCpy(res(U8 *)+size,st,i);
|
||||
Free(st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
@@ -350,9 +350,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(cc,"Expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->nu.u;
|
||||
res=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -379,7 +379,7 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(cc,"Expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
res=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
if (LexExpressionI64(cc)) {
|
||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||
g.type=SPT_BSPLINE2_CLOSED;
|
||||
@@ -391,8 +391,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
else
|
||||
g.type=SPT_BSPLINE3;
|
||||
}
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->nu.u;
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -420,9 +420,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_POLYPT;
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->npu.u;
|
||||
res=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->npu.u;
|
||||
for (i=0;i<g.npu.num;i++)
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||
QueVectU8Del(tempv);
|
||||
@@ -456,9 +456,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_BITMAP;
|
||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||
result=CAlloc(size+num1);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->pwhu.u;
|
||||
res=CAlloc(size+num1);
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->pwhu.u;
|
||||
for (i=0;i<num1;i++)
|
||||
*ptr++=QueVectU8Get(tempv,i);
|
||||
QueVectU8Del(tempv);
|
||||
@@ -531,9 +531,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
g.pmu.tri_cnt=num2;
|
||||
}
|
||||
size=SpriteElemQuedBaseSize(g.type);
|
||||
result=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=result(U8 *)+size;
|
||||
res=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=res(U8 *)+size;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -556,13 +556,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexExcept(cc,"Expecting '}' at ");
|
||||
if (Lex(cc)!=';')
|
||||
LexExcept(cc,"Expecting ';' at ");
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
{//Text to sprite.
|
||||
CSprite root;
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
@@ -591,12 +591,12 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
DocUnlock(doc);
|
||||
if (okay) {
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
result=SpriteQue2Sprite(&root,&size);
|
||||
res=SpriteQue2Sprite(&root,&size);
|
||||
} else {
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
size=0;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
QueDel(&root);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+41
-41
@@ -4,49 +4,49 @@ CSprite *SpriteSetSettings(CDC *dc=NULL,CSprite *root,I64 elem_num,
|
||||
I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_width=NULL,
|
||||
I64 *_xx=NULL,I64 *_yy=NULL)
|
||||
{
|
||||
CSprite *result=root->next;
|
||||
CSprite *res=root->next;
|
||||
I64 width=1,xx=0,yy=0;
|
||||
CColorROPU32 color=BLACK;
|
||||
if (dc) DCRst(dc);
|
||||
while (elem_num-->0 && result!=root) {
|
||||
switch (result->type) {
|
||||
while (elem_num-->0 && res!=root) {
|
||||
switch (res->type) {
|
||||
case SPT_COLOR:
|
||||
color=result->c.color;
|
||||
color=res->c.color;
|
||||
if (dc) dc->color=color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
color=result->d.dither_color.u8[0]|
|
||||
result->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
color=res->d.dither_color.u8[0]|
|
||||
res->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
if (dc) dc->color=color;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
width=result->w.width;
|
||||
width=res->w.width;
|
||||
if (dc) dc->pen_width=width;
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
xx+=result->p.x1;
|
||||
yy+=result->p.y1;
|
||||
x+=result->p.x1;
|
||||
y+=result->p.y1;
|
||||
xx+=res->p.x1;
|
||||
yy+=res->p.y1;
|
||||
x+=res->p.x1;
|
||||
y+=res->p.y1;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (dc) {
|
||||
if (DCSymmetry3Set(dc,result->pp.x1+x,result->pp.y1+y,0,
|
||||
result->pp.x2+x,result->pp.y2+y,0,
|
||||
result->pp.x2+x,result->pp.y2+y,1))
|
||||
if (DCSymmetry3Set(dc,res->pp.x1+x,res->pp.y1+y,0,
|
||||
res->pp.x2+x,res->pp.y2+y,0,
|
||||
res->pp.x2+x,res->pp.y2+y,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
result=result->next;
|
||||
res=res->next;
|
||||
}
|
||||
if (_color) *_color=color;
|
||||
if (_width) *_width=width;
|
||||
if (_xx) *_xx=xx;
|
||||
if (_yy) *_yy=yy;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
@@ -62,31 +62,31 @@ Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
CSprite *Sprite2SpriteQue(U8 *elems)
|
||||
{
|
||||
I64 s;
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
||||
CSprite *res=CAlloc(sizeof(CSprite)),
|
||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||
QueInit(result);
|
||||
QueInit(res);
|
||||
while (tempg->type) {
|
||||
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
||||
s=SpriteElemSize(tempg);
|
||||
MemCpy(&tempg1->start,&tempg->start,s);
|
||||
tempg1->selected=FALSE;
|
||||
QueIns(tempg1,result->last);
|
||||
QueIns(tempg1,res->last);
|
||||
tempg(U8 *)+=s;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
||||
{
|
||||
I64 i,size=sprite_elem_base_sizes[SPT_END];
|
||||
CSprite *tempg=root->next;
|
||||
U8 *result,*dst;
|
||||
U8 *res,*dst;
|
||||
while (tempg!=root) {
|
||||
size+=SpriteElemSize(tempg);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
result=dst=MAlloc(size);
|
||||
res=dst=MAlloc(size);
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
i=SpriteElemSize(tempg);
|
||||
@@ -95,7 +95,7 @@ U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
||||
tempg=tempg->next;
|
||||
}
|
||||
*dst=SPT_END;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 SpriteEdUpdate(CDoc *doc,CDocEntry *doc_ce,CSprite *root)
|
||||
@@ -555,47 +555,47 @@ U0 SpriteTransform(I64 *r,CSprite *root)
|
||||
|
||||
I64 SpriteQueSelectCnt(CSprite *root,Bool val=TRUE)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=root->next;
|
||||
val=ToBool(val);
|
||||
while (tempg!=root) {
|
||||
if (ToBool(tempg->selected)==val)
|
||||
result++;
|
||||
res++;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 SpriteQueSelectAll(CSprite *root,Bool val=TRUE)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
tempg->selected=val;
|
||||
result++;
|
||||
res++;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||
{//For the side-bar
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),*tempg;
|
||||
CSprite *res=CAlloc(sizeof(CSprite)),*tempg;
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
Bool found=FALSE;
|
||||
I64 num=0;
|
||||
QueInit(result);
|
||||
QueInit(res);
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
|
||||
tempg=SpriteSetSettings(,root,doc_e->left_exp);
|
||||
if (tempg!=root) {
|
||||
tempg=MAllocIdentical(tempg);
|
||||
tempg=MAllocIdent(tempg);
|
||||
tempg->selected=Bt(&doc_e->type,DOCEt_SELECTED);
|
||||
if (*_cur_elem_num==doc_e->left_exp) {
|
||||
*_cur_elem_num=num;
|
||||
found=TRUE;
|
||||
}
|
||||
QueIns(tempg,result->last);
|
||||
QueIns(tempg,res->last);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
@@ -605,7 +605,7 @@ CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||
*_cur_elem_num=num;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 SpriteSideBarPickNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||
@@ -679,7 +679,7 @@ U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *_cur_elem_num)
|
||||
|
||||
Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
{
|
||||
Bool result;
|
||||
Bool res;
|
||||
CSprite *root=*_root;
|
||||
U8 *elems=SpriteQue2Sprite(root);
|
||||
CDoc *doc=DocNew,*doc2,*old_put=DocPut;
|
||||
@@ -690,7 +690,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
Sprite2Code(doc,elems);
|
||||
Free(elems);
|
||||
while (TRUE) {
|
||||
if (result=PopUpPrint("DocEd(0x%X,0x%X);",doc,0)) {
|
||||
if (res=PopUpPrint("DocEd(0x%X,0x%X);",doc,0)) {
|
||||
Fs->put_doc=doc2=DocNew;
|
||||
"$$WW,1$$";
|
||||
if (elems=Code2Sprite(doc)) {
|
||||
@@ -712,7 +712,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
}
|
||||
DocDel(doc);
|
||||
if (_root) *_root=root;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#define GED_SELECT_UNSELECT_ALL 0
|
||||
@@ -955,7 +955,7 @@ U0 SpriteCtrlPtsMove(CEdSprite *root,I64 dx,I64 dy)
|
||||
Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
{
|
||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
Bool result=TRUE;
|
||||
Bool res=TRUE;
|
||||
CDC *dc=DCAlias;
|
||||
CEdSprite root,*temppe,*best_pe;
|
||||
|
||||
@@ -1048,7 +1048,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
gs_key:
|
||||
switch (a1.u8[0]) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
case CH_ESC:
|
||||
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
||||
goto gs_done;
|
||||
@@ -1071,9 +1071,9 @@ gs_done:
|
||||
}
|
||||
DCFill(dc);
|
||||
DCDel(dc);
|
||||
if (_cur_elem_num && result)
|
||||
if (_cur_elem_num && res)
|
||||
*_cur_elem_num=cur_elem_num;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||
|
||||
+138
-138
@@ -131,7 +131,7 @@ U0 SpriteScreenInit(CDC *dc,I64,I64)
|
||||
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
@@ -141,19 +141,19 @@ CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||
result->type=SPT_LINE;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||
res->type=SPT_LINE;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
@@ -163,19 +163,19 @@ CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||
result->type=SPT_ARROW;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||
res->type=SPT_ARROW;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,old_width,old_flags;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
old_width=dc->pen_width;
|
||||
old_flags=dc->flags;
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -189,19 +189,19 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
||||
dc->pen_width=old_width;
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
result->type=SPT_PLANAR_SYMMETRY;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
res->type=SPT_PLANAR_SYMMETRY;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
@@ -221,13 +221,13 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
result->type=SPT_RECT;
|
||||
result->pp.x1=xx1-x;
|
||||
result->pp.y1=yy1-y;
|
||||
result->pp.x2=xx2-x;
|
||||
result->pp.y2=yy2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
res->type=SPT_RECT;
|
||||
res->pp.x1=xx1-x;
|
||||
res->pp.y1=yy1-y;
|
||||
res->pp.x2=xx2-x;
|
||||
res->pp.y2=yy2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
@@ -235,7 +235,7 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
{
|
||||
I64 i,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2,old_width;
|
||||
CDC *dc3,*img;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
old_width=dc2->pen_width;
|
||||
dc2->pen_width=1;
|
||||
do {
|
||||
@@ -257,12 +257,12 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
xx2++; yy2++;
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
result->type=SPT_BITMAP;
|
||||
result->pwhu.width=xx2-xx1;
|
||||
result->pwhu.height=yy2-yy1;
|
||||
result->pwhu.x1=0;
|
||||
result->pwhu.y1=0;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
res->type=SPT_BITMAP;
|
||||
res->pwhu.width=xx2-xx1;
|
||||
res->pwhu.height=yy2-yy1;
|
||||
res->pwhu.x1=0;
|
||||
res->pwhu.y1=0;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
i=gr.screen_zoom;
|
||||
GrScaleZoom(1.0/i);
|
||||
@@ -274,19 +274,19 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
MemCpy(&result->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&res->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
DCDel(img);
|
||||
DCDel(dc3);
|
||||
dc2->pen_width=old_width;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
@@ -296,19 +296,19 @@ CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
result->type=SPT_CIRCLE;
|
||||
result->pr.x1=x1-x;
|
||||
result->pr.y1=y1-y;
|
||||
result->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
res->type=SPT_CIRCLE;
|
||||
res->pr.x1=x1-x;
|
||||
res->pr.y1=y1-y;
|
||||
res->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
F64 angle1,angle2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,(x1+x2)>>1,(y1+y2)>>1,0,AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1);
|
||||
@@ -316,37 +316,37 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
result->type=SPT_ELLIPSE;
|
||||
result->pwha.x1=(x1+x2)>>1-x;
|
||||
result->pwha.y1=(y1+y2)>>1-y;
|
||||
result->pwha.width =AbsI64(x1-x2)>>1;
|
||||
result->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width<result->pwha.height)
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
res->type=SPT_ELLIPSE;
|
||||
res->pwha.x1=(x1+x2)>>1-x;
|
||||
res->pwha.y1=(y1+y2)>>1-y;
|
||||
res->pwha.width =AbsI64(x1-x2)>>1;
|
||||
res->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width<res->pwha.height)
|
||||
angle2-=ã/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width>=result->pwha.height)
|
||||
result->pwha.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width>=res->pwha.height)
|
||||
res->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
||||
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width>=result->pwha.height)
|
||||
result->pwha.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width>=res->pwha.height)
|
||||
res->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
||||
return result;
|
||||
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
@@ -354,7 +354,7 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
F64 angle1,angle2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,(x1+x2)>>1,(y1+y2)>>1,0,
|
||||
@@ -363,40 +363,40 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
result->type=SPT_POLYGON;
|
||||
result->pwhas.x1=(x1+x2)>>1-x;
|
||||
result->pwhas.y1=(y1+y2)>>1-y;
|
||||
result->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
result->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
result->pwhas.sides=sides;
|
||||
angle2=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width<result->pwhas.height)
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
res->type=SPT_POLYGON;
|
||||
res->pwhas.x1=(x1+x2)>>1-x;
|
||||
res->pwhas.y1=(y1+y2)>>1-y;
|
||||
res->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
res->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
res->pwhas.sides=sides;
|
||||
angle2=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width<res->pwhas.height)
|
||||
angle2-=ã/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width>=result->pwhas.height)
|
||||
result->pwhas.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width>=res->pwhas.height)
|
||||
res->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
||||
result->pwhas.width,result->pwhas.height,
|
||||
result->pwhas.sides,result->pwhas.angle);
|
||||
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||
res->pwhas.width,res->pwhas.height,
|
||||
res->pwhas.sides,res->pwhas.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width>=result->pwhas.height)
|
||||
result->pwhas.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width>=res->pwhas.height)
|
||||
res->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
||||
result->pwhas.width,result->pwhas.height,result->pwhas.sides,
|
||||
result->pwhas.angle);
|
||||
return result;
|
||||
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||
res->pwhas.width,res->pwhas.height,res->pwhas.sides,
|
||||
res->pwhas.angle);
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
@@ -405,7 +405,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *result,*tempg,*tempg1,root2;
|
||||
CSprite *res,*tempg,*tempg1,root2;
|
||||
|
||||
QueInit(&root2);
|
||||
do {
|
||||
@@ -423,11 +423,11 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
result->type=SPT_PT;
|
||||
result->p.x1=x2-x;
|
||||
result->p.y1=y2-y;
|
||||
QueIns(result,root2.last);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
res->type=SPT_PT;
|
||||
res->p.x1=x2-x;
|
||||
res->p.y1=y2-y;
|
||||
QueIns(res,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
@@ -436,8 +436,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
switch (eletype) {
|
||||
case SPT_POLYLINE:
|
||||
if (num>1) {
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&result->nu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&res->nu.u;
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
@@ -446,8 +446,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=SPT_POLYLINE;
|
||||
result->nu.num=num;
|
||||
res->type=SPT_POLYLINE;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
@@ -455,7 +455,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
}
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
@@ -463,8 +463,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
if (num>2) {
|
||||
result=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&result->nu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&res->nu.u;
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
@@ -473,8 +473,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=eletype;
|
||||
result->nu.num=num;
|
||||
res->type=eletype;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
@@ -482,18 +482,18 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
{
|
||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
|
||||
I32 *ptr;
|
||||
CSprite *result,*tempg,*tempg1,root2;
|
||||
CSprite *res,*tempg,*tempg1,root2;
|
||||
|
||||
QueInit(&root2);
|
||||
x3=a1-x; y3=a2-y;
|
||||
@@ -507,25 +507,25 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
|
||||
num=0;
|
||||
result=root2.next;
|
||||
res=root2.next;
|
||||
x1=x3; y1=y3;
|
||||
while (result!=&root2) {
|
||||
tempg=result->next;
|
||||
if (result->p.x1==x1 && result->p.y1==y1) {
|
||||
QueRem(result);
|
||||
Free(result);
|
||||
while (res!=&root2) {
|
||||
tempg=res->next;
|
||||
if (res->p.x1==x1 && res->p.y1==y1) {
|
||||
QueRem(res);
|
||||
Free(res);
|
||||
} else {
|
||||
num++;
|
||||
x1=result->p.x1;
|
||||
y1=result->p.y1;
|
||||
x1=res->p.x1;
|
||||
y1=res->p.y1;
|
||||
}
|
||||
result=tempg;
|
||||
res=tempg;
|
||||
}
|
||||
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
result->npu.x=x3;
|
||||
result->npu.y=y3;
|
||||
ptr=&result->npu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
res->npu.x=x3;
|
||||
res->npu.y=y3;
|
||||
ptr=&res->npu.u;
|
||||
x1=x3; y1=y3;
|
||||
i=0;
|
||||
tempg1=root2.next;
|
||||
@@ -539,9 +539,9 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=SPT_POLYPT;
|
||||
result->npu.num=num;
|
||||
return result;
|
||||
res->type=SPT_POLYPT;
|
||||
res->npu.num=num;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *root,CDC *dc,
|
||||
@@ -809,7 +809,7 @@ U0 SMTaskTitleSet(I64 eletype)
|
||||
I64 SpriteMainEd(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
I64 result,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
||||
I64 res,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
||||
cur_elem_num,old_border_src=Fs->border_src,old_title_src=Fs->title_src,
|
||||
old_de_flags=doc_ce->de_flags;
|
||||
CColorROPU32 bm_bkcolor,color;
|
||||
@@ -958,7 +958,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
xx2+=xx; yy2+=yy;
|
||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==GE_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
eletype=SPT_MENU;
|
||||
@@ -1028,20 +1028,20 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
x+=xx; y+=yy;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
if (eletype==SPT_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
} else if (eletype==DOCM_CANCEL) {
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto ei_done;
|
||||
}
|
||||
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_ESC:
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCScreenCapture(FALSE);
|
||||
@@ -1134,7 +1134,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
case SPT_BITMAP:
|
||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
TRUE,,,,,&cur_elem_num)==GE_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
@@ -1164,7 +1164,7 @@ ei_done:
|
||||
Fs->title_src =old_title_src;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 EdSpriteIns(CDoc *doc)
|
||||
@@ -1217,7 +1217,7 @@ U0 EdSpriteEd(CDoc *doc)
|
||||
tempb=doc_ce->bin_data;
|
||||
old_size=tempb->size;
|
||||
old_csprite=tempb->data;
|
||||
tempb->data=MAllocIdentical(old_csprite,doc->mem_task);
|
||||
tempb->data=MAllocIdent(old_csprite,doc->mem_task);
|
||||
DocUnlock(doc);
|
||||
if (SpriteMainEd(doc)==GE_ABORT) {
|
||||
DocLock(doc);
|
||||
|
||||
@@ -74,21 +74,21 @@ CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
||||
|
||||
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||
{//Screen coordinates
|
||||
CMeshEdVertex *result=NULL,*tempv=e->vertex_root.next;
|
||||
CMeshEdVertex *res=NULL,*tempv=e->vertex_root.next;
|
||||
I64 dd,dz,best_dd=MAX_I64,best_dz=MAX_I64;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (!(tempv->flags&VF_IGNORE)) {
|
||||
dd=SqrI64(x-tempv->pt.x)+SqrI64(y-tempv->pt.y);
|
||||
dz=AbsI64(e->my_ip_z-tempv->p.z);
|
||||
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
||||
result=tempv;
|
||||
res=tempv;
|
||||
best_dd=dd;
|
||||
best_dz=dz;
|
||||
}
|
||||
}
|
||||
tempv=tempv->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
CMeshEdVertex *MeshVertexFindNum(CMeshFrame *haystack_e,I64 needle_num)
|
||||
@@ -248,20 +248,20 @@ U0 MeshTriSelectRect(CMeshFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
|
||||
I64 MeshSelectCnt(CMeshFrame *e)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (tempv->flags&VF_SELECTED)
|
||||
result++;
|
||||
res++;
|
||||
tempv=tempv->next;
|
||||
}
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags&TF_SELECTED)
|
||||
result++;
|
||||
res++;
|
||||
tempt=tempt->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
||||
@@ -823,7 +823,7 @@ I64 MeshSize(CMeshFrame *e)
|
||||
I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
{
|
||||
I64 size=MeshSize(e);
|
||||
U8 *result=MAlloc(size),*dst=result;
|
||||
U8 *res=MAlloc(size),*dst=res;
|
||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
|
||||
@@ -845,7 +845,7 @@ I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
tempt=tempt->next;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 MeshCleanUp(CMeshFrame *e)
|
||||
|
||||
@@ -87,15 +87,15 @@ public I64 SpriteSize(U8 *elems)
|
||||
|
||||
I64 SpriteTypeMask(U8 *elems)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
while (tempg->type) {
|
||||
if (tempg->type>=SPT_NUM_TYPES)
|
||||
return 1<<SPT_NUM_TYPES;
|
||||
Bts(&result,tempg->type);
|
||||
Bts(&res,tempg->type);
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DC2Sprite(CDC *tempb)
|
||||
|
||||
Reference in new issue
Block a user