TempleOSTS_130707.ISO
This commit is contained in:
1 parent
17b71f1a2d
commit
1343005a29
617 files changed
+14399
-25130
No files matched your search
@@ -1,10 +1,10 @@
|
||||
#define GEBM_END 0
|
||||
#define GEBM_CONT 1
|
||||
#define GEBM_EXIT 0
|
||||
#define GEBM_MAIN_MENU 1
|
||||
#define GEBM_COLOR 2
|
||||
#define GEBM_DITHER_COLOR 3
|
||||
#define GEBM_WIDTH 4
|
||||
#define GEBM_SNAP 5
|
||||
#define GEBM_PT 6
|
||||
#define GEBM_PT 6
|
||||
#define GEBM_LINE 7
|
||||
#define GEBM_ARROW 8
|
||||
#define GEBM_RECT 9
|
||||
@@ -16,13 +16,26 @@
|
||||
#define GEBM_FLOOD_FILL_NOT 15
|
||||
#define GEBM_POLYLINE 16
|
||||
#define GEBM_POLYPT 17
|
||||
#define GEBM_CUT 18
|
||||
#define GEBM_COPY 18
|
||||
#define GEBM_DELETE 19
|
||||
#define GEBM_PASTE 20
|
||||
#define GEBM_PASTE_TRANSPARENT 21
|
||||
#define GEBM_FIND_AND_REPLACE 22
|
||||
#define GEBM_TRIM_TO_EXTENTS 23
|
||||
#define GEBM_UNDO 24
|
||||
#define GEBM_ADD_OUTLINE 24
|
||||
#define GEBM_ETCH 25
|
||||
#define GEBM_UNDO 26
|
||||
|
||||
U0 GrInit3()
|
||||
{
|
||||
DefineLstLoad("ST_SPRITE_BITMAP_MENU",
|
||||
"Exit\0Main Menu\0Color\0Dither Color\0Width\0Snap\0Point\0Line\0Arrow\0"
|
||||
"Rect\0Circle\0Text\0Text Box\0Text Diamond\0Flood Fill\0"
|
||||
"Flood Fill Not Color\0PolyLine\0PolyPoint\0Copy\0Delete\0Paste\0"
|
||||
"Paste Transparent\0Find and Replace\0Trim to Extents\0Add Outline\0"
|
||||
"Etch\0Undo\0");
|
||||
}
|
||||
GrInit3;
|
||||
|
||||
I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
{
|
||||
@@ -39,16 +52,17 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
st2="";
|
||||
}
|
||||
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"BitMap Menu\"$$$$FG$$\n"
|
||||
"$$FG,RED$$Settings$$FG$$\n"
|
||||
"$$MU-UL,\"Color %s\",GEBM_COLOR$$\n"
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteBitMap.TXT.Z\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU-UL,\"Color %s\",GEBM_COLOR$$\n"
|
||||
"$$MU-UL,\"Dither Color %s\",GEBM_DITHER_COLOR$$\n"
|
||||
"$$MU-UL,\"Width %d\",GEBM_WIDTH$$\n"
|
||||
"$$MU-UL,\"Snap %d %5.3f\",GEBM_SNAP$$\n"
|
||||
"$$MU-UL,\"Find & Replace Color\",GEBM_FIND_AND_REPLACE$$\n"
|
||||
"$$MU-UL,\"Trim to Extents\",GEBM_TRIM_TO_EXTENTS$$\n"
|
||||
"\n$$FG,RED$$Objects$$FG$$\n"
|
||||
"$$MU-UL,\"Point\",GEBM_PT$$\n"
|
||||
"$$MU-UL,\"Add Outline\",GEBM_ADD_OUTLINE$$\n"
|
||||
"$$MU-UL,\"Etch\",GEBM_ETCH$$\n"
|
||||
"\n$$MU-UL,\"Point\",GEBM_PT$$\n"
|
||||
"$$MU-UL,\"Line\",GEBM_LINE$$\n"
|
||||
"$$MU-UL,\"Arrow\",GEBM_ARROW$$\n"
|
||||
"$$MU-UL,\"Rect\",GEBM_RECT$$\n"
|
||||
@@ -60,15 +74,15 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
"$$MU-UL,\"Flood Fill Not Color\",GEBM_FLOOD_FILL_NOT$$\n"
|
||||
"$$MU-UL,\"PolyLine\",GEBM_POLYLINE$$\n"
|
||||
"$$MU-UL,\"PolyPoint\",GEBM_POLYPT$$\n"
|
||||
"\n$$FG,RED$$Clipboard$$FG$$\n"
|
||||
"$$MU-UL,\"Cut\",GEBM_CUT$$\n"
|
||||
"$$MU-UL,\"Delete\",GEBM_DELETE$$\n"
|
||||
"$$MU-UL,\"Paste\",GEBM_PASTE$$\n"
|
||||
"$$MU-UL,\"Paste Transparent\",GEBM_PASTE_TRANSPARENT$$\n"
|
||||
"\n$$MU-UL,\"Copy to Clipboard\",GEBM_COPY$$\n"
|
||||
"$$MU-UL,\"Delete to Clipboard\",GEBM_DELETE$$\n"
|
||||
"$$MU-UL,\"Paste Clipboard\",GEBM_PASTE$$\n"
|
||||
"$$MU-UL,\"Paste Transparent Clipboard\",GEBM_PASTE_TRANSPARENT$$\n"
|
||||
"\n$$MU-UL,\"Undo\",GEBM_UNDO$$\n"
|
||||
"\n$$FM,PURPLE$$$$MU-UL,\"+] Vect Object Menu\",GEBM_CONT$$$$FM,LTBLUE$$\n"
|
||||
"$$MU-UL,\"End\",GEBM_END$$\n"
|
||||
"$$MU-UL,\"Cancel\",DOCM_CANCEL$$\n",st1,st2,width,snap,ip_scaler);
|
||||
"\n$$FG,PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",GEBM_MAIN_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GEBM_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$\n",st1,st2,width,snap,ip_scaler);
|
||||
DocPutS(doc,"\nRight-Click to get back to this menu.");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -80,17 +94,6 @@ U0 GrBMEdPrepPersistentDC(CDC *dc,I64 xx1,I64 yy1,CDC *img)
|
||||
GrBlot(dc,xx1,yy1,img);
|
||||
}
|
||||
|
||||
U0 GrBMEFindReplaceColor(CDC *img,I64 pattern,I64 replace)
|
||||
{
|
||||
U8 *dst=img->body;
|
||||
I64 d0=img->height*img->width_internal;
|
||||
while (d0--) {
|
||||
if (*dst==pattern)
|
||||
*dst=replace;
|
||||
dst++;
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrBMETrimToExtents(CDC **_img,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CColorROPU32 bkcolor)
|
||||
{
|
||||
CDC *img=*_img;
|
||||
@@ -138,40 +141,95 @@ tr_done:
|
||||
DCDel(img);
|
||||
}
|
||||
|
||||
I64 SpriteBitMap(CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor,I64 *_import_snap=NULL,F64 *_import_ip_scaler=NULL)
|
||||
|
||||
U0 GrBMEAddOutline(CDC *img,I64 width,CColorROPU32 color,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,mode=GEBM_LINE,color=BLACK,width=1,msg_code,p1,p2,x1,y1,x11,y11,x22,y22,new_snap=1,
|
||||
result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2;
|
||||
I64 i,j,k,c;
|
||||
CColorROPU32 old_color;
|
||||
CDC *src;
|
||||
if (img->width && img->height) {
|
||||
old_color=img->color;
|
||||
img->color=color;
|
||||
while (width-->0) {
|
||||
src=DCExtract(img,0,0,img->width-1,img->height-1);
|
||||
for (i=0;i<img->height;i++)
|
||||
for (j=0;j<img->width;j++)
|
||||
if (GrPeek(src,j,i)==bkcolor)
|
||||
for (k=0;k<8;k++) {
|
||||
c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
|
||||
if (c>=0 && c!=bkcolor) {
|
||||
GrPlot(img,j,i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
DCDel(src);
|
||||
}
|
||||
img->color=old_color;
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrBMEEtch(CDC *img,I64 width,CColorROPU32 bkcolor)
|
||||
{
|
||||
I64 i,j,k,c;
|
||||
CColorROPU32 old_color;
|
||||
CDC *src;
|
||||
if (img->width && img->height) {
|
||||
old_color=img->color;
|
||||
img->color=bkcolor;
|
||||
while (width-->0) {
|
||||
src=DCExtract(img,0,0,img->width-1,img->height-1);
|
||||
for (i=0;i<img->height;i++)
|
||||
for (j=0;j<img->width;j++)
|
||||
if (GrPeek(src,j,i)!=bkcolor)
|
||||
for (k=0;k<8;k++) {
|
||||
c=GrPeek(src,j+gr_x_offsets[k],i+gr_y_offsets[k]);
|
||||
if (c<0 || c==bkcolor) {
|
||||
GrPlot(img,j,i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
DCDel(src);
|
||||
}
|
||||
img->color=old_color;
|
||||
}
|
||||
}
|
||||
|
||||
I64 SpriteBitMap(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor,I64 *_ip_snap,F64 *_ip_scaler)
|
||||
{
|
||||
I64 i,j,mode=GEBM_LINE,color=BLACK,width=1,msg_code,p1,p2,x1,y1,x11,y11,x22,y22,ip_snap=1,
|
||||
result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||
old_e_flags1=doc_e->flags1;
|
||||
Bool down=FALSE;
|
||||
F64 new_ip_scaler=1.0;
|
||||
F64 ip_scaler=1.0;
|
||||
U8 *st=NULL;
|
||||
CDC *img=*_img,
|
||||
*clipboard=NULL,*undo=NULL,*dc2;
|
||||
*clipboard=NULL,*undo=NULL,*dc2;
|
||||
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
|
||||
|
||||
if (_import_snap) new_snap=*_import_snap;
|
||||
if (_import_ip_scaler) new_ip_scaler=*_import_ip_scaler;
|
||||
SetSnap(&Fs->snap,new_snap,new_ip_scaler);
|
||||
if (_ip_snap) ip_snap=*_ip_snap;
|
||||
if (_ip_scaler) ip_scaler=*_ip_scaler;
|
||||
SetSnap(&Fs->snap,ip_snap,ip_scaler);
|
||||
|
||||
doc_e->flags1|=DOCEF1_DONT_DRAW;
|
||||
goto bm_menu;
|
||||
|
||||
while (TRUE) {
|
||||
if (sys_cur_scan_code&SCF_CTRL)//grab scroll update?
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
|
||||
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrLineRect4(dc,xx1-1,yy1-1,xx2,yy2);//This is done little bit too often.
|
||||
|
||||
while (msg_code=ScanMsg(&p1,&p2,1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|1<<MSG_IP_R_DOWN|
|
||||
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
if (p1==CH_SHIFT_ESC) {
|
||||
result=GE_CANCEL;
|
||||
result=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
} else if (p1==CH_ESC) {
|
||||
result=GE_OKAY_CONT;
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
}
|
||||
break;
|
||||
@@ -179,15 +237,19 @@ I64 SpriteBitMap(CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2,I64 *_yy2,CDC **_img,CCol
|
||||
case MSG_IP_R_DOWN:
|
||||
bm_menu:
|
||||
DCFill(dc);
|
||||
switch (i=PopUpSpriteBitMap(color,width,new_snap,new_ip_scaler)) {
|
||||
StrCpy(Fs->task_title,"Sprite BitMap Menu");
|
||||
i=PopUpSpriteBitMap(color,width,ip_snap,ip_scaler);
|
||||
if (i>=0)
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
||||
switch (i) {
|
||||
case DOCM_CANCEL:
|
||||
result=GE_CANCEL;
|
||||
result=GE_ABORT;
|
||||
goto bm_done;
|
||||
case GEBM_END:
|
||||
result=GE_OKAY_DONE;
|
||||
case GEBM_EXIT:
|
||||
result=GE_EXIT;
|
||||
goto bm_done;
|
||||
case GEBM_CONT:
|
||||
result=GE_OKAY_CONT;
|
||||
case GEBM_MAIN_MENU:
|
||||
result=GE_CONT;
|
||||
goto bm_done;
|
||||
|
||||
case GEBM_COLOR:
|
||||
@@ -200,7 +262,7 @@ bm_menu:
|
||||
if (i>=0) {
|
||||
j=PopUpColor("Replace Color\n",,FALSE);
|
||||
if (j>=0) {
|
||||
GrBMEFindReplaceColor(img,i,j);
|
||||
DCColorChg(img,i,j);
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
}
|
||||
@@ -211,9 +273,24 @@ bm_menu:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
goto bm_menu;
|
||||
|
||||
case GEBM_ADD_OUTLINE:
|
||||
i=PopUpRangeI64(1,16,1,"Outline Width\n");
|
||||
if (i>=0) {
|
||||
GrBMEAddOutline(img,i,color,bkcolor);
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
goto bm_menu;
|
||||
|
||||
case GEBM_ETCH:
|
||||
i=PopUpRangeI64(1,16,1,"Etch Width\n");
|
||||
if (i>=0) {
|
||||
GrBMEEtch(img,i,bkcolor);
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
}
|
||||
goto bm_menu;
|
||||
|
||||
case GEBM_DITHER_COLOR:
|
||||
i=PopUpDitherColor;
|
||||
i=PopUpColorDither;
|
||||
if (i>=0) color=i;
|
||||
goto bm_menu;
|
||||
|
||||
@@ -224,8 +301,8 @@ bm_menu:
|
||||
|
||||
case GEBM_SNAP:
|
||||
PopUpSnap(&Fs->snap);
|
||||
new_snap=Fs->snap.x;
|
||||
new_ip_scaler=Fs->snap.dx;
|
||||
ip_snap=Fs->snap.x;
|
||||
ip_scaler=Fs->snap.dx;
|
||||
goto bm_menu;
|
||||
|
||||
case GEBM_UNDO:
|
||||
@@ -247,7 +324,7 @@ bm_menu:
|
||||
case GEBM_FLOOD_FILL_NOT:
|
||||
case GEBM_POLYPT:
|
||||
case GEBM_POLYLINE:
|
||||
case GEBM_CUT:
|
||||
case GEBM_COPY:
|
||||
case GEBM_DELETE:
|
||||
case GEBM_PASTE:
|
||||
case GEBM_PASTE_TRANSPARENT:
|
||||
@@ -285,7 +362,7 @@ bm_menu:
|
||||
case GEBM_ARROW:
|
||||
case GEBM_RECT:
|
||||
case GEBM_CIRCLE:
|
||||
case GEBM_CUT:
|
||||
case GEBM_COPY:
|
||||
case GEBM_DELETE:
|
||||
if (down)
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -306,9 +383,9 @@ bm_menu:
|
||||
case GEBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GEBM_CUT:
|
||||
case GEBM_COPY:
|
||||
case GEBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrLineRect4(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
@@ -410,7 +487,7 @@ bm_menu:
|
||||
GrRect(dc,x11,y11,x22-x11+1,y22-y11+1);
|
||||
}
|
||||
break;
|
||||
case GEBM_CUT:
|
||||
case GEBM_COPY:
|
||||
case GEBM_DELETE:
|
||||
if (down) {
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -428,7 +505,7 @@ bm_menu:
|
||||
y11=p2;
|
||||
y22=y1;
|
||||
}
|
||||
dc->color=ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK;
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrLineRect4(dc,x11,y11,x22,y22);
|
||||
}
|
||||
@@ -521,7 +598,7 @@ bm_menu:
|
||||
down=FALSE;
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GEBM_CUT:
|
||||
case GEBM_COPY:
|
||||
case GEBM_DELETE:
|
||||
if (x1<p1) {
|
||||
x11=x1;
|
||||
@@ -595,8 +672,9 @@ bm_done:
|
||||
Free(st);
|
||||
DCFill(dc);
|
||||
SettingsPop;
|
||||
if (_import_snap) *_import_snap=new_snap;
|
||||
if (_import_ip_scaler) *_import_ip_scaler=new_ip_scaler;
|
||||
doc_e->flags1=old_e_flags1;
|
||||
if (_ip_snap) *_ip_snap=ip_snap;
|
||||
if (_ip_scaler) *_ip_scaler=ip_scaler;
|
||||
*_img=img;
|
||||
*_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
|
||||
return result;
|
||||
|
||||
+315
-266
@@ -1,5 +1,92 @@
|
||||
#help_index "Graphics/CSprite"
|
||||
|
||||
#define CSPRITE_WIF (WIF_ALL-WIF_BORDER-WIF_GRAB_SCROLL)
|
||||
|
||||
U8 GrSpOffset[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
Bool GrPolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
{
|
||||
CSprite *tempg=CAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
QueIns(tempg,root->last);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CSprite *GrNum2Que(CSprite *root,I64 num,I64 *x=NULL,I64 *y=NULL)
|
||||
{
|
||||
I64 xx=0,yy=0;
|
||||
CSprite *result=root->next;
|
||||
while (result!=root && num--) {
|
||||
if (result->type==GRST_SHIFT) {
|
||||
xx+=result->x1;
|
||||
yy+=result->y1;
|
||||
}
|
||||
result=result->next;
|
||||
}
|
||||
if (x) *x=xx;
|
||||
if (y) *y=yy;
|
||||
return result;
|
||||
}
|
||||
|
||||
CSprite *Sprite2Que(U8 *elems)
|
||||
{
|
||||
I64 s;
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
||||
*tempg=elems-offset(CSprite.start),
|
||||
*tempg1;
|
||||
result->next=result->last=result;
|
||||
while (tempg->type) {
|
||||
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
||||
s=SpriteElemSize(tempg);
|
||||
MemCpy(&tempg1->start,&tempg->start,s);
|
||||
QueIns(tempg1,result->last);
|
||||
tempg(U8 *)+=s;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 SpriteCntQue(CSprite *root)
|
||||
{
|
||||
CSprite *tempg=root->next;
|
||||
I64 result=0;
|
||||
while (tempg->type) {
|
||||
result++;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 GrEdUpdate(CDoc *doc,CDocBin *tempb,CSprite *root)
|
||||
{
|
||||
I64 i,size=gr_sprite_base_size[GRST_END];
|
||||
CSprite *tempg=root->next;
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
|
||||
while (tempg!=root) {
|
||||
size+=SpriteElemSize(tempg);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
|
||||
Free(tempb->data);
|
||||
tempb->data=dst=MAlloc(size);
|
||||
tempb->size=size;
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
i=SpriteElemSize(tempg);
|
||||
MemCpy(dst,&tempg->start,i);
|
||||
dst+=i;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
*dst=GRST_END;
|
||||
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
U0 GrSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
{
|
||||
I64 i;
|
||||
@@ -24,7 +111,7 @@ U0 GrSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
break;
|
||||
case GRST_BITMAP8:
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
@@ -117,7 +204,7 @@ CSprite *GrTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tempg->width<<16,y_radius=tempg->height<<16;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[tempg->type]);
|
||||
tempg1->type=tempg->type;
|
||||
if (tempg->type==GRST_REG_POLY)
|
||||
if (tempg->type==GRST_POLYGON)
|
||||
tempg1->sides=tempg->sides;
|
||||
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
@@ -351,7 +438,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
tempg1=GrTransformEllipse(r,tempg);
|
||||
QueIns(tempg1,tempg);
|
||||
QueRem(tempg);
|
||||
@@ -449,7 +536,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->z1=z;
|
||||
p=(&tempg->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
@@ -473,7 +560,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
}
|
||||
}
|
||||
|
||||
CSprite *SpriteDoc2Que(CDoc *doc,CSprite *root,I64 *cur_num)
|
||||
CSprite *SpriteDoc2Que(CDoc *doc,CSprite *root,I64 *_cur_num)
|
||||
{
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),*tempg;
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
@@ -485,8 +572,8 @@ CSprite *SpriteDoc2Que(CDoc *doc,CSprite *root,I64 *cur_num)
|
||||
tempg=GrNum2Que(root,doc_e->left_exp);
|
||||
if (tempg!=root) {
|
||||
tempg=MAllocIdentical(tempg);
|
||||
if (*cur_num==doc_e->left_exp) {
|
||||
*cur_num=num;
|
||||
if (*_cur_num==doc_e->left_exp) {
|
||||
*_cur_num=num;
|
||||
found=TRUE;
|
||||
}
|
||||
QueIns(tempg,result->last);
|
||||
@@ -496,7 +583,7 @@ CSprite *SpriteDoc2Que(CDoc *doc,CSprite *root,I64 *cur_num)
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (!found)
|
||||
*cur_num=num;
|
||||
*_cur_num=num;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
return result;
|
||||
@@ -509,24 +596,27 @@ U0 PickSpriteDocNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||
I64 cur_num=0;
|
||||
U8 *st;
|
||||
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteSideBar.TXT.Z\"$$\n\n");
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
st=Sprite2Text(tempg);
|
||||
if (cur_num==old_num) {
|
||||
DocPutS(doc,"$$FM,LTRED$$");
|
||||
DocPutS(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
} else {
|
||||
DocPutS(doc,"$$FM,LTBLUE$$");
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
}
|
||||
Free(st);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (cur_num==old_num) {
|
||||
DocPutS(doc,"$$FM,LTRED$$");
|
||||
DocPutS(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
} else {
|
||||
DocPutS(doc,"$$FM,LTBLUE$$");
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
}
|
||||
if (doc_e)
|
||||
@@ -549,24 +639,24 @@ U0 SpriteSideBarTask2(CTask *grand_parent)
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *cur_num)
|
||||
U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *_cur_num)
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocCur;
|
||||
Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",Fs);
|
||||
CDoc *doc=DocPut;
|
||||
Spawn(&SpriteSideBarTask2,parent,"CSpriteTask",,Fs);
|
||||
doc->flags|=DOCF_MIN_SIZE|DOCF_FORM;
|
||||
while (TRUE) {
|
||||
PickSpriteDocNew(doc,*_root,*cur_num);
|
||||
PickSpriteDocNew(doc,*_root,*_cur_num);
|
||||
View;
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL)
|
||||
*cur_num=doc_e->left_exp;
|
||||
*_root=SpriteDoc2Que(doc,*_root,cur_num);
|
||||
*_cur_num=doc_e->left_exp;
|
||||
*_root=SpriteDoc2Que(doc,*_root,_cur_num);
|
||||
DocClear(doc);
|
||||
}
|
||||
}
|
||||
|
||||
U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *cur_num,CTask *mem_task=NULL)
|
||||
U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *_cur_num,CTask *mem_task=NULL)
|
||||
{
|
||||
I64 num=0,size=gr_sprite_base_size[GRST_END];
|
||||
U8 *result,*dst;
|
||||
@@ -577,13 +667,13 @@ U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *cur_num,CTask *mem_task=NULL)
|
||||
size+=doc_e->len;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
*cur_num=0;
|
||||
*_cur_num=0;
|
||||
dst=result=MAlloc(size,mem_task);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_HEX_ED) {
|
||||
if (doc_e==doc->cur_entry)
|
||||
*cur_num=num;
|
||||
*_cur_num=num;
|
||||
MemCpy(dst,doc_e->data,doc_e->len);
|
||||
dst+=doc_e->len;
|
||||
num++;
|
||||
@@ -596,7 +686,7 @@ U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *cur_num,CTask *mem_task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
Bool SpriteTextEd(CSprite **_root,I64 *cur_num)
|
||||
Bool SpriteTextEd(CSprite **_root,I64 *_cur_num)
|
||||
{
|
||||
Bool result;
|
||||
U8 *st;
|
||||
@@ -604,6 +694,8 @@ Bool SpriteTextEd(CSprite **_root,I64 *cur_num)
|
||||
CSprite *root=*_root,*tempg;
|
||||
CDocEntry *doc_e;
|
||||
doc->flags|=DOCF_FORM;
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit as Text\"$$$$FG$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteEdText.TXT.Z\"$$\n\n");
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
st=Sprite2Text(tempg);
|
||||
@@ -613,8 +705,8 @@ Bool SpriteTextEd(CSprite **_root,I64 *cur_num)
|
||||
doc_e->data=&tempg->start;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (result=ServantUser("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
tempg=SpriteHexDoc2Sprite(doc,cur_num);
|
||||
if (result=SrvUser("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
tempg=SpriteHexDoc2Sprite(doc,_cur_num);
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
root=Sprite2Que(tempg);
|
||||
@@ -631,29 +723,30 @@ Bool SpriteTextEd(CSprite **_root,I64 *cur_num)
|
||||
#define GED_SHIFT_RECTS 4
|
||||
#define GED_TRANSFORM 5
|
||||
#define GED_SHIFT_SUB_ORIGIN 6
|
||||
#define GED_VECT 7
|
||||
#define GED_MAIN_MENU 7
|
||||
#define GED_INS_CLIPBOARD 8
|
||||
#define GED_DELETE 9
|
||||
#define GED_ED 10
|
||||
#define GED_TEXT_ED 10
|
||||
#define GED_SNAP 11
|
||||
#define GED_END 12
|
||||
#define GED_EXIT 12
|
||||
|
||||
U0 GrInit2()
|
||||
{
|
||||
DefineLstLoad("ST_CSPRITE_ED_MENU"," \0Pick Graphically\0Set Origin\0"
|
||||
"Shift Origin\0Shift Points\0Shift Rects\0Transform\0Shift SubOrigin\0Insert Object\0"
|
||||
"Insert Clipboard\0Delete Object\0Edit\0Snap\0");
|
||||
DefineLstLoad("ST_SPRITE_ED_MENU","Pick Graphically\0Set Origin\0"
|
||||
"Shift Origin\0Shift Points\0Shift Rects\0Transform\0Shift SubOrigin\0Main Menu\0"
|
||||
"Insert Clipboard\0Delete Object\0Edit as Text\0Snap\0");
|
||||
}
|
||||
GrInit2;
|
||||
|
||||
I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *cur_num)
|
||||
I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
{
|
||||
U8 *st;
|
||||
CTask *pu_task;
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Edit Menu\"$$$$FG$$\n"
|
||||
"$$MU-UL,\"Shift Points\",GED_SHIFT_PTS$$\n"
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteEd.TXT.Z\"$$\n\n"
|
||||
"$$FG,LTBLUE$$$$MU-UL,\"Shift Points\",GED_SHIFT_PTS$$\n"
|
||||
"$$MU-UL,\"Shift Points with Rects\",GED_SHIFT_RECTS$$\n"
|
||||
"$$MU-UL,\"Shift Origin\",GED_SHIFT_ORIGIN$$\n"
|
||||
"$$MU-UL,\"Set Origin\",GED_SET_ORIGIN$$\n"
|
||||
@@ -662,17 +755,17 @@ I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *cur_num)
|
||||
"$$MU-UL,\"Pick or Delete Objects Graphically\",GED_PICK_GRAPHICALLY$$\n"
|
||||
"$$MU-UL,\"Transform\",GED_TRANSFORM$$\n"
|
||||
"$$MU-UL,\"Delete\",GED_DELETE$$\n"
|
||||
"$$MU-UL,\"Edit as Text\",GED_ED$$\n"
|
||||
"\n$$FM,PURPLE$$$$MU-UL,\"+] Vect Object Menu\",GED_VECT$$$$FM,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Insert Clipboard CSprite's\",GED_INS_CLIPBOARD$$\n"
|
||||
"\n$$MU-UL,\"End\",GED_END$$\n"
|
||||
"$$MU-UL,\"Cancel\",DOCM_CANCEL$$",snap,ip_scaler);
|
||||
st=MSPrintF("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,cur_num);
|
||||
"$$MU-UL,\"Edit as Text\",GED_TEXT_ED$$\n"
|
||||
"$$MU-UL,\"Insert Clipboard Sprite's\",GED_INS_CLIPBOARD$$\n"
|
||||
"\n$$FG,PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",GED_MAIN_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GED_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$",snap,ip_scaler);
|
||||
st=MSPrintF("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
i=PopUpMenu(doc);
|
||||
if (TaskValidate(pu_task)) {
|
||||
*_root=SpriteDoc2Que(DocCur(pu_task),*_root,cur_num);
|
||||
*_root=SpriteDoc2Que(DocPut(pu_task),*_root,_cur_num);
|
||||
Kill(pu_task);
|
||||
}
|
||||
DocDel(doc);
|
||||
@@ -693,7 +786,7 @@ class CSpritePt
|
||||
|
||||
U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
{
|
||||
I64 i,cur_num=0;
|
||||
I64 i,num=0;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSpritePt *temppe;
|
||||
@@ -712,7 +805,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case GRST_TEXT:
|
||||
case GRST_TEXT_BOX:
|
||||
@@ -727,7 +820,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case GRST_SHIFT:
|
||||
@@ -735,7 +828,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
y+=tempg->y1;
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe->type=GESPT_WIDTH_HEIGHT;
|
||||
temppe->xx=x;
|
||||
@@ -744,7 +837,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->w=&tempg->width;
|
||||
temppe->h=&tempg->height;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case GRST_BITMAP8:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
@@ -753,7 +846,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case GRST_POLYLINE:
|
||||
@@ -765,7 +858,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->yy=y;
|
||||
temppe->x=&ptr[i<<1];
|
||||
temppe->y=&ptr[i<<1+1];
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
}
|
||||
break;
|
||||
@@ -777,7 +870,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->yy=y;
|
||||
temppe->x=&ptr[0];
|
||||
temppe->y=&ptr[1];
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case GRST_BSPLINE2:
|
||||
@@ -793,7 +886,7 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->x=&p[i].x;
|
||||
temppe->y=&p[i].y;
|
||||
temppe->z=&p[i].z;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
}
|
||||
break;
|
||||
@@ -807,12 +900,12 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->z=&tempg->z1;
|
||||
temppe->num=cur_num;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
}
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
cur_num++;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,10 +1002,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_num,I64 mode)
|
||||
xx2=xx=p1; yy2=yy=p2;
|
||||
while (TRUE) {
|
||||
GESPCtrlPtsDraw(dc,&root);
|
||||
if (Blink)
|
||||
dc->color=ROPF_DITHER+RED<<16+WHITE;
|
||||
else
|
||||
dc->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
dc->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
GrLineRect4(dc,xx,yy,xx2,yy2);
|
||||
if (msg_code=ScanMsg(&p1,&p2,1<<MSG_IP_MOVE|1<<MSG_IP_L_UP)) {
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
@@ -993,227 +1083,186 @@ gs_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 EdExistingGraphic(CDoc *doc,I64 x,I64 y,I64 *_import_snap=NULL,F64 *_import_ip_scaler=NULL)
|
||||
I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_num,I64 *_ip_snap,F64 *_ip_scaler)
|
||||
{
|
||||
CDocEntry *doc_e,*doc_ce;
|
||||
CDocEntry *doc_e2;
|
||||
CDocBin *tempb;
|
||||
Bool unlock=DocLock(doc),unlock2,del_down;
|
||||
I64 i,r[16],cur_num=0,msg_code,p1,p2,old_size,xx,yy,new_snap=1,
|
||||
old_doc_flags=doc->flags&(DOCF_ATTR_BY_PRT|DOCF_ATTR_BY_FILENAME),
|
||||
old_ce_flags1;
|
||||
F64 new_ip_scaler=1.0;
|
||||
CSprite *cur_elem,*old_CSprite,
|
||||
*root,*root2,*next,*last,*tempg,*insert_pt;
|
||||
Fs->task_title[TASK_TITLE_LEN]=0;
|
||||
U8 *old_desc=StrNew(Fs->task_title),
|
||||
*old_filename=StrNew(doc->filename.name);
|
||||
Bool unlock,del_down;
|
||||
I64 i,r[16],msg_code,p1,p2,xx,yy,ip_snap=1,
|
||||
old_e_flags1;
|
||||
F64 ip_scaler=1.0;
|
||||
CSprite *cur_elem,*root2,*next,*last,*tempg,*insert_pt;
|
||||
|
||||
WinMgrSync(2,TRUE);
|
||||
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
|
||||
WordStat;
|
||||
if (_import_snap) new_snap=*_import_snap;
|
||||
if (_import_ip_scaler) new_ip_scaler=*_import_ip_scaler;
|
||||
SetSnap(&Fs->snap,new_snap,new_ip_scaler);
|
||||
Fs->win_inhibit=CSPRITE_WIF;
|
||||
doc_ce=doc->cur_entry;
|
||||
old_ce_flags1=doc_ce->flags1;
|
||||
tempb=doc_ce->bin_data;
|
||||
old_size=tempb->size;
|
||||
old_CSprite=tempb->data;
|
||||
root=Sprite2Que(old_CSprite);
|
||||
|
||||
cur_num=SpriteCntQue(root);
|
||||
tempb->data=MAllocIdentical(old_CSprite);
|
||||
if (_ip_snap) ip_snap=*_ip_snap;
|
||||
if (_ip_scaler) ip_scaler=*_ip_scaler;
|
||||
SetSnap(&Fs->snap,ip_snap,ip_scaler);
|
||||
old_e_flags1=doc_e->flags1;
|
||||
tempb=doc_e->bin_data;
|
||||
DocUnlock(doc);
|
||||
do {
|
||||
StrCpy(Fs->task_title,old_desc);
|
||||
StrCpy(doc->filename.name,old_filename);
|
||||
doc->flags|=old_doc_flags;
|
||||
doc_ce->flags1|=DOCEF1_DONT_DRAW;
|
||||
i=PopUpSpriteEd(&root,new_snap,new_ip_scaler,&cur_num);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
if (i>=0) {
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_CSPRITE_ED_MENU"));
|
||||
StrCpy(doc->filename.name,Fs->task_title);
|
||||
doc->flags&=~(DOCF_ATTR_BY_PRT|DOCF_ATTR_BY_FILENAME);
|
||||
}
|
||||
switch (i) {
|
||||
case GED_PICK_GRAPHICALLY:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PICK_GRAPHICALLY,
|
||||
"You can delete elements by\n"
|
||||
"holding $$FG,GREEN$$Delete$$FG$$ and clicking.\n");
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
del_down=FALSE;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP);
|
||||
if (p2.u8[0]==SC_DELETE&& !(p2&SCF_IP_L_DOWN)) {
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
del_down=TRUE;
|
||||
else if (msg_code==MSG_KEY_UP)
|
||||
del_down=FALSE;
|
||||
}
|
||||
if (msg_code==MSG_IP_L_UP && sys_cur_scan_code&SCF_DELETE ||
|
||||
msg_code==MSG_KEY_DOWN && p2&SCF_IP_L_DOWN && p2.u8[0]==SC_DELETE) {
|
||||
cur_num=doc->cur_sprite_elem_num;
|
||||
cur_elem=GrNum2Que(root,cur_num);
|
||||
if (cur_elem!=root) {
|
||||
QueRem(cur_elem);
|
||||
Free(cur_elem);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
if (win_actual_refresh<10)
|
||||
doc_e->flags1|=DOCEF1_DONT_DRAW;
|
||||
StrCpy(Fs->task_title,"Sprite Edit Menu");
|
||||
i=PopUpSpriteEd(_root,ip_snap,ip_scaler,_cur_num);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
if (0<=i<GED_EXIT) {
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_ED_MENU"));
|
||||
switch (i) {
|
||||
case GED_PICK_GRAPHICALLY:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PICK_GRAPHICALLY,
|
||||
"You can delete elements by\n"
|
||||
"holding $$FG,GREEN$$Delete$$FG$$ and clicking.\n");
|
||||
doc_e->flags1=old_e_flags1;
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
del_down=FALSE;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_UP|1<<MSG_IP_R_UP|1<<MSG_KEY_DOWN|1<<MSG_KEY_UP);
|
||||
if (p2.u8[0]==SC_DELETE&& !(p2&SCF_IP_L_DOWN)) {
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
del_down=TRUE;
|
||||
else if (msg_code==MSG_KEY_UP)
|
||||
del_down=FALSE;
|
||||
}
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
}
|
||||
} while (del_down || msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
cur_num=doc->cur_sprite_elem_num;
|
||||
doc->cur_sprite=NULL;
|
||||
break;
|
||||
case GED_SNAP:
|
||||
PopUpSnap(&Fs->snap);
|
||||
new_snap=Fs->snap.x;
|
||||
new_ip_scaler=Fs->snap.dx;
|
||||
break;
|
||||
case GED_SET_ORIGIN:
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
GrSetOrigin(root,x-p1,y-p2,0);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
break;
|
||||
case GED_SHIFT_ORIGIN:
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN);
|
||||
xx=p1; yy=p2;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrSetOrigin(root,p1-xx,p2-yy,0);
|
||||
xx=p1; yy=p2;
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
break;
|
||||
case GED_SHIFT_PTS:
|
||||
case GED_SHIFT_RECTS:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PTS_RECTANGLES,
|
||||
"You can switch between points\n"
|
||||
"and rectangles with '$$FG,GREEN$$p$$FG$$' and '$$FG,GREEN$$r$$FG$$'.\n"
|
||||
"Press '$$FG,GREEN$$r$$FG$$' after one rectangle\n"
|
||||
"to OR another rectangle.\n");
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
if (SpriteShiftPts(tempb->data,x,y,&cur_num,i)) {
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
root=Sprite2Que(tempb->data);
|
||||
} else
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
break;
|
||||
case GED_TRANSFORM:
|
||||
if (PopUpTransform(r)) {
|
||||
SpriteTransform(r,root);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
}
|
||||
break;
|
||||
case GED_SHIFT_SUB_ORIGIN:
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
insert_pt=GrNum2Que(root,cur_num);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_SHIFT]);
|
||||
tempg->type=GRST_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN);
|
||||
xx=p1; yy=p2;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
tempg->x1=p1-xx;
|
||||
tempg->y1=p2-yy;
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
cur_num++;
|
||||
break;
|
||||
case GED_INS_CLIPBOARD:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_INS_CLIPBOARD,
|
||||
"You will probably want to shift around\n"
|
||||
"the location of element groups. Use\n"
|
||||
"'Insert shift sub-origin' after picking the\n"
|
||||
"element to insert before. Or,\n"
|
||||
"use 'shift points'.\n");
|
||||
insert_pt=GrNum2Que(root,cur_num);
|
||||
unlock2=DocLock(sys_clipboard_doc);
|
||||
doc_e=sys_clipboard_doc->root.next;
|
||||
while (doc_e!=sys_clipboard_doc) {
|
||||
if (doc_e->type_u8==DOCT_SPRITE) {
|
||||
root2=Sprite2Que(doc_e->bin_data->data);
|
||||
if (root2->next!=root2) {
|
||||
tempg=root2->next;
|
||||
while (tempg!=root2) {
|
||||
cur_num++;
|
||||
tempg=tempg->next;
|
||||
if (msg_code==MSG_IP_L_UP && sys_cur_scan_code&SCF_DELETE ||
|
||||
msg_code==MSG_KEY_DOWN && p2&SCF_IP_L_DOWN && p2.u8[0]==SC_DELETE) {
|
||||
*_cur_num=doc->cur_sprite_elem_num;
|
||||
cur_elem=GrNum2Que(*_root,*_cur_num);
|
||||
if (cur_elem!=*_root) {
|
||||
QueRem(cur_elem);
|
||||
Free(cur_elem);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
}
|
||||
next=root2->next;
|
||||
last=root2->last;
|
||||
insert_pt->last->next=next;
|
||||
next->last=insert_pt->last;
|
||||
insert_pt->last=last;
|
||||
last->next=insert_pt;
|
||||
doc->cur_sprite=tempb->data;
|
||||
doc->cur_sprite_elem_num=0;
|
||||
if (msg_code==MSG_KEY_DOWN)
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
}
|
||||
Free(root2);
|
||||
} while (del_down || msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
*_cur_num=doc->cur_sprite_elem_num;
|
||||
doc->cur_sprite=NULL;
|
||||
break;
|
||||
case GED_SNAP:
|
||||
PopUpSnap(&Fs->snap);
|
||||
ip_snap=Fs->snap.x;
|
||||
ip_scaler=Fs->snap.dx;
|
||||
break;
|
||||
case GED_SET_ORIGIN:
|
||||
doc_e->flags1=old_e_flags1;
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
GrSetOrigin(*_root,x-p1,y-p2,0);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
break;
|
||||
case GED_SHIFT_ORIGIN:
|
||||
doc_e->flags1=old_e_flags1;
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN);
|
||||
xx=p1; yy=p2;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrSetOrigin(*_root,p1-xx,p2-yy,0);
|
||||
xx=p1; yy=p2;
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
break;
|
||||
case GED_SHIFT_PTS:
|
||||
case GED_SHIFT_RECTS:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_PTS_RECTANGLES,
|
||||
"You can switch between points\n"
|
||||
"and rectangles with '$$FG,GREEN$$p$$FG$$' and '$$FG,GREEN$$r$$FG$$'.\n"
|
||||
"Press '$$FG,GREEN$$r$$FG$$' after one rectangle\n"
|
||||
"to OR another rectangle.\n");
|
||||
doc_e->flags1=old_e_flags1;
|
||||
if (SpriteShiftPts(tempb->data,x,y,_cur_num,i)) {
|
||||
QueDel(*_root);
|
||||
Free(*_root);
|
||||
*_root=Sprite2Que(tempb->data);
|
||||
} else
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
break;
|
||||
case GED_TRANSFORM:
|
||||
if (PopUpTransform(r)) {
|
||||
SpriteTransform(r,*_root);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (unlock2)
|
||||
DocUnlock(sys_clipboard_doc);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
break;
|
||||
case GED_VECT:
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
switch (SpriteVect(doc,doc_ce,&root,&cur_num,x,y,FALSE,&new_snap,&new_ip_scaler)) {
|
||||
case GE_OKAY_DONE:
|
||||
i=GED_END;
|
||||
break;
|
||||
case GE_CANCEL:
|
||||
i=DOCM_CANCEL;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GED_DELETE:
|
||||
cur_elem=GrNum2Que(root,cur_num);
|
||||
if (cur_elem!=root) {
|
||||
QueRem(cur_elem);
|
||||
Free(cur_elem);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
}
|
||||
break;
|
||||
case GED_ED:
|
||||
if (SpriteTextEd(&root,&cur_num))
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
break;
|
||||
break;
|
||||
case GED_SHIFT_SUB_ORIGIN:
|
||||
doc_e->flags1=old_e_flags1;
|
||||
insert_pt=GrNum2Que(*_root,*_cur_num);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_SHIFT]);
|
||||
tempg->type=GRST_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GetMsg(&p1,&p2,1<<MSG_IP_L_DOWN);
|
||||
xx=p1; yy=p2;
|
||||
do {
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
tempg->x1=p1-xx;
|
||||
tempg->y1=p2-yy;
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
*_cur_num+=1;
|
||||
break;
|
||||
case GED_INS_CLIPBOARD:
|
||||
AcctOneTimePopUp(ARf_CSPRITE_INS_CLIPBOARD,
|
||||
"You will probably want to shift around\n"
|
||||
"the location of element groups. Use\n"
|
||||
"'Insert shift sub-origin' after picking the\n"
|
||||
"element to insert before. Or,\n"
|
||||
"use 'shift points'.\n");
|
||||
insert_pt=GrNum2Que(*_root,*_cur_num);
|
||||
unlock=DocLock(sys_clipboard_doc);
|
||||
doc_e2=sys_clipboard_doc->root.next;
|
||||
while (doc_e2!=sys_clipboard_doc) {
|
||||
if (doc_e2->type_u8==DOCT_SPRITE) {
|
||||
root2=Sprite2Que(doc_e2->bin_data->data);
|
||||
if (root2->next!=root2) {
|
||||
tempg=root2->next;
|
||||
while (tempg!=root2) {
|
||||
*_cur_num+=1;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
next=root2->next;
|
||||
last=root2->last;
|
||||
insert_pt->last->next=next;
|
||||
next->last=insert_pt->last;
|
||||
insert_pt->last=last;
|
||||
last->next=insert_pt;
|
||||
}
|
||||
Free(root2);
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(sys_clipboard_doc);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
break;
|
||||
case GED_DELETE:
|
||||
cur_elem=GrNum2Que(*_root,*_cur_num);
|
||||
if (cur_elem!=*_root) {
|
||||
QueRem(cur_elem);
|
||||
Free(cur_elem);
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
}
|
||||
break;
|
||||
case GED_TEXT_ED:
|
||||
if (SpriteTextEd(_root,_cur_num))
|
||||
GrEdUpdate(doc,tempb,*_root);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (i!=DOCM_CANCEL && i!=GED_END);
|
||||
doc_ce->flags1=old_ce_flags1;
|
||||
DocLock(doc);
|
||||
if (i==GED_END)
|
||||
Free(old_CSprite);
|
||||
else {
|
||||
Free(tempb->data);
|
||||
tempb->data=old_CSprite;
|
||||
tempb->size=old_size;
|
||||
} while (i!=DOCM_CANCEL && i!=GED_EXIT && i!=GED_MAIN_MENU);
|
||||
doc_e->flags1=old_e_flags1;
|
||||
|
||||
if (_ip_snap) *_ip_snap=ip_snap;
|
||||
if (_ip_scaler) *_ip_scaler=ip_scaler;
|
||||
switch (i) {
|
||||
case DOCM_CANCEL: return GE_ABORT;
|
||||
case GED_EXIT: return GE_EXIT;
|
||||
case GED_MAIN_MENU: return GE_CONT;
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
if (_import_snap) *_import_snap=new_snap;
|
||||
if (_import_ip_scaler) *_import_ip_scaler=new_ip_scaler;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
StrCpy(Fs->task_title,old_desc);
|
||||
Free(old_desc);
|
||||
StrCpy(doc->filename.name,old_filename);
|
||||
Free(old_filename);
|
||||
SettingsPop;
|
||||
doc->flags|=old_doc_flags;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -28,7 +28,7 @@ class CGrMTri
|
||||
CMeshTri mt;
|
||||
U0 end;
|
||||
|
||||
I32 cpu_num,flags; //Draw different triangles with different cores.
|
||||
I32 cpu_num,flags; //Draw different tris with different cores.
|
||||
CGrMVertex *t[3];
|
||||
};
|
||||
|
||||
@@ -40,13 +40,13 @@ class CGrMFrame
|
||||
I64 mode,cx,cy;
|
||||
CColorROPU32 cur_color;
|
||||
Bool grid_on,flip_y,select_rect,vertex_on,pad[4];
|
||||
I64 mp_done_flags; //Used for multiprocessing signaling.
|
||||
I64 mp_not_done_flags; //Used for multiprocessing signaling.
|
||||
F64 view_scale;
|
||||
CDC *dc;
|
||||
I64 *w2s,*s2w; //Screen-to-world and world-to-screen transform matrices.
|
||||
I64 vertex_cnt,triangle_cnt; //Set by GrMSize
|
||||
I64 vertex_cnt,tri_cnt; //Set by GrMSize
|
||||
CGrMVertex vertex_root,*cur_vertex;
|
||||
CGrMTri triangle_root,*cur_triangle;
|
||||
CGrMTri tri_root,*cur_tri;
|
||||
I64 x1,y1,x2,y2,cur_snap;
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ CGrMTri *GrMTriNew(CGrMFrame *e,CColorROPU32 color,CGrMVertex *v1,CGrMVertex *v2
|
||||
tempt->t[0]=v1;
|
||||
tempt->t[1]=v2;
|
||||
tempt->t[2]=v3;
|
||||
QueIns(tempt,e->triangle_root.last);
|
||||
QueIns(tempt,e->tri_root.last);
|
||||
return tempt;
|
||||
}
|
||||
|
||||
@@ -103,11 +103,11 @@ CGrMVertex *GrMVertexFindNum(CGrMFrame *e,I64 num)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 GrMTriangleDel(CGrMFrame *e,CGrMTri *tempt)
|
||||
U0 GrMTriDel(CGrMFrame *e,CGrMTri *tempt)
|
||||
{
|
||||
if (tempt) {
|
||||
if (tempt==e->cur_triangle)
|
||||
e->cur_triangle=NULL;
|
||||
if (tempt==e->cur_tri)
|
||||
e->cur_tri=NULL;
|
||||
QueRem(tempt);
|
||||
Free(tempt);
|
||||
}
|
||||
@@ -118,14 +118,14 @@ U0 GrMVertexDel(CGrMFrame *e,CGrMVertex *tempv)
|
||||
I64 i;
|
||||
CGrMTri *tempt,*tempt1;
|
||||
if (tempv) {
|
||||
tempt=e->triangle_root.next;
|
||||
while (tempt!=&e->triangle_root) {
|
||||
tempt=e->tri_root.next;
|
||||
while (tempt!=&e->tri_root) {
|
||||
tempt1=tempt->next;
|
||||
for (i=0;i<3;i++)
|
||||
if (tempt->t[i]==tempv)
|
||||
break;
|
||||
if (i<3)
|
||||
GrMTriangleDel(e,tempt);
|
||||
GrMTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
}
|
||||
if (tempv==e->cur_vertex)
|
||||
@@ -147,10 +147,10 @@ U0 GrMVertexSelectAll(CGrMFrame *e,Bool val)
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrMTriangleSelectAll(CGrMFrame *e,Bool val)
|
||||
U0 GrMTriSelectAll(CGrMFrame *e,Bool val)
|
||||
{
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
while (tempt!=&e->triangle_root) {
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (val)
|
||||
tempt->flags|=TF_SELECTED;
|
||||
else
|
||||
@@ -213,12 +213,12 @@ U0 GrMVertexSelectRect(CGrMFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrMTriangleSelectRect(CGrMFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
U0 GrMTriSelectRect(CGrMFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
||||
{
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
if (x1>x2) SwapU64(&x1,&x2);
|
||||
if (y1>y2) SwapU64(&y1,&y2);
|
||||
while (tempt!=&e->triangle_root) {
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (x1<=tempt->t[0]->pt.x<=x2 &&
|
||||
y1<=tempt->t[0]->pt.y<=y2 &&
|
||||
x1<=tempt->t[1]->pt.x<=x2 &&
|
||||
@@ -250,13 +250,13 @@ I64 GrMSelectCnt(CGrMFrame *e)
|
||||
{
|
||||
I64 result=0;
|
||||
CGrMVertex *tempv=e->vertex_root.next;
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (tempv->flags&VF_SELECTED)
|
||||
result++;
|
||||
tempv=tempv->next;
|
||||
}
|
||||
while (tempt!=&e->triangle_root) {
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags&TF_SELECTED)
|
||||
result++;
|
||||
tempt=tempt->next;
|
||||
@@ -324,22 +324,22 @@ U0 GrMTransformSelect(CGrMFrame *e)
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrMFlipTriangles(CGrMFrame *e)
|
||||
U0 GrMFlipTris(CGrMFrame *e)
|
||||
{
|
||||
Bool unselect;
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
if (!GrMSelectCnt(e)) {
|
||||
GrMTriangleSelectAll(e,TRUE);
|
||||
GrMTriSelectAll(e,TRUE);
|
||||
unselect=TRUE;
|
||||
} else
|
||||
unselect=FALSE;
|
||||
while (tempt!=&e->triangle_root) {
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags & TF_SELECTED)
|
||||
SwapU64(&tempt->t[1],&tempt->t[2]);
|
||||
tempt=tempt->next;
|
||||
}
|
||||
if (unselect)
|
||||
GrMTriangleSelectAll(e,FALSE);
|
||||
GrMTriSelectAll(e,FALSE);
|
||||
}
|
||||
|
||||
U0 GrMRecalcCxCy(CTask *task,CGrMFrame *e)
|
||||
@@ -383,7 +383,7 @@ U0 MPDrawIt(CGrMFrame *e) //Multiprocessing draw it, called by each core.
|
||||
//Makes a copy of e->dc so we can change dc->color member and stuff.
|
||||
CDC *dc=DCAlias(e->dc,e->dc->win_task);
|
||||
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
I64 i,*old_r=dc->r;
|
||||
|
||||
//$LK,"DCAlias","MN:DCAlias"$() allocates a new identity rotation matrix.
|
||||
@@ -425,17 +425,17 @@ U0 MPDrawIt(CGrMFrame *e) //Multiprocessing draw it, called by each core.
|
||||
GrLine3(dc,0,0,-500,0,0,0);
|
||||
}
|
||||
|
||||
while (tempt!=&e->triangle_root) {
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->cpu_num==Gs->num) {
|
||||
if (tempt->flags & TF_SELECTED) {
|
||||
if (Blink)
|
||||
dc->color=ROPF_DITHER+WHITE<<16+RED;
|
||||
else
|
||||
dc->color=ROPF_DITHER+RED<<16+WHITE;
|
||||
GrFillTriangle0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
} else {
|
||||
(*dc->lighting)(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt,tempt->mt.color);
|
||||
GrFillTriangle0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
GrFillTri0(dc,&tempt->t[0]->pt,&tempt->t[1]->pt,&tempt->t[2]->pt);
|
||||
}
|
||||
}
|
||||
tempt=tempt->next;
|
||||
@@ -446,7 +446,7 @@ U0 MPDrawIt(CGrMFrame *e) //Multiprocessing draw it, called by each core.
|
||||
dc->depth_buf=NULL;
|
||||
|
||||
DCDel(dc);
|
||||
LBts(&e->mp_done_flags,Gs->num);
|
||||
LBtr(&e->mp_not_done_flags,Gs->num);
|
||||
}
|
||||
|
||||
I64 *GrMW2S(CGrMFrame *e,CTask *task)
|
||||
@@ -519,25 +519,25 @@ U0 GrMCursorW(CGrMFrame *e,CTask *task,I64 *_x,I64 *_y,I64 *_z)
|
||||
|
||||
|
||||
CGrMVertex sys_vertex_root;
|
||||
CGrMTri sys_triangle_root;
|
||||
CGrMTri sys_tri_root;
|
||||
|
||||
U0 GrMClipBoardInit()
|
||||
{
|
||||
QueInit(&sys_vertex_root);
|
||||
QueInit(&sys_triangle_root);
|
||||
QueInit(&sys_tri_root);
|
||||
}
|
||||
|
||||
U0 GrMClipBoardRst()
|
||||
{
|
||||
QueDel(&sys_vertex_root,TRUE);
|
||||
QueDel(&sys_triangle_root,TRUE);
|
||||
QueDel(&sys_tri_root,TRUE);
|
||||
GrMClipBoardInit;
|
||||
}
|
||||
|
||||
U0 GrMClipBoardCopy(CGrMFrame *e)
|
||||
{
|
||||
CGrMVertex *tempv=e->vertex_root.next,*tempv2;
|
||||
CGrMTri *tempt=e->triangle_root.next,*tempt2;
|
||||
CGrMTri *tempt=e->tri_root.next,*tempt2;
|
||||
|
||||
GrMClipBoardRst;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
@@ -553,7 +553,7 @@ U0 GrMClipBoardCopy(CGrMFrame *e)
|
||||
}
|
||||
tempv=tempv->next;
|
||||
}
|
||||
while (tempt!=&e->triangle_root) {
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags&TF_SELECTED &&
|
||||
tempt->t[0]->copy && tempt->t[1]->copy && tempt->t[2]->copy) {
|
||||
tempt2=ACAlloc(sizeof(CGrMTri));
|
||||
@@ -561,7 +561,7 @@ U0 GrMClipBoardCopy(CGrMFrame *e)
|
||||
tempt2->t[1]=tempt->t[1]->copy;
|
||||
tempt2->t[2]=tempt->t[2]->copy;
|
||||
tempt2->mt.color=tempt->mt.color;
|
||||
QueIns(tempt2,sys_triangle_root.last);
|
||||
QueIns(tempt2,sys_tri_root.last);
|
||||
tempt->flags|=TF_COPIED;
|
||||
tempt->flags&=~TF_SELECTED;
|
||||
} else
|
||||
@@ -573,47 +573,47 @@ U0 GrMClipBoardCopy(CGrMFrame *e)
|
||||
U0 GrMClipBoardCut(CGrMFrame *e)
|
||||
{
|
||||
CGrMVertex *tempv=e->vertex_root.next,*tempv1;
|
||||
CGrMTri *tempt=e->triangle_root.next,*tempt1;
|
||||
CGrMTri *tempt=e->tri_root.next,*tempt1;
|
||||
GrMClipBoardCopy(e);
|
||||
while (tempt!=&e->tri_root) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_COPIED)
|
||||
GrMTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
}
|
||||
while (tempv!=&e->vertex_root) {
|
||||
tempv1=tempv->next;
|
||||
if (tempv->flags&VF_COPIED)
|
||||
GrMVertexDel(e,tempv);
|
||||
tempv=tempv1;
|
||||
}
|
||||
while (tempt!=&e->triangle_root) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_COPIED)
|
||||
GrMTriangleDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrMClipBoardDel(CGrMFrame *e)
|
||||
{//Technically not clipboard
|
||||
CGrMVertex *tempv=e->vertex_root.next,*tempv1;
|
||||
CGrMTri *tempt=e->triangle_root.next,*tempt1;
|
||||
CGrMTri *tempt=e->tri_root.next,*tempt1;
|
||||
while (tempt!=&e->tri_root) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_SELECTED)
|
||||
GrMTriDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
}
|
||||
while (tempv!=&e->vertex_root) {
|
||||
tempv1=tempv->next;
|
||||
if (tempv->flags&VF_SELECTED)
|
||||
GrMVertexDel(e,tempv);
|
||||
tempv=tempv1;
|
||||
}
|
||||
while (tempt!=&e->triangle_root) {
|
||||
tempt1=tempt->next;
|
||||
if (tempt->flags&TF_SELECTED)
|
||||
GrMTriangleDel(e,tempt);
|
||||
tempt=tempt1;
|
||||
}
|
||||
}
|
||||
|
||||
U0 GrMClipBoardPaste(CGrMFrame *e)
|
||||
{
|
||||
CGrMVertex *tempv2=sys_vertex_root.next,*tempv;
|
||||
CGrMTri *tempt2=sys_triangle_root.next,*tempt;
|
||||
CGrMTri *tempt2=sys_tri_root.next,*tempt;
|
||||
|
||||
GrMVertexSelectAll(e,FALSE);
|
||||
GrMTriangleSelectAll(e,FALSE);
|
||||
GrMTriSelectAll(e,FALSE);
|
||||
while (tempv2!=&sys_vertex_root) {
|
||||
tempv2->copy=tempv=CAlloc(sizeof(CGrMVertex));
|
||||
MemCpy(&tempv->p,&tempv2->p,sizeof(CD3I32));
|
||||
@@ -622,7 +622,7 @@ U0 GrMClipBoardPaste(CGrMFrame *e)
|
||||
tempv2=tempv2->next;
|
||||
}
|
||||
|
||||
while (tempt2!=&sys_triangle_root) {
|
||||
while (tempt2!=&sys_tri_root) {
|
||||
tempt=GrMTriNew(e,tempt2->mt.color,tempt2->t[0]->copy,tempt2->t[1]->copy,tempt2->t[2]->copy);
|
||||
tempt->flags|=TF_SELECTED;
|
||||
tempt2=tempt2->next;
|
||||
@@ -679,11 +679,10 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
tempv=tempv->next;
|
||||
}
|
||||
|
||||
e->mp_done_flags=0; //Issue jobs to all cores.
|
||||
e->mp_not_done_flags=1<<mp_cnt-1; //Issue jobs to all cores.
|
||||
e->dc=dc;
|
||||
for (i=1;i<mp_cnt;i++)
|
||||
MPJob(&MPDrawIt,e,i);
|
||||
MPDrawIt(e); //Do one job ourself.
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
JobQue(&MPDrawIt,e,i);
|
||||
|
||||
tempv=e->vertex_root.next;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
@@ -743,7 +742,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
GrLineRect4(dc,e->x1,e->y1,e->x2,e->y2);
|
||||
}
|
||||
//Wait for all cores to complete.
|
||||
while (e->mp_done_flags!=1<<mp_cnt-1)
|
||||
while (e->mp_not_done_flags)
|
||||
Yield;
|
||||
}
|
||||
|
||||
@@ -752,7 +751,7 @@ U0 GrMInit(CGrMFrame *e,Bool flip_y)
|
||||
MemSet(e,0,sizeof(CGrMFrame));
|
||||
e->task=Fs;
|
||||
e->vertex_root.next=e->vertex_root.last=&e->vertex_root;
|
||||
e->triangle_root.next=e->triangle_root.last=&e->triangle_root;
|
||||
e->tri_root.next=e->tri_root.last=&e->tri_root;
|
||||
e->mode='v';
|
||||
e->grid_on=TRUE;
|
||||
e->vertex_on=TRUE;
|
||||
@@ -764,7 +763,7 @@ U0 GrMInit(CGrMFrame *e,Bool flip_y)
|
||||
e->cur_snap=5;
|
||||
e->flip_y=flip_y;
|
||||
e->select_rect=FALSE;
|
||||
e->cur_triangle=NULL;
|
||||
e->cur_tri=NULL;
|
||||
e->cur_vertex=NULL;
|
||||
}
|
||||
|
||||
@@ -775,10 +774,10 @@ U0 GrMLoad(CGrMFrame *e,U8 *src)
|
||||
CGrMVertex *tempv,*va[3];
|
||||
|
||||
e->vertex_root.next=e->vertex_root.last=&e->vertex_root;
|
||||
e->triangle_root.next=e->triangle_root.last=&e->triangle_root;
|
||||
e->tri_root.next=e->tri_root.last=&e->tri_root;
|
||||
|
||||
e->vertex_cnt =*src(I32 *)++;
|
||||
e->triangle_cnt=*src(I32 *)++;
|
||||
e->tri_cnt=*src(I32 *)++;
|
||||
for (i=0;i<e->vertex_cnt;i++) {
|
||||
x=*src(I32 *)++;
|
||||
y=*src(I32 *)++;
|
||||
@@ -786,7 +785,7 @@ U0 GrMLoad(CGrMFrame *e,U8 *src)
|
||||
tempv=GrMVertexNew(e,x,y,z);
|
||||
tempv->num=i;
|
||||
}
|
||||
for (i=0;i<e->triangle_cnt;i++) {
|
||||
for (i=0;i<e->tri_cnt;i++) {
|
||||
color=*src(I32 *)++;
|
||||
for (j=0;j<3;j++)
|
||||
va[j]=GrMVertexFindNum(e,*src(I32 *)++);
|
||||
@@ -798,7 +797,7 @@ I64 GrMSize(CGrMFrame *e)
|
||||
{
|
||||
I64 i;
|
||||
CGrMVertex *tempv=e->vertex_root.next;
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
|
||||
e->vertex_cnt=0;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
@@ -806,16 +805,16 @@ I64 GrMSize(CGrMFrame *e)
|
||||
tempv=tempv->next;
|
||||
}
|
||||
|
||||
e->triangle_cnt=0;
|
||||
while (tempt!=&e->triangle_root) {
|
||||
e->triangle_cnt++;
|
||||
e->tri_cnt=0;
|
||||
while (tempt!=&e->tri_root) {
|
||||
e->tri_cnt++;
|
||||
for (i=0;i<3;i++)
|
||||
tempt->mt.nums[i]=tempt->t[i]->num;
|
||||
tempt=tempt->next;
|
||||
}
|
||||
return sizeof(I32)*2+
|
||||
(offset(CGrMVertex.end)-offset(CGrMVertex.start))*e->vertex_cnt+
|
||||
(offset(CGrMTri.end)-offset(CGrMTri.start))*e->triangle_cnt;
|
||||
(offset(CGrMTri.end)-offset(CGrMTri.start))*e->tri_cnt;
|
||||
}
|
||||
|
||||
I32 *GrMSave(CGrMFrame *e,I64 *_size=NULL)
|
||||
@@ -823,10 +822,10 @@ I32 *GrMSave(CGrMFrame *e,I64 *_size=NULL)
|
||||
I64 size=GrMSize(e);
|
||||
U8 *result=MAlloc(size),*dst=result;
|
||||
CGrMVertex *tempv=e->vertex_root.next;
|
||||
CGrMTri *tempt=e->triangle_root.next;
|
||||
CGrMTri *tempt=e->tri_root.next;
|
||||
|
||||
*dst(I32 *)++=e->vertex_cnt;
|
||||
*dst(I32 *)++=e->triangle_cnt;
|
||||
*dst(I32 *)++=e->tri_cnt;
|
||||
|
||||
e->vertex_cnt=0;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
@@ -835,8 +834,8 @@ I32 *GrMSave(CGrMFrame *e,I64 *_size=NULL)
|
||||
tempv=tempv->next;
|
||||
}
|
||||
|
||||
e->triangle_cnt=0;
|
||||
while (tempt!=&e->triangle_root) {
|
||||
e->tri_cnt=0;
|
||||
while (tempt!=&e->tri_root) {
|
||||
MemCpy(dst,&tempt->start,offset(CGrMTri.end)-offset(CGrMTri.start));
|
||||
dst+=offset(CGrMTri.end)-offset(CGrMTri.start);
|
||||
tempt=tempt->next;
|
||||
@@ -848,7 +847,7 @@ I32 *GrMSave(CGrMFrame *e,I64 *_size=NULL)
|
||||
U0 GrMCleanUp(CGrMFrame *e)
|
||||
{
|
||||
QueDel(&e->vertex_root,TRUE);
|
||||
QueDel(&e->triangle_root,TRUE);
|
||||
QueDel(&e->tri_root,TRUE);
|
||||
Free(e->w2s);
|
||||
Free(e->s2w);
|
||||
}
|
||||
@@ -866,7 +865,7 @@ U0 GrMUpdateMenu(CGrMFrame *e)
|
||||
tempse->checked=ToBool(e->mode=='m');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/MoveVertexZ"))
|
||||
tempse->checked=ToBool(e->mode=='M');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/MakeTriangle"))
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Mode/MakeTri"))
|
||||
tempse->checked=ToBool(e->mode=='t');
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"View/FlipY"))
|
||||
tempse->checked=ToBool(e->flip_y);
|
||||
@@ -878,9 +877,9 @@ I32 *CSpriteMesh(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
Fmt for mesh:
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 triangle_cnt;
|
||||
I32 tri_cnt;
|
||||
CD3I32 vertices[];
|
||||
CMeshTri triangles[];
|
||||
CMeshTri tris[];
|
||||
}
|
||||
|
||||
If root points to a mesh, it will load it.
|
||||
@@ -940,7 +939,7 @@ $WW,0$*/
|
||||
" PlaceVertex(,'v');"
|
||||
" MoveVertex(,'m');"
|
||||
" MoveVertexZ(,'M');"
|
||||
" MakeTriangle(,'t');"
|
||||
" MakeTri(,'t');"
|
||||
"}"
|
||||
"Settings {"
|
||||
" Color(,'c');"
|
||||
@@ -967,12 +966,13 @@ $WW,0$*/
|
||||
"}");
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
|
||||
WordStat;
|
||||
Preempt(OFF); //We don't really want window update while modifying links
|
||||
AcctOneTimePopUp(ARf_MESH_ED,
|
||||
"$$FG,GREEN$$Right Mouse$$FG$$: Hold and move to shift cursor z\n"
|
||||
"$$FG,GREEN$$'j'$$FG$$: Jump cursor Z to nearest vertex's Z\n"
|
||||
"$$FG,GREEN$$'v'$$FG$$: Place Vertex Mode\n"
|
||||
"$$FG,GREEN$$'t'$$FG$$: Make Triangle Mode\n"
|
||||
"$$FG,GREEN$$'t'$$FG$$: Make Tri Mode\n"
|
||||
"$$FG,GREEN$$'m'$$FG$$: Move Vertex Mode\n"
|
||||
"$$FG,GREEN$$'M'$$FG$$: Move Vertex Z\n"
|
||||
"$$FG,GREEN$$'c'$$FG$$: Set color\n"
|
||||
@@ -982,7 +982,6 @@ $WW,0$*/
|
||||
Fs->win_inhibit=WIF_ALL|WIF_DOC-WIF_BORDER-WIF_CTRLS-WIF_MENU-WIF_GRAB_SCROLL;
|
||||
Fs->horz_scroll.pos=0;
|
||||
Fs->vert_scroll.pos=0;
|
||||
WordStat;
|
||||
GrMInit(&e,flip_y);
|
||||
if (root)
|
||||
GrMLoad(&e,root);
|
||||
@@ -1013,7 +1012,7 @@ gm_restart:
|
||||
else if (e.mode!='t')
|
||||
GrMVertexDel(&e,GrMVertexFindS(&e,ipx_presnap-Fs->win_pixel_left-Fs->win_scroll_x,ipy_presnap-Fs->win_pixel_top-Fs->win_scroll_y));
|
||||
GrMVertexSelectAll(&e,FALSE);
|
||||
GrMTriangleSelectAll(&e,FALSE);
|
||||
GrMTriSelectAll(&e,FALSE);
|
||||
vn=0;
|
||||
}
|
||||
break;
|
||||
@@ -1039,16 +1038,16 @@ gm_restart:
|
||||
case 't':
|
||||
if (vn) {
|
||||
GrMVertexSelectAll(&e,FALSE);
|
||||
GrMTriangleSelectAll(&e,FALSE);
|
||||
GrMTriSelectAll(&e,FALSE);
|
||||
vn=0;
|
||||
} else
|
||||
GrMTriangleDel(&e,e.cur_triangle);
|
||||
GrMTriDel(&e,e.cur_tri);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
GrMVertexSelectAll(&e,FALSE);
|
||||
GrMTriangleSelectAll(&e,FALSE);
|
||||
GrMTriSelectAll(&e,FALSE);
|
||||
case 'v':
|
||||
case 'm':
|
||||
case 'M':
|
||||
@@ -1062,7 +1061,7 @@ gm_restart:
|
||||
GrMTransformSelect(&e);
|
||||
break;
|
||||
case 'A':
|
||||
GrMTriangleSelectAll(&e,TRUE);
|
||||
GrMTriSelectAll(&e,TRUE);
|
||||
if (e.mode!='t')
|
||||
GrMVertexSelectAll(&e,TRUE);
|
||||
else
|
||||
@@ -1070,7 +1069,7 @@ gm_restart:
|
||||
vn=0;
|
||||
break;
|
||||
case 'U':
|
||||
GrMTriangleSelectAll(&e,FALSE);
|
||||
GrMTriSelectAll(&e,FALSE);
|
||||
GrMVertexSelectAll(&e,FALSE);
|
||||
vn=0;
|
||||
break;
|
||||
@@ -1104,7 +1103,7 @@ gm_restart:
|
||||
}
|
||||
}
|
||||
e.select_rect=FALSE;
|
||||
GrMTriangleSelectRect(&e,i,e.x1,e.x2,e.y1,e.y2);
|
||||
GrMTriSelectRect(&e,i,e.x1,e.x2,e.y1,e.y2);
|
||||
if (e.mode!='t')
|
||||
GrMVertexSelectRect(&e,i,e.x1,e.x2,e.y1,e.y2);
|
||||
else
|
||||
@@ -1147,7 +1146,7 @@ gm_restart:
|
||||
GrMScaleZoom(&e,1/1.5);
|
||||
break;
|
||||
case 'c':
|
||||
e.cur_color=PopUpLightingColor;
|
||||
e.cur_color=PopUpColorLighting;
|
||||
break;
|
||||
case 's':
|
||||
i=PopUpRangeI64(1,25,1,"New Snap\n");
|
||||
@@ -1210,11 +1209,11 @@ gm_restart:
|
||||
GrMInvertAxis(&e,offset(CD3I32.z));
|
||||
break;
|
||||
case 'f':
|
||||
if (e.cur_triangle)
|
||||
SwapU64(&e.cur_triangle->t[1],&e.cur_triangle->t[2]);
|
||||
if (e.cur_tri)
|
||||
SwapU64(&e.cur_tri->t[1],&e.cur_tri->t[2]);
|
||||
break;
|
||||
case 'F':
|
||||
GrMFlipTriangles(&e);
|
||||
GrMFlipTris(&e);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -1283,7 +1282,7 @@ gm_restart:
|
||||
GrMCursorW(&e,Fs,&x,&y,&z);
|
||||
GrMP0Offset(&e,x-p0a.x,y-p0a.y,z-p0a.z);
|
||||
}
|
||||
GrMTriangleSelectAll(&e,FALSE);
|
||||
GrMTriSelectAll(&e,FALSE);
|
||||
GrMVertexSelectAll(&e,FALSE);
|
||||
moving=FALSE;
|
||||
}
|
||||
@@ -1300,7 +1299,7 @@ gm_restart:
|
||||
va[vn++]=tempv;
|
||||
tempv->flags|=VF_SELECTED;
|
||||
if (vn==3) {
|
||||
e.cur_triangle=GrMTriNew(&e,e.cur_color,va[0],va[1],va[2]);
|
||||
e.cur_tri=GrMTriNew(&e,e.cur_color,va[0],va[1],va[2]);
|
||||
for (i=0;i<vn;i++)
|
||||
va[i]->flags&=~VF_SELECTED;
|
||||
vn=0;
|
||||
|
||||
@@ -28,12 +28,12 @@ offset(CSprite.linespeed)-offset(CSprite.start), //GRST_BITMAP8
|
||||
1,
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //GRST_REG_POLY
|
||||
sizeof(CSprite)-offset(CSprite.start), //GRST_POLYGON
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_PLANAR_SYMMETRY
|
||||
2+offset(CSprite.dither_color8)-offset(CSprite.start), //GRST_DITHER_COLOR8
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ROTATED_RECT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_MESH
|
||||
offset(CSprite.shiftable_triangle_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_ARROW
|
||||
@@ -68,12 +68,12 @@ offset(CSprite.linespeed), //GRST_BITMAP8
|
||||
1,
|
||||
offset(CSprite.st), //GRST_TEXT
|
||||
offset(CSprite.sides), //GRST_ELLIPSE
|
||||
sizeof(CSprite), //GRST_REG_POLY
|
||||
sizeof(CSprite), //GRST_POLYGON
|
||||
offset(CSprite.linespeed), //GRST_PLANAR_SYMMETRY
|
||||
2+offset(CSprite.dither_color8), //GRST_DITHER_COLOR8
|
||||
offset(CSprite.sides), //GRST_ROTATED_RECT
|
||||
offset(CSprite.x2), //GRST_MESH
|
||||
offset(CSprite.shiftable_triangle_cnt)+sizeof(I32), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.linespeed), //GRST_ARROW
|
||||
@@ -107,10 +107,10 @@ I64 SpriteElemSize(CSprite *tempg)
|
||||
i+=tempg->num*sizeof(CD3I32);
|
||||
break;
|
||||
case GRST_MESH:
|
||||
i+=tempg->vertex_cnt*sizeof(CD3I32)+tempg->triangle_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->vertex_cnt*sizeof(CD3I32)+tempg->tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
case GRST_SHIFTABLE_MESH:
|
||||
i+=tempg->shiftable_vertex_cnt*sizeof(CD3I32)+tempg->shiftable_triangle_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->shiftable_vertex_cnt*sizeof(CD3I32)+tempg->shiftable_tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@@ -171,7 +171,7 @@ public U8 *Sprite2Text(CSprite *tempg)
|
||||
{ //Study $LK-A,"::/TempleOS/Demo/Graphics/SpriteText.CPP"$.
|
||||
U8 buf[256],buf2[256],buf3[136];
|
||||
I32 *ptr;
|
||||
SPrintF(buf,"%Z",tempg->type,"ST_CSPRITE_TYPES");
|
||||
SPrintF(buf,"%Z",tempg->type,"ST_SPRITE_TYPES");
|
||||
*buf2=0;
|
||||
switch (tempg->type) {
|
||||
case GRST_COLOR8:
|
||||
@@ -212,7 +212,7 @@ public U8 *Sprite2Text(CSprite *tempg)
|
||||
SPrintF(buf2," %d %d,%d",tempg->num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
case GRST_BITMAP8:
|
||||
SPrintF(buf2," %dW,%dH:%d,%d",
|
||||
tempg->width,tempg->height,tempg->x2,tempg->y2);
|
||||
@@ -224,10 +224,10 @@ public U8 *Sprite2Text(CSprite *tempg)
|
||||
SPrintF(buf2," %d",tempg->num);
|
||||
break;
|
||||
case GRST_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->vertex_cnt,tempg->triangle_cnt);
|
||||
SPrintF(buf2," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
break;
|
||||
case GRST_SHIFTABLE_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_triangle_cnt);
|
||||
SPrintF(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
break;
|
||||
}
|
||||
StrCat(buf,buf2);
|
||||
|
||||
+12
-15
@@ -1,15 +1,15 @@
|
||||
#help_index "Graphics"
|
||||
U0 GrInit()
|
||||
U0 GrInit1()
|
||||
{
|
||||
DefineLstLoad("ST_CSPRITE_TYPES","End\0 \0Color 8Bit\0 \0Point\0"
|
||||
DefineLstLoad("ST_SPRITE_TYPES","End\0 \0Color 8Bit\0 \0Point\0"
|
||||
"Line\0PolyLine\0PolyPoint\0Width\0Shift\0"
|
||||
"BSpline2\0BSpline3\0BSpline2 Closed\0BSpline3 Closed\0"
|
||||
" \0 \0 \0Rect\0Circle\0Flood Fill Not Color\0Flood Fill\0BitMap 8Bit\0"
|
||||
" \0Text\0Ellipse\0Reg Polygon\0Planar Symmetry\0"
|
||||
" \0Text\0Ellipse\0Polygon\0Planar Symmetry\0"
|
||||
"Dither Color 8Bit\0Rotated Rect\0Mesh\0Shiftable Mesh\0"
|
||||
"Transform On\0Transform Off\0Arrow\0Text Box\0Text Diamond\0");
|
||||
}
|
||||
GrInit;
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/CSprite"
|
||||
#define GRST_END 0
|
||||
@@ -37,7 +37,7 @@ GrInit;
|
||||
//Unused
|
||||
#define GRST_TEXT 23
|
||||
#define GRST_ELLIPSE 24
|
||||
#define GRST_REG_POLY 25
|
||||
#define GRST_POLYGON 25
|
||||
#define GRST_PLANAR_SYMMETRY 26
|
||||
#define GRST_DITHER_COLOR8 27
|
||||
#define GRST_ROTATED_RECT 28
|
||||
@@ -75,7 +75,7 @@ public class CSprite
|
||||
union {
|
||||
I32 y1;
|
||||
I32 height;
|
||||
I32 triangle_cnt; //Mesh
|
||||
I32 tri_cnt; //Mesh
|
||||
}
|
||||
union {
|
||||
I32 z1;
|
||||
@@ -89,7 +89,7 @@ public class CSprite
|
||||
union {
|
||||
F64 linespeed;
|
||||
F64 rot_angle;
|
||||
I32 shiftable_triangle_cnt //Shiftable Mesh
|
||||
I32 shiftable_tri_cnt //Shiftable Mesh
|
||||
}
|
||||
I32 sides;
|
||||
};
|
||||
@@ -99,9 +99,7 @@ public class CSprite
|
||||
extern CDC *DCNew(I64 type,I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE);
|
||||
extern CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL);
|
||||
extern U0 DCDel(CDC *dc);
|
||||
extern U0 EdExistingGraphic(CDoc *doc,I64 x,I64 y,I64 *import_snap=NULL,F64 *import_ip_scaler=NULL);
|
||||
extern CSprite *SpriteDoc2Que(CDoc *doc,CSprite *root,I64 *cur_num);
|
||||
extern Bool GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
|
||||
extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
|
||||
extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
|
||||
|
||||
#include "GrCfg"
|
||||
@@ -114,16 +112,15 @@ extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
|
||||
#include "GrComposites"
|
||||
#include "GrChar"
|
||||
|
||||
#define GE_CANCEL (-1)
|
||||
#define GE_OKAY_DONE 0
|
||||
#define GE_OKAY_CONT 1
|
||||
#define GE_ABORT (-1)
|
||||
#define GE_EXIT 0
|
||||
#define GE_CONT 1
|
||||
|
||||
#include "CSpriteNew"
|
||||
#include "GrSpritePlot"
|
||||
#include "CSpriteMesh"
|
||||
#include "CSpriteBitMap"
|
||||
#include "CSpriteVect"
|
||||
#include "CSpriteEd"
|
||||
#include "GrVectMap"
|
||||
#include "CSpriteMain"
|
||||
#help_index ""
|
||||
|
||||
@@ -613,7 +613,7 @@ _IS_PIXEL_COVERED0::
|
||||
RET1 24
|
||||
// ************************************
|
||||
_GR_ROP_EQU_U8_NO_CLIPPING::
|
||||
//Puts foreground char shape onto gr_dc.
|
||||
//Puts foreground char shape onto gr_dc2.
|
||||
//ch.u8[1] is color as a whole byte
|
||||
//ch DOCEt_UNDERLINE attr flag is used.
|
||||
ENTER 0
|
||||
|
||||
+105
-57
@@ -73,7 +73,7 @@ public I64 GrPeek0(CDC *dc,I64 x,I64 y)
|
||||
|
||||
#help_index "Graphics;Graphics/DCs"
|
||||
|
||||
public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
public I64 GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
{ //Clipping but not transformation
|
||||
I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,
|
||||
leading_bits,leading_bit_mask,whole_bytes,trailing_bits,trailing_bit_mask,
|
||||
@@ -90,8 +90,14 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
x+=win_task->win_scroll_x;
|
||||
y+=win_task->win_scroll_y;
|
||||
}
|
||||
w1=x<0 ?-x:0;
|
||||
h1=y<0 ?-y:0;
|
||||
if (x<0)
|
||||
w1=-x;
|
||||
else
|
||||
w1=0;
|
||||
if (y<0)
|
||||
h1=-y;
|
||||
else
|
||||
h1=0;
|
||||
w2=img->width;
|
||||
h2=img->height;
|
||||
if (dc->flags & DCF_SCREEN_BITMAP) {
|
||||
@@ -126,7 +132,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
|
||||
}
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
return TRUE;
|
||||
return 1;
|
||||
old_color=dc->color;
|
||||
db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
@@ -171,7 +177,12 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
}
|
||||
kk = h1 *img ->width_internal+w1;
|
||||
@@ -186,7 +197,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
@@ -198,7 +209,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -214,7 +225,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
@@ -233,14 +244,14 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (leading_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++=(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
@@ -248,7 +259,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
@@ -268,7 +279,12 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
@@ -302,7 +318,12 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
}
|
||||
kk = h1 *img ->width_internal+w1;
|
||||
@@ -317,7 +338,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
@@ -329,7 +350,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -345,7 +366,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
@@ -364,14 +385,14 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (leading_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
@@ -379,7 +400,7 @@ public Bool GrBlot(CDC *dc,I64 x,I64 y,CDC *img)
|
||||
if (trailing_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
@@ -404,7 +425,12 @@ here1a:
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
@@ -443,7 +469,12 @@ here1a:
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
}
|
||||
kk = h1 *img ->width_internal +w1;
|
||||
@@ -458,7 +489,7 @@ here1a:
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
@@ -470,7 +501,7 @@ here1a:
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
@@ -486,7 +517,7 @@ here1a:
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
@@ -505,21 +536,21 @@ here1a:
|
||||
if (leading_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++^=*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
if (trailing_bits) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(I64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
@@ -534,9 +565,9 @@ here1a:
|
||||
}
|
||||
dc->depth_buf=db;
|
||||
dc->color=old_color;
|
||||
return TRUE;
|
||||
return 1;
|
||||
} else
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
|
||||
@@ -587,7 +618,7 @@ public CDC *DCExtract(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,CTask *task=NULL)
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
|
||||
public Bool GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
public I64 GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
{ //Clipping but not transformation
|
||||
U8 reg *src,reg *dst,*font_ptr;
|
||||
I64 i,m,leading_bits,trailing_bits,leading_bit_mask,trailing_bit_mask,
|
||||
@@ -601,8 +632,14 @@ public Bool GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
y+=win_task->win_scroll_y;
|
||||
}
|
||||
|
||||
w1=x<0 ?-x:0;
|
||||
h1=y<0 ?-y:0;
|
||||
if (x<0)
|
||||
w1=-x;
|
||||
else
|
||||
w1=0;
|
||||
if (y<0)
|
||||
h1=-y;
|
||||
else
|
||||
h1=0;
|
||||
w2=FONT_WIDTH;
|
||||
h2=FONT_HEIGHT;
|
||||
|
||||
@@ -638,7 +675,7 @@ public Bool GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
if (y+h2-1>dc->max_y) dc->max_y=y+h2-1;
|
||||
}
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
return TRUE;
|
||||
return 1;
|
||||
color=dc->color;
|
||||
if (dc->type==DCT_COLOR8) {
|
||||
leading_bits=-(w1+x)&7;
|
||||
@@ -789,16 +826,17 @@ public Bool GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return 1;
|
||||
} else
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Bool GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
public I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{
|
||||
I64 x0=x,ch;
|
||||
Bool result=FALSE,first=TRUE;
|
||||
if (!_s) return FALSE;
|
||||
I64 x0,ch,result;
|
||||
if (!_s) return 0;
|
||||
x0=x;
|
||||
result=0;
|
||||
while (ch=*_s++) {
|
||||
if (ch=='\n') {
|
||||
x=x0;
|
||||
@@ -806,23 +844,21 @@ public Bool GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (ch=='\t')
|
||||
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
|
||||
else {
|
||||
if (first) {
|
||||
result=GrPutChar(dc,x,y,ch);
|
||||
first=FALSE;
|
||||
} else
|
||||
GrPutChar(dc,x,y,ch);
|
||||
result+=GrPutChar(dc,x,y,ch);
|
||||
x+=FONT_WIDTH;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
public I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Vertical text
|
||||
I64 y0=y;
|
||||
I64 y0,result;
|
||||
U8 buf[2];
|
||||
Bool result=FALSE,first=TRUE;
|
||||
if (!_s) return FALSE;
|
||||
if (!_s) return 0;
|
||||
y0=y;
|
||||
result=0;
|
||||
|
||||
buf[1]=0;
|
||||
while (*buf=*_s++) {
|
||||
if (*buf=='\n') {
|
||||
@@ -831,11 +867,7 @@ public Bool GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (*buf=='\t')
|
||||
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
|
||||
else {
|
||||
if (first) {
|
||||
result=GrPutS(dc,x,y,buf);
|
||||
first=FALSE;
|
||||
} else
|
||||
GrPutS(dc,x,y,buf);
|
||||
result+=GrPutS(dc,x,y,buf);
|
||||
y+=FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
@@ -875,8 +907,14 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
y+=win_task->win_scroll_y;
|
||||
}
|
||||
|
||||
w1=x<0 ?-x:0;
|
||||
h1=y<0 ?-y:0;
|
||||
if (x<0)
|
||||
w1=-x;
|
||||
else
|
||||
w1=0;
|
||||
if (y<0)
|
||||
h1=-y;
|
||||
else
|
||||
h1=0;
|
||||
w2=w;
|
||||
h2=h;
|
||||
|
||||
@@ -972,7 +1010,12 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
}
|
||||
kk1=(h1+y)*dc->width_internal+x+w1;
|
||||
@@ -1118,7 +1161,12 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr_win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=((leading_bits?1:0)+whole_bytes+(trailing_bits?1:0))*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
}
|
||||
color_mask=gr_1_to_8_colors[color.c0.color];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#help_index "Graphics"
|
||||
public U0 GrLineRect4(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
{
|
||||
//Can be used with ROPF_DITHER+WHITE<<16+ROP_EQU+BLACK
|
||||
//Can be used with ROPF_DITHER+WHITE<<16+BLACK
|
||||
//for dotted rect.
|
||||
GrLine3(dc,x1,y1,0,x2,y1,0,step,start);
|
||||
GrLine3(dc,x2,y1,0,x2,y2,0,step,start);
|
||||
@@ -9,9 +9,9 @@ public U0 GrLineRect4(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0
|
||||
GrLine3(dc,x1,y2,0,x1,y1,0,step,start);
|
||||
}
|
||||
|
||||
public U0 GrArrow3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
|
||||
public I64 GrArrow3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,I64 step=1,I64 start=0)
|
||||
{ //transformation with pen width
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy,result=0;
|
||||
F64 d;
|
||||
Bool was_transform=FALSE,was_symmetry=FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -26,40 +26,43 @@ public U0 GrArrow3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,F64 w=2.75,
|
||||
_x2=x2; _y2=y2; _z2=z2;
|
||||
GrReflect(dc,&_x2,&_y2,&_z2);
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
result=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;
|
||||
Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,_x2,_y2,_z2,&GrPlot3,step);
|
||||
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,_x2,_y2,_z2,&GrPlot3,step);
|
||||
result+=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;
|
||||
}
|
||||
Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
result+=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;
|
||||
Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,x2,y2,z2,&GrPlot3,step);
|
||||
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,x2,y2,z2,&GrPlot3,step);
|
||||
result+=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,x2,y2,z2,&GrPlot3,step);
|
||||
}
|
||||
gr_done:
|
||||
if (was_transform)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (was_symmetry)
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
|
||||
public Bool GrTextBox3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
public I64 GrTextBox3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
Bool result;
|
||||
U8 ch,*ptr=s;
|
||||
I64 w=0,w_max=0,h=FONT_HEIGHT;
|
||||
if (!s) return FALSE;
|
||||
U8 ch,*ptr;
|
||||
I64 w,w_max,h,result;
|
||||
if (!s) return 0;
|
||||
ptr=s;
|
||||
w=0; w_max=0; h=FONT_HEIGHT; result=0;
|
||||
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
while (ch=*ptr++) {
|
||||
@@ -74,21 +77,21 @@ public Bool GrTextBox3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
}
|
||||
if (w>w_max) w_max=w;
|
||||
result=GrPutS(dc,x1,y1,s);
|
||||
GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
||||
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 result;
|
||||
}
|
||||
|
||||
#define MAX_DIAMOND_SLOPE 2.75
|
||||
|
||||
public Bool GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
public I64 GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
Bool result=FALSE,first=TRUE;
|
||||
Bool first=TRUE;
|
||||
U8 ch,*ptr,*ptr_end,*st,*s;
|
||||
I64 y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
|
||||
I64 y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT,result=0;
|
||||
F64 m;
|
||||
if (!_s) return FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
@@ -96,7 +99,7 @@ public Bool GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
|
||||
ptr=s=StrNew(_s);
|
||||
while (ch=*ptr) {
|
||||
if (ch==CH_CARRIAGE_RETURN||ch=='\t')
|
||||
if (ch=='\r'||ch=='\t')
|
||||
*ptr=CH_SPACE;
|
||||
if (ch=='\n') {
|
||||
*ptr=0;
|
||||
@@ -117,10 +120,10 @@ public Bool GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
|
||||
w=(StrLen(st)*FONT_WIDTH)>>1;
|
||||
if (first) {
|
||||
result=GrPutS(dc,x1-w,y,st);
|
||||
result+=GrPutS(dc,x1-w,y,st);
|
||||
first=FALSE;
|
||||
} else
|
||||
GrPutS(dc,x1-w,y,st);
|
||||
result+=GrPutS(dc,x1-w,y,st);
|
||||
if (w) {
|
||||
w+=border;
|
||||
do {
|
||||
@@ -141,10 +144,10 @@ public Bool GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
}
|
||||
Free(s);
|
||||
|
||||
GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||
GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||
GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
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);
|
||||
result+=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
result+=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public U0 DCRst(CDC *dc)
|
||||
public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
{
|
||||
CDC *result;
|
||||
if (!dc) dc=gr_dc2;
|
||||
if (!dc) dc=gr_dc;
|
||||
if (!task) task=Fs;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
@@ -255,9 +255,9 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
}
|
||||
|
||||
#help_index "Graphics/CSprite;Graphics/DCs;Doc/Output"
|
||||
public U0 DocPutGRAFile(CDoc *doc=NULL,U8 *fname)
|
||||
public U0 DocPutGRAFile(CDoc *doc=NULL,U8 *filename)
|
||||
{
|
||||
CDC *dc=GRARead(fname);
|
||||
CDC *dc=GRARead(filename);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
DocPutSprite(doc,elems);
|
||||
Free(elems);
|
||||
|
||||
@@ -434,28 +434,32 @@ Bool GrLinePlot(CDC *dc,I64 x,I64 y,I64 z)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 GrLine(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
public I64 GrLine(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
{
|
||||
I64 result=0;
|
||||
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))
|
||||
Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrCircle(CDC *dc,I64 cx,I64 cy,I64 radius,
|
||||
public I64 GrCircle(CDC *dc,I64 cx,I64 cy,I64 radius,
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
{
|
||||
I64 result;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
||||
result=Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrEllipse(CDC *dc,
|
||||
public I64 GrEllipse(CDC *dc,
|
||||
I64 cx,I64 cy,
|
||||
I64 x_radius,I64 y_radius,
|
||||
F64 rot_angle=0,
|
||||
@@ -463,13 +467,15 @@ public U0 GrEllipse(CDC *dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 result;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
result=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrRegPoly(CDC *dc,
|
||||
public I64 GrRegPoly(CDC *dc,
|
||||
I64 cx,I64 cy,
|
||||
I64 x_radius,I64 y_radius,I64 sides,
|
||||
F64 rot_angle=0,
|
||||
@@ -477,36 +483,38 @@ public U0 GrRegPoly(CDC *dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 result;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||
result=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 Gr2Bezier(CDC *dc,CD3I32 *ctrl)
|
||||
public I64 Gr2Bezier(CDC *dc,CD3I32 *ctrl)
|
||||
{
|
||||
Bezier2(dc,ctrl,&GrLinePlot);
|
||||
return Bezier2(dc,ctrl,&GrLinePlot);
|
||||
}
|
||||
|
||||
public U0 Gr3Bezier(CDC *dc,CD3I32 *ctrl)
|
||||
public I64 Gr3Bezier(CDC *dc,CD3I32 *ctrl)
|
||||
{
|
||||
Bezier3(dc,ctrl,&GrLinePlot);
|
||||
return Bezier3(dc,ctrl,&GrLinePlot);
|
||||
}
|
||||
|
||||
public U0 Gr2BSpline(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
public I64 Gr2BSpline(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{
|
||||
BSpline2(dc,ctrl,cnt,&GrLinePlot,closed);
|
||||
return BSpline2(dc,ctrl,cnt,&GrLinePlot,closed);
|
||||
}
|
||||
|
||||
public U0 Gr3BSpline(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
public I64 Gr3BSpline(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{
|
||||
BSpline3(dc,ctrl,cnt,&GrLinePlot,closed);
|
||||
return BSpline3(dc,ctrl,cnt,&GrLinePlot,closed);
|
||||
}
|
||||
|
||||
public U0 GrLine3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64 step=1,I64 start=0)
|
||||
public I64 GrLine3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64 step=1,I64 start=0)
|
||||
{
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2;
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,result=0;
|
||||
Bool was_transform=FALSE,was_symmetry=FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
@@ -522,23 +530,24 @@ public U0 GrLine3(CDC *dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,I64 step=1,I
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
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))
|
||||
Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||
result=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||
was_symmetry=TRUE;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
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))
|
||||
Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
result+=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||
} else
|
||||
Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||
result+=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;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
@@ -584,7 +593,7 @@ public U0 GrVPrintF3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
public U0 GrEllipse3(CDC *dc,
|
||||
public I64 GrEllipse3(CDC *dc,
|
||||
I64 cx,I64 cy,I64 cz,
|
||||
I64 x_radius,I64 y_radius,
|
||||
F64 rot_angle=0,
|
||||
@@ -592,7 +601,7 @@ public U0 GrEllipse3(CDC *dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
I64 x,y,z,xx,yy,zz,result;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
@@ -628,23 +637,24 @@ public U0 GrEllipse3(CDC *dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
Ellipse(dc,cx,cy,cz,
|
||||
result=Ellipse(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
result=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrCircle3(CDC *dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
public I64 GrCircle3(CDC *dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
{ //transformation with pen width
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
GrEllipse3(dc,cx,cy,cz,radius,radius,0,step,start_radians,len_radians);
|
||||
return GrEllipse3(dc,cx,cy,cz,radius,radius,0,step,start_radians,len_radians);
|
||||
else
|
||||
Circle(dc,cx,cy,cz,radius,&GrPlot3,step,start_radians,len_radians);
|
||||
return Circle(dc,cx,cy,cz,radius,&GrPlot3,step,start_radians,len_radians);
|
||||
}
|
||||
|
||||
public U0 GrRegPoly3(CDC *dc,
|
||||
public I64 GrRegPoly3(CDC *dc,
|
||||
I64 cx,I64 cy,I64 cz,
|
||||
I64 x_radius,I64 y_radius,I64 sides,
|
||||
F64 rot_angle=0,
|
||||
@@ -652,7 +662,7 @@ public U0 GrRegPoly3(CDC *dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
I64 x,y,z,xx,yy,zz,result;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
@@ -688,11 +698,12 @@ public U0 GrRegPoly3(CDC *dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
RegPoly(dc,cx,cy,cz,
|
||||
result=RegPoly(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} else
|
||||
RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
result=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,rot_angle,step,start_radians,len_radians);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFloodFill3(CDC *dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||
@@ -720,9 +731,9 @@ gr_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
public I64 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
{ //Clipping and transformation
|
||||
I64 x2,y2,z2,x3,y3,z3;
|
||||
I64 x2,y2,z2,x3,y3,z3,result=0;
|
||||
CDC *old_brush=dc->brush;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->brush=NULL;
|
||||
@@ -733,21 +744,21 @@ public U0 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
(*dc->transform)(dc,&x3,&y3,&z3);
|
||||
if (!(dc->flags&DCF_JUST_MIRROR) ||
|
||||
!(dc->flags&DCF_SYMMETRY))
|
||||
Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
result=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x3,&y3,&z3);
|
||||
Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
result+=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
}
|
||||
dc->brush=old_brush;
|
||||
} else {
|
||||
if (!(dc->flags&DCF_JUST_MIRROR)||
|
||||
!(dc->flags&DCF_SYMMETRY)) {
|
||||
if (dc->depth_buf)
|
||||
Rect(dc,x,y,z,x+w,y,z,x,y+h,z,&GrLinePlot);
|
||||
result=Rect(dc,x,y,z,x+w,y,z,x,y+h,z,&GrLinePlot);
|
||||
else
|
||||
GrRect(dc,x,y,w,h);
|
||||
result=GrRect(dc,x,y,w,h);
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
dc->brush=NULL;
|
||||
@@ -756,15 +767,16 @@ public U0 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x3,&y3,&z3);
|
||||
Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
result+=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
dc->brush=old_brush;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics;Graphics/DCs"
|
||||
|
||||
public Bool GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
public I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
{ //Clipping and transformation
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
CColorROPU32 old_color=dc->color;
|
||||
@@ -775,8 +787,8 @@ public Bool GrBlot3(CDC *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;
|
||||
Bool first,result=FALSE;
|
||||
last_x,last_y,result=0;
|
||||
Bool first;
|
||||
CDC *old_brush=dc->brush;
|
||||
|
||||
if (dc->depth_buf || dc->flags & (DCF_TRANSFORMATION | DCF_SYMMETRY)) {
|
||||
@@ -799,14 +811,28 @@ public Bool GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
adx1=AbsI64(dx1); ady1=AbsI64(dy1); adz1=AbsI64(dz1);
|
||||
adx2=AbsI64(dx2); ady2=AbsI64(dy2); adz2=AbsI64(dz2);
|
||||
|
||||
if (adx1>=ady1)
|
||||
d1=adx1>=adz1 ? adx1:adz1;
|
||||
else
|
||||
d1=ady1>=adz1 ? ady1:adz1;
|
||||
if (adx2>=ady2)
|
||||
d2=adx2>=adz2 ? adx2:adz2;
|
||||
else
|
||||
d2=ady2>=adz2 ? ady2:adz2;
|
||||
if (adx1>=ady1) {
|
||||
if (adx1>=adz1)
|
||||
d1=adx1;
|
||||
else
|
||||
d1=adz1;
|
||||
} else {
|
||||
if (ady1>=adz1)
|
||||
d1=ady1;
|
||||
else
|
||||
d1=adz1;
|
||||
}
|
||||
if (adx2>=ady2) {
|
||||
if (adx2>=adz2)
|
||||
d2=adx2;
|
||||
else
|
||||
d2=adz2;
|
||||
} else {
|
||||
if (ady2>=adz2)
|
||||
d2=ady2;
|
||||
else
|
||||
d2=adz2;
|
||||
}
|
||||
|
||||
if (AbsI64(d1)!=w ||AbsI64(d2)!=h) {
|
||||
d1<<=1;
|
||||
@@ -866,7 +892,7 @@ public Bool GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
_x1+=dx1; _y1+=dy1; _z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
result=TRUE;
|
||||
result=1;
|
||||
normal_image:
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
@@ -876,14 +902,28 @@ normal_image:
|
||||
adx1=AbsI64(dx1); ady1=AbsI64(dy1); adz1=AbsI64(dz1);
|
||||
adx2=AbsI64(dx2); ady2=AbsI64(dy2); adz2=AbsI64(dz2);
|
||||
|
||||
if (adx1>=ady1)
|
||||
d1=adx1>=adz1 ? adx1:adz1;
|
||||
else
|
||||
d1=ady1>=adz1 ? ady1:adz1;
|
||||
if (adx2>=ady2)
|
||||
d2=adx2>=adz2 ? adx2:adz2;
|
||||
else
|
||||
d2=ady2>=adz2 ? ady2:adz2;
|
||||
if (adx1>=ady1) {
|
||||
if (adx1>=adz1)
|
||||
d1=adx1;
|
||||
else
|
||||
d1=adz1;
|
||||
} else {
|
||||
if (ady1>=adz1)
|
||||
d1=ady1;
|
||||
else
|
||||
d1=adz1;
|
||||
}
|
||||
if (adx2>=ady2) {
|
||||
if (adx2>=adz2)
|
||||
d2=adx2;
|
||||
else
|
||||
d2=adz2;
|
||||
} else {
|
||||
if (ady2>=adz2)
|
||||
d2=ady2;
|
||||
else
|
||||
d2=adz2;
|
||||
}
|
||||
if (AbsI64(d1)!=w ||AbsI64(d2)!=h) {
|
||||
d1<<=1;
|
||||
d2<<=1;
|
||||
@@ -942,7 +982,7 @@ normal_image:
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
result=TRUE; //TODO: check off screen
|
||||
result=1; //TODO: check off screen
|
||||
} else
|
||||
result=GrBlot(dc,x1,y1,img);
|
||||
gr_done:
|
||||
@@ -953,9 +993,9 @@ gr_done:
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
public U0 Gr2Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
public I64 Gr2Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
{
|
||||
I64 i,x,y,z,
|
||||
I64 i,x,y,z,result=0,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -984,21 +1024,22 @@ public U0 Gr2Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
Bezier2(dc,ctrl3,&GrPlot3);
|
||||
result=Bezier2(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
Bezier2(dc,ctrl,&GrPlot3);
|
||||
result+=Bezier2(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 Gr3Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
public I64 Gr3Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
{
|
||||
I64 i,x,y,z,
|
||||
I64 i,x,y,z,result=0,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -1027,21 +1068,22 @@ public U0 Gr3Bezier3(CDC *dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
Bezier3(dc,ctrl3,&GrPlot3);
|
||||
result=Bezier3(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
Bezier3(dc,ctrl,&GrPlot3);
|
||||
result+=Bezier3(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 Gr2BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
public I64 Gr2BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{
|
||||
I64 i,x,y,z,
|
||||
I64 i,x,y,z,result=0,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -1070,21 +1112,22 @@ public U0 Gr2BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
result=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
result+=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 Gr3BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
public I64 Gr3BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{
|
||||
I64 i,x,y,z,
|
||||
I64 i,x,y,z,result=0,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -1113,19 +1156,20 @@ public U0 Gr3BSpline3(CDC *dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
result=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
result+=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFillTriangle0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
{
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Returns cnt of pixels changed
|
||||
@@ -1383,7 +1427,7 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
|
||||
result+=GrFillTriangle0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
}
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
@@ -1413,14 +1457,14 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
|
||||
result+=GrFillTriangle0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
|
||||
public I64 Gr3Mesh(CDC *dc,I64 vertex_cnt,CD3I32 *p,I64 triangle_cnt,CMeshTri *tri)
|
||||
public I64 Gr3Mesh(CDC *dc,I64 vertex_cnt,CD3I32 *p,I64 tri_cnt,CMeshTri *tri)
|
||||
{
|
||||
//Returns cnt of pixels changed
|
||||
CColorROPU32 old_color=dc->color;
|
||||
@@ -1447,17 +1491,17 @@ public I64 Gr3Mesh(CDC *dc,I64 vertex_cnt,CD3I32 *p,I64 triangle_cnt,CMeshTri *t
|
||||
dst->x=x; dst->y=y; dst->z=z;
|
||||
}
|
||||
p_sym=pt_sym;
|
||||
for (i=0;i<triangle_cnt;i++,tri_sym++) {
|
||||
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+=GrFillTriangle0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],&p_sym[tri_sym->nums[1]]);
|
||||
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],&p_sym[tri_sym->nums[1]]);
|
||||
}
|
||||
Free(pt_sym);
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto mesh_done;
|
||||
}
|
||||
for (i=0;i<triangle_cnt;i++,tri++) {
|
||||
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+=GrFillTriangle0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||
result+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||
}
|
||||
mesh_done:
|
||||
dc->color=old_color;
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
public CDC *gr_screen_image; //This is read only
|
||||
|
||||
#help_index "Graphics/DCs"
|
||||
public CDC *gr_dc=NULL, //This is updated every refresh
|
||||
*gr_dc_cache,
|
||||
*gr_dc1=NULL,
|
||||
*gr_dc2=NULL;
|
||||
public CDC *gr_dc=NULL, //Persistent
|
||||
*gr_dc1=NULL,
|
||||
*gr_dc2=NULL, //Updated every refresh
|
||||
*gr_dc_cache;
|
||||
|
||||
CDC *gr_zoomed_dc;
|
||||
U16 *gr_win_uncovered_bitmap=NULL,gr_highest_uncovered;
|
||||
|
||||
@@ -13,7 +14,7 @@ U16 *gr_vga_text_cache;
|
||||
|
||||
public U0 DCFill(CDC *dc=NULL,CColorROPU32 val=COLOR_TRANSPARENT)
|
||||
{
|
||||
if (!dc) dc=gr_dc2;
|
||||
if (!dc) dc=gr_dc;
|
||||
nobound_switch (dc->type) {
|
||||
case DCT_COLOR4:
|
||||
MemSet(dc->body,val,(dc->width_internal*dc->height)>>1);
|
||||
@@ -26,7 +27,7 @@ public U0 DCFill(CDC *dc=NULL,CColorROPU32 val=COLOR_TRANSPARENT)
|
||||
|
||||
public U0 DCClear(CDC *dc=NULL)
|
||||
{
|
||||
if (!dc) dc=gr_dc2;
|
||||
if (!dc) dc=gr_dc;
|
||||
DCFill(dc,0);
|
||||
}
|
||||
|
||||
@@ -40,32 +41,48 @@ public U0 (*fp_wall_paper)(CTask *task)=NULL;
|
||||
|
||||
U0 WinZBufFill(CTask *task)
|
||||
{ //Not public
|
||||
I64 y,t,dc,l,r,w;
|
||||
I64 y,t,b,l,r,w;
|
||||
if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER)) {
|
||||
t= task->win_top-1>0
|
||||
? task->win_top-1 : 0,
|
||||
dc= task->win_bottom+1<TEXT_ROWS
|
||||
? task->win_bottom+1 : TEXT_ROWS-1,
|
||||
l= task->win_left-1>0
|
||||
? task->win_left-1 : 0,
|
||||
r= task->win_right+1<TEXT_COLS
|
||||
? task->win_right+1 : TEXT_COLS-1;
|
||||
if (task->win_top-1>0)
|
||||
t=task->win_top-1;
|
||||
else
|
||||
t=0;
|
||||
if (task->win_bottom+1<TEXT_ROWS)
|
||||
b=task->win_bottom+1;
|
||||
else
|
||||
b=TEXT_ROWS-1;
|
||||
if (task->win_left-1>0)
|
||||
l=task->win_left-1;
|
||||
else
|
||||
l=0;
|
||||
if (task->win_right+1<TEXT_COLS)
|
||||
r=task->win_right+1;
|
||||
else
|
||||
r=TEXT_COLS-1;
|
||||
} else {
|
||||
t= task->win_top>0
|
||||
? task->win_top : 0,
|
||||
dc= task->win_bottom<TEXT_ROWS
|
||||
? task->win_bottom : TEXT_ROWS-1,
|
||||
l= task->win_left>0
|
||||
? task->win_left : 0,
|
||||
r= task->win_right<TEXT_COLS
|
||||
? task->win_right : TEXT_COLS-1;
|
||||
if (task->win_top>0)
|
||||
t=task->win_top;
|
||||
else
|
||||
t=0;
|
||||
if (task->win_bottom<TEXT_ROWS)
|
||||
b=task->win_bottom;
|
||||
else
|
||||
b=TEXT_ROWS-1;
|
||||
if (task->win_left>0)
|
||||
l=task->win_left;
|
||||
else
|
||||
l=0;
|
||||
if (task->win_right<TEXT_COLS)
|
||||
r=task->win_right;
|
||||
else
|
||||
r=TEXT_COLS-1;
|
||||
}
|
||||
t=LimitI64(t,0,TEXT_ROWS-1);
|
||||
dc=LimitI64(dc,t,TEXT_ROWS-1);
|
||||
b=LimitI64(b,t,TEXT_ROWS-1);
|
||||
l=LimitI64(l,0,TEXT_COLS-1);
|
||||
r=LimitI64(r,l,TEXT_COLS-1);
|
||||
if (w=r-l+1)
|
||||
for (y=t;y<=dc;y++)
|
||||
for (y=t;y<=b;y++)
|
||||
MemSetU16(gr_win_z_buf(U8 *)+(y*TEXT_COLS+l)*sizeof(U16),
|
||||
task->win_z_num,w);
|
||||
}
|
||||
@@ -101,36 +118,29 @@ public U0 WinZBufUpdate()
|
||||
#help_index "Graphics/Char;Char"
|
||||
public U0 WinTextFill(I64 d,CTask *task=NULL)
|
||||
{
|
||||
I64 y,w,t,b,l,r;
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return;
|
||||
I64 y,w,
|
||||
t= task->win_top>0
|
||||
? task->win_top : 0,
|
||||
dc= task->win_bottom<TEXT_ROWS
|
||||
? task->win_bottom : TEXT_ROWS-1,
|
||||
l= task->win_left>0
|
||||
? task->win_left : 0,
|
||||
r= task->win_right<TEXT_COLS
|
||||
? task->win_right : TEXT_COLS-1;
|
||||
if (task->win_top>0)
|
||||
t=task->win_top;
|
||||
else
|
||||
t=0;
|
||||
if (task->win_bottom<TEXT_ROWS)
|
||||
b=task->win_bottom;
|
||||
else
|
||||
b=TEXT_ROWS-1;
|
||||
if (task->win_left>0)
|
||||
l=task->win_left;
|
||||
else
|
||||
l=0;
|
||||
if (task->win_right<TEXT_COLS)
|
||||
r=task->win_right;
|
||||
else
|
||||
r=TEXT_COLS-1;
|
||||
if (w=r-l+1)
|
||||
for (y=t;y<=dc;y++)
|
||||
for (y=t;y<=b;y++)
|
||||
MemSetU32(gr_text_base(U8 *)+(y*TEXT_COLS+l)*sizeof(U32),
|
||||
d,w);
|
||||
}
|
||||
|
||||
public U0 WinTextClear(CTask *task=NULL)
|
||||
{
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return;
|
||||
WinTextFill(task->text_attr<<8,task);
|
||||
}
|
||||
|
||||
public U0 SetWinBkColor(I64 c,CTask *task=NULL)
|
||||
{
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return;
|
||||
task->text_attr=task->text_attr&0x0F | c<<4;
|
||||
WinTextFill(c<<12,task);
|
||||
d,w);
|
||||
}
|
||||
|
||||
#help_index "Graphics/Color"
|
||||
@@ -340,7 +350,7 @@ U0 GrSetUpTables()
|
||||
gr_refresh_time_stamps[i]=tT;
|
||||
}
|
||||
|
||||
U0 GrInit()
|
||||
U0 GrInit4()
|
||||
{
|
||||
SetStdPalette;
|
||||
fp_set_std_palette=&SetStdPalette;
|
||||
@@ -355,12 +365,12 @@ U0 GrInit()
|
||||
gr_win_uncovered_bitmap=CAlloc(65536/8);
|
||||
gr_highest_uncovered=0;
|
||||
|
||||
gr_dc=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
gr_dc->flags|=DCF_SCREEN_BITMAP;
|
||||
gr_dc_cache=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
|
||||
gr_dc2=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
gr_dc2->flags|=DCF_SCREEN_BITMAP;
|
||||
gr_dc_cache=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
|
||||
gr_dc=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
gr_dc->flags|=DCF_SCREEN_BITMAP;
|
||||
DCFill;
|
||||
|
||||
gr_dc1=DCNew(DCT_COLOR4,GR_WIDTH,GR_HEIGHT);
|
||||
@@ -401,7 +411,7 @@ U0 GrUpdateWins()
|
||||
try {
|
||||
if (!Bt(&task->display_flags,DISPLAYf_NO_BORDER))
|
||||
DrawTaskBorder(task);
|
||||
WinTextClear(task);
|
||||
WinTextFill(task->text_attr<<8,task);
|
||||
Preempt(old_preempt);
|
||||
if (task==sys_winmgr_task) {
|
||||
if (fp_wall_paper)
|
||||
@@ -412,7 +422,7 @@ U0 GrUpdateWins()
|
||||
}
|
||||
if (TaskValidate(task)) {
|
||||
if (task->draw_it) {
|
||||
dc=DCAlias(gr_dc,task);
|
||||
dc=DCAlias(gr_dc2,task);
|
||||
(*task->draw_it)(task,dc);
|
||||
DCDel(dc);
|
||||
}
|
||||
@@ -573,8 +583,8 @@ U0 GrZoomInScreen()
|
||||
|
||||
U0 GrUpdateBackgroundOfText()
|
||||
{
|
||||
I64 reg RSI *dst=gr_dc->body,reg R13 c,row,col,,cur_ch,
|
||||
reg R12 w1=gr_dc->width_internal,reg R10 w2=-7*w1+8,w3=7*w1,
|
||||
I64 reg RSI *dst=gr_dc2->body,reg R13 c,row,col,,cur_ch,
|
||||
reg R12 w1=gr_dc2->width_internal,reg R10 w2=-7*w1+8,w3=7*w1,
|
||||
reg *my_1_to_8_colors=gr_1_to_8_colors;
|
||||
U32 reg *src=gr_text_base;
|
||||
$HL,1$ Bool blink_flag=Blink;
|
||||
@@ -628,10 +638,10 @@ asm {
|
||||
U0 GrUpdateForegroundOfText()
|
||||
{
|
||||
U32 *src=gr_text_base;
|
||||
I64 i,j,cur_ch,reg *dst=gr_dc->body,
|
||||
reg w1=gr_dc->width_internal,w2=7*w1,
|
||||
I64 i,j,cur_ch,reg *dst=gr_dc2->body,
|
||||
reg w1=gr_dc2->width_internal,w2=7*w1,
|
||||
row,col;
|
||||
U8 *dst_start=gr_dc->body,*dst_end=dst_start+w1*gr_dc->height-7*w1-8;
|
||||
U8 *dst_start=gr_dc2->body,*dst_end=dst_start+w1*gr_dc2->height-7*w1-8;
|
||||
Bool blink_flag=Blink;
|
||||
for (row=TEXT_ROWS;row--;) {
|
||||
for (col=TEXT_COLS;col--;) {
|
||||
@@ -762,10 +772,10 @@ U0 GrUpdateScreen()
|
||||
GrUpdateBackgroundOfText;
|
||||
GrUpdateForegroundOfText;
|
||||
GrUpdateWins;
|
||||
DCBlotColor8(gr_dc,gr_dc2);
|
||||
DCBlotColor8(gr_dc2,gr_dc);
|
||||
}
|
||||
|
||||
dc=DCAlias(gr_dc,Fs);
|
||||
dc=DCAlias(gr_dc2,Fs);
|
||||
dc->flags|=DCF_ON_TOP;
|
||||
if (fp_final_screen_update)
|
||||
(*fp_final_screen_update)(dc);
|
||||
@@ -774,8 +784,8 @@ U0 GrUpdateScreen()
|
||||
if (text_mode)
|
||||
GrUpdateTextModeText;
|
||||
else {
|
||||
DCBlotColor4(gr_dc1->body,gr_dc->body,gr_dc_cache->body,
|
||||
gr_dc->height*gr_dc->width_internal>>3);
|
||||
DCBlotColor4(gr_dc1->body,gr_dc2->body,gr_dc_cache->body,
|
||||
gr_dc2->height*gr_dc2->width_internal>>3);
|
||||
GrUpdateVGAGraphics;
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
|
||||
@@ -6,7 +6,7 @@ each operation. The types available are lsted
|
||||
here, $LK,"GRST_PT","MN:GRST_PT"$. They are stored, one after another,
|
||||
in a chunk of memory terminated by a type $LK,"GRST_END","MN:GRST_END"$.
|
||||
|
||||
$LK,"SpritePlot3","MN:SpritePlot3"$() and $LK,"SpriteVect","MN:SpriteVect"$() shows how the
|
||||
$LK,"SpritePlot3","MN:SpritePlot3"$() and $LK,"SpriteMain","MN:SpriteMain"$() shows how the
|
||||
unions are used. It's kind-of a mess using a union.
|
||||
|
||||
$LK,"SpriteSize","MN:SpriteSize"$() will return the size of a single
|
||||
@@ -142,7 +142,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
case GRST_ELLIPSE:
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->rot_angle);
|
||||
break;
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
break;
|
||||
case GRST_POLYLINE:
|
||||
@@ -237,7 +237,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
p->y+=y;
|
||||
p->z+=z;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->vertex_cnt,&tempg->x2,tempg->triangle_cnt,(&tempg->x2)(U8 *)+sizeof(CD3I32)*tempg->vertex_cnt);
|
||||
Gr3Mesh(dc,tempg->vertex_cnt,&tempg->x2,tempg->tri_cnt,(&tempg->x2)(U8 *)+sizeof(CD3I32)*tempg->vertex_cnt);
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p->x-=x;
|
||||
@@ -258,15 +258,15 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
y1=tempg->y1+y;
|
||||
z1=tempg->z1+z;
|
||||
}
|
||||
p=(&tempg->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
p=(&tempg->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
Gr3Mesh(dc,tempg->shiftable_vertex_cnt,p,tempg->shiftable_triangle_cnt,p(U8 *)+sizeof(CD3I32)*tempg->shiftable_vertex_cnt);
|
||||
p=(&tempg->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
Gr3Mesh(dc,tempg->shiftable_vertex_cnt,p,tempg->shiftable_tri_cnt,p(U8 *)+sizeof(CD3I32)*tempg->shiftable_vertex_cnt);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
@@ -372,8 +372,6 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
//The two CSprite should be identical
|
||||
//except for points shifted around.
|
||||
//t ranges from 0.0 to 1.0
|
||||
//
|
||||
//See $LK-A,"::/TempleOS/Demo/Graphics/Golf.CPP"$ for an example.
|
||||
I64 i=SpriteSize(elems0),
|
||||
t1=gr_scale*t,t0=gr_scale-t1;
|
||||
I32 *ptr0,*ptr1,*ptrr;
|
||||
@@ -411,7 +409,7 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
tempgr->y1=(tempg0->y1*t0+tempg1->y1*t1)>>32;
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_REG_POLY:
|
||||
case GRST_POLYGON:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->width=(tempg0->width*t0+tempg1->width*t1)>>32;
|
||||
@@ -461,9 +459,9 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
}
|
||||
break;
|
||||
case GRST_SHIFTABLE_MESH:
|
||||
p0=(&tempg0->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
p1=(&tempg1->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
pr=(&tempgr->shiftable_triangle_cnt)(U8 *)+sizeof(I32);
|
||||
p0=(&tempg0->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
p1=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
pr=(&tempgr->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg0->shiftable_vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
@@ -488,7 +486,7 @@ public CDocEntry *DocPutSprite(CDoc *doc=NULL,U8 *elems,U8 *txt=NULL)
|
||||
Bool unlock;
|
||||
CDocEntry *doc_e;
|
||||
CDocBin *tempb;
|
||||
if (!doc && !(doc=DocCur)) return NULL;
|
||||
if (!doc && !(doc=DocPut)) return NULL;
|
||||
unlock=DocLock(doc);
|
||||
size=SpriteSize(elems);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
@@ -520,7 +518,7 @@ public CDocEntry *PutSprite(U8 *elems,U8 *txt=NULL)
|
||||
//and leave a %d for the number.
|
||||
|
||||
CDoc *doc;
|
||||
if (doc=DocCur)
|
||||
if (doc=DocPut)
|
||||
return DocPutSprite(doc,elems,txt);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1,486 +0,0 @@
|
||||
#help_index "Graphics/CGrVectMap"
|
||||
/*
|
||||
This processes a monocrome map, finds edges and generates vect graphic
|
||||
representations of the map broken into small rectangles. The rectangles
|
||||
are encoded a bit-oriented structure.
|
||||
|
||||
PolyLineStruct {
|
||||
1 Bit : set is valid polyline, clear is end of polyline lst
|
||||
(R_BITS) : X-coordinate of polyline start
|
||||
(R_BITS) : Y-coordinate of polyline start
|
||||
(poly_line_cnt_bits): Number of polyline direction entries
|
||||
N*3 : N-long seq of 1 pixel directional movements
|
||||
}
|
||||
|
||||
FloodFillStruct {
|
||||
1 Bit : set is valid flood fill entry, clear is end of floodfill lst
|
||||
(1+R_BITS): X-coordinate*2 of flood fill (half pixels)
|
||||
(1+R_BITS): Y-coordinate*2 of flood fill (half pixels)
|
||||
}
|
||||
|
||||
Rect {
|
||||
1 Bit : set is valid rectangle entry, clear is end of rectangle lst
|
||||
PolyLineStructLst
|
||||
FloodFillStructLst
|
||||
}
|
||||
*/
|
||||
|
||||
#define R_BITS 6
|
||||
#define R_BORDER 1
|
||||
#define R_WIDTH (1<<R_BITS-2*R_BORDER)
|
||||
#define R_HEIGHT (1<<R_BITS-2*R_BORDER)
|
||||
|
||||
U0 VectMapBlotRect(CDC *dc,CGrVectMap *vm,I64 bit,F64 scale)
|
||||
{
|
||||
I64 k,cnt,i0,j0,i,j,rect_dft,not_rect_dft;
|
||||
U8 *body=vm->body;
|
||||
F64 d=scale/2;
|
||||
dc->pen_width=scale+0.5;
|
||||
dc->color=rect_dft=Bt(body,bit++);
|
||||
not_rect_dft=1-rect_dft;
|
||||
|
||||
dc->bkcolor=vm->bkcolor;
|
||||
GrRect(dc,0,0,dc->width,dc->height);
|
||||
|
||||
dc->color=not_rect_dft;
|
||||
while (Bt(body,bit++)) {
|
||||
j=BFieldExtU32(body,bit,R_BITS);
|
||||
bit+=R_BITS;
|
||||
i=BFieldExtU32(body,bit,R_BITS);
|
||||
bit+=R_BITS;
|
||||
cnt=BFieldExtU32(body,bit,vm->poly_line_cnt_bits);
|
||||
bit+=vm->poly_line_cnt_bits;
|
||||
if (!cnt)
|
||||
GrPlot3(dc,(j-R_BORDER)*scale+d,(i-R_BORDER)*scale+d,0);
|
||||
else {
|
||||
i0=i;j0=j;
|
||||
while (cnt--) {
|
||||
k=BFieldExtU32(body,bit,3);
|
||||
bit+=3;
|
||||
i+=gr_y_offsets[k];
|
||||
j+=gr_x_offsets[k];
|
||||
GrLine3(dc,(j0-R_BORDER)*scale+d,(i0-R_BORDER)*scale+d,0,
|
||||
(j-R_BORDER)*scale+d,(i-R_BORDER)*scale+d,0);
|
||||
i0=i; j0=j;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (Bt(body,bit++)) {
|
||||
j=BFieldExtU32(body,bit,R_BITS+1);
|
||||
bit+=R_BITS+1;
|
||||
i=BFieldExtU32(body,bit,R_BITS+1);
|
||||
bit+=R_BITS+1;
|
||||
if (GrPeek(dc,(j/2.0-R_BORDER)*scale+d,(i/2.0-R_BORDER)*scale+d)==rect_dft)
|
||||
GrFloodFill(dc,(j/2.0-R_BORDER)*scale+d,(i/2.0-R_BORDER)*scale+d);
|
||||
}
|
||||
}
|
||||
|
||||
class CMPVMBlot
|
||||
{
|
||||
CDC *dc,*rect_dc;
|
||||
CGrVectMap *vm;
|
||||
I64 bit;
|
||||
I64 xx,yy;
|
||||
F64 scale;
|
||||
I64 busy;
|
||||
};
|
||||
|
||||
|
||||
U0 VectMapBlotRectMP(CMPVMBlot *mp)
|
||||
{
|
||||
VectMapBlotRect(mp->rect_dc,mp->vm,mp->bit,mp->scale);
|
||||
GrBlot(mp->dc,mp->xx,mp->yy,mp->rect_dc);
|
||||
mp->busy=FALSE;
|
||||
}
|
||||
|
||||
|
||||
public U0 VectMapBlotMP(CDC *dc,I64 x,I64 y,CGrVectMap *vm,F64 scale=1.0,I64 _mp_cnt=0)
|
||||
{
|
||||
I64 i,i_lo,i_hi,j,j_lo,j_hi,k,cpu,pass,
|
||||
w=(vm->width +R_WIDTH-1)/R_WIDTH,
|
||||
h=(vm->height+R_HEIGHT-1)/R_HEIGHT;
|
||||
F64 xx,yy,r_scale=scale*(R_WIDTH+1.0/scale)/R_WIDTH;
|
||||
CMPVMBlot *mp;
|
||||
if (!dc || !vm) return;
|
||||
if (Gs->num)
|
||||
_mp_cnt=1; //Only core #0 can be master
|
||||
else if (!_mp_cnt)
|
||||
_mp_cnt=mp_cnt;
|
||||
else if (_mp_cnt>mp_cnt)
|
||||
_mp_cnt=mp_cnt;
|
||||
cpu=_mp_cnt-1;
|
||||
|
||||
mp=MAlloc(_mp_cnt*sizeof(CMPVMBlot));
|
||||
|
||||
for (i=0;i<_mp_cnt;i++) {
|
||||
mp[i].rect_dc=DCNew(DCT_COLOR8,R_WIDTH*r_scale,R_HEIGHT*r_scale,Fs);
|
||||
mp[i].dc=DCAlias(dc,dc->win_task);
|
||||
mp[i].dc->color=dc->color;
|
||||
mp[i].vm=vm;
|
||||
mp[i].scale=r_scale;
|
||||
mp[i].busy=FALSE;
|
||||
}
|
||||
|
||||
if (y<0)
|
||||
i_lo=-y/(R_HEIGHT*scale);
|
||||
else
|
||||
i_lo=0;
|
||||
if (R_HEIGHT*scale*h+y>dc->height)
|
||||
i_hi=MinI64((dc->height-y)/(R_HEIGHT*scale)+1,h);
|
||||
else
|
||||
i_hi=h;
|
||||
|
||||
if (x<0)
|
||||
j_lo=-x/(R_WIDTH*scale);
|
||||
else
|
||||
j_lo=0;
|
||||
if (R_WIDTH*scale*w+x>dc->width)
|
||||
j_hi=MinI64((dc->width-x)/(R_WIDTH*scale)+1,w);
|
||||
else
|
||||
j_hi=w;
|
||||
|
||||
xx=x+j_lo*R_WIDTH*scale;
|
||||
for (j=j_lo;j<j_hi;j++) {
|
||||
yy=y+i_lo*R_WIDTH*scale;
|
||||
k=i_lo*w+j;
|
||||
for (i=i_lo;i<i_hi;i++) {
|
||||
if (_mp_cnt>1) {
|
||||
pass=0;
|
||||
//Does up to two passes
|
||||
while (TRUE)
|
||||
if (!pass && !cpu) {
|
||||
pass++;
|
||||
cpu=_mp_cnt-1;
|
||||
} else if (mp[cpu].busy) //by the way, core #0 is never busy
|
||||
cpu--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
mp[cpu].xx=xx;
|
||||
mp[cpu].yy=yy;
|
||||
mp[cpu].bit=vm->rect_start_bits[k];
|
||||
if (!cpu)
|
||||
VectMapBlotRectMP(mp);
|
||||
else {
|
||||
mp[cpu].busy=TRUE;
|
||||
MPJob(&VectMapBlotRectMP,&mp[cpu],cpu);
|
||||
}
|
||||
k+=w;
|
||||
yy+=R_HEIGHT*scale;
|
||||
}
|
||||
xx+=R_WIDTH*scale;
|
||||
}
|
||||
for (i=_mp_cnt-1;i>=0;i--) {
|
||||
while(mp[i].busy)
|
||||
Yield;
|
||||
DCDel(mp[i].rect_dc);
|
||||
DCDel(mp[i].dc);
|
||||
}
|
||||
Free(mp);
|
||||
}
|
||||
|
||||
Bool IsSolidSquare(CDC *dc,I64 x,I64 y,I64 edge,CColorROPU32 color)
|
||||
{
|
||||
I64 i,j;
|
||||
edge>>=1;
|
||||
for (i=-edge;i<edge;i++)
|
||||
for (j=-edge;j<edge;j++)
|
||||
if (GrPeek(dc,x+j,y+i)!=color)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
I64 VectizeRect(CDC *dc,I64 _x,I64 _y,CGrVectMap *vm,I64 _bit,
|
||||
I64 poly_line_cnt_bits,I64 *_max_poly_line_cnt_bits)
|
||||
{ //Returns number of bits to represent rect
|
||||
CDC *b_desired =DCExtract(dc,_x-R_BORDER,_y-R_BORDER,_x+R_WIDTH+R_BORDER*2-1,_y+R_BORDER*2+R_HEIGHT-1),
|
||||
*b_edge=DCNew(DCT_COLOR8,R_WIDTH+R_BORDER*2,R_HEIGHT+R_BORDER*2,Fs),
|
||||
*b_actual,
|
||||
*b_link_check=DCNew(DCT_COLOR8,R_WIDTH+R_BORDER*2,R_HEIGHT+R_BORDER*2,Fs);
|
||||
I64 step,step_bits,x,y,xx,yy,xx1,yy1,xx2,yy2,cnt=0,k,kk,rect_dft,not_rect_dft,
|
||||
cnt_bit,link_bit1,link_bit2,link_bit_limit,bit=_bit,max_poly_line_cnt_bits;
|
||||
U8 *body=vm->body;
|
||||
Bool found;
|
||||
if (_max_poly_line_cnt_bits)
|
||||
max_poly_line_cnt_bits=*_max_poly_line_cnt_bits;
|
||||
else
|
||||
max_poly_line_cnt_bits=3;
|
||||
|
||||
//Count ON pixels
|
||||
for (y=0;y<R_HEIGHT;y++)
|
||||
for (x=0;x<R_WIDTH;x++)
|
||||
if (GrPeek(b_desired,R_BORDER+x,R_BORDER+y)==1)
|
||||
cnt++;
|
||||
|
||||
if (cnt>=R_WIDTH*R_HEIGHT/2)
|
||||
rect_dft=1;
|
||||
else
|
||||
rect_dft=0;
|
||||
not_rect_dft=1-rect_dft;
|
||||
|
||||
BEqu(body,bit++,rect_dft);
|
||||
|
||||
if (!cnt || cnt==R_WIDTH*R_HEIGHT) {
|
||||
//Rect is all ON or OFF
|
||||
Btr(body,bit++); //End of poly-line lst
|
||||
Btr(body,bit++); //End of flood-fill lst
|
||||
} else {
|
||||
for (y=0;y<R_HEIGHT+R_BORDER*2;y++)
|
||||
for (x=0;x<R_WIDTH+R_BORDER*2;x++) {
|
||||
b_edge->color=0;
|
||||
if (GrPeek(b_desired,x,y)==not_rect_dft)
|
||||
for (k=0;k<8;k++)
|
||||
if (GrPeek(b_desired,x+gr_x_offsets[k],y+gr_y_offsets[k])==rect_dft)
|
||||
b_edge->color=1;
|
||||
GrPlot(b_edge,x,y);
|
||||
}
|
||||
|
||||
b_edge->color=0;
|
||||
link_bit1=bit;
|
||||
for (y=0;y<R_HEIGHT+R_BORDER*2;y++)
|
||||
for (x=0;x<R_WIDTH+R_BORDER*2;x++)
|
||||
if (GrPeek(b_edge,x,y)==1) {
|
||||
Bts(body,bit++); //Show not end of poly-line lst
|
||||
GrPlot(b_edge,x,y);
|
||||
BFieldOrU32(body,bit,x); //Poly-line starting X coordinate in rect
|
||||
bit+=R_BITS;
|
||||
BFieldOrU32(body,bit,y); //Poly-line starting Y coordinate in rect
|
||||
bit+=R_BITS;
|
||||
yy=y; xx=x;
|
||||
cnt_bit=bit;
|
||||
bit+=poly_line_cnt_bits; //Reserve space for count of direction offsets in poly-line
|
||||
cnt=0;
|
||||
do {
|
||||
found=FALSE;
|
||||
for (k=0;k<8;k++) {
|
||||
yy2=yy+gr_y_offsets[k];
|
||||
xx2=xx+gr_x_offsets[k];
|
||||
if (0<=xx2<R_WIDTH+R_BORDER*2 &&
|
||||
0<=yy2<R_HEIGHT+R_BORDER*2 &&
|
||||
GrPeek(b_edge,xx2,yy2)==1) {
|
||||
cnt++;
|
||||
BFieldOrU32(body,bit,k); //3-bit (or 2) incoding of direction movement
|
||||
bit+=3;
|
||||
GrPlot(b_edge,xx2,yy2);
|
||||
yy=yy2; xx=xx2;
|
||||
found=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (found);
|
||||
BFieldOrU32(body,cnt_bit,cnt);
|
||||
if (cnt && Bsr(cnt)+1>max_poly_line_cnt_bits)
|
||||
max_poly_line_cnt_bits=Bsr(cnt)+1;
|
||||
}
|
||||
|
||||
//Connect adjacent groups with link to prevent flood-fill leaks.
|
||||
link_bit_limit=bit;
|
||||
while (link_bit1<link_bit_limit) {
|
||||
link_bit1++;
|
||||
x=BFieldExtU32(body,link_bit1,R_BITS);
|
||||
link_bit1+=R_BITS;
|
||||
y=BFieldExtU32(body,link_bit1,R_BITS);
|
||||
link_bit1+=R_BITS;
|
||||
|
||||
link_bit2=link_bit1;
|
||||
yy=y;xx=x;
|
||||
cnt=BFieldExtU32(body,link_bit2,poly_line_cnt_bits);
|
||||
link_bit2+=poly_line_cnt_bits;
|
||||
while (TRUE) {
|
||||
for (k=0;k<8;k++) {
|
||||
yy2=yy+gr_y_offsets[k];
|
||||
xx2=xx+gr_x_offsets[k];
|
||||
if (0<=xx2<R_WIDTH+R_BORDER*2 &&
|
||||
0<=yy2<R_HEIGHT+R_BORDER*2 &&
|
||||
GrPeek(b_link_check,xx2,yy2)==1) {
|
||||
Bts(body,bit++);
|
||||
BFieldOrU32(body,bit,xx);
|
||||
bit+=R_BITS;
|
||||
BFieldOrU32(body,bit,yy);
|
||||
bit+=R_BITS;
|
||||
BFieldOrU32(body,bit,1);
|
||||
bit+=poly_line_cnt_bits;
|
||||
BFieldOrU32(body,bit,k);
|
||||
bit+=3;
|
||||
}
|
||||
}
|
||||
if (!cnt--)
|
||||
break;
|
||||
kk=BFieldExtU32(body,link_bit2,3);
|
||||
link_bit2+=3;
|
||||
yy+=gr_y_offsets[kk];
|
||||
xx+=gr_x_offsets[kk];
|
||||
}
|
||||
|
||||
link_bit2=link_bit1;
|
||||
yy=y;xx=x;
|
||||
b_link_check->color=1;
|
||||
GrPlot(b_link_check,xx,yy);
|
||||
cnt=BFieldExtU32(body,link_bit2,poly_line_cnt_bits);
|
||||
link_bit2+=poly_line_cnt_bits;
|
||||
while (cnt--) {
|
||||
kk=BFieldExtU32(body,link_bit2,3);
|
||||
link_bit2+=3;
|
||||
yy+=gr_y_offsets[kk];
|
||||
xx+=gr_x_offsets[kk];
|
||||
GrPlot(b_link_check,xx,yy);
|
||||
}
|
||||
|
||||
link_bit1=link_bit2;
|
||||
}
|
||||
Btr(body,bit++); //End of poly-line lst
|
||||
|
||||
b_desired->color=rect_dft;
|
||||
GrLineRect4(b_desired,0,0,R_WIDTH+2*R_BORDER-1,R_HEIGHT+2*R_BORDER-1);
|
||||
Btr(body,bit); //Temp end of flood-fill lst
|
||||
|
||||
for (step_bits=2;step_bits>=1;step_bits-=1) {
|
||||
step=1<<step_bits;
|
||||
b_actual=DCNew(DCT_COLOR8,R_WIDTH/step,R_HEIGHT/step,Fs);
|
||||
VectMapBlotRect(b_actual,vm,_bit,1.0/step);
|
||||
|
||||
b_actual->color=not_rect_dft;
|
||||
GrLineRect4(b_actual,0,0,R_WIDTH+2*R_BORDER-1,R_HEIGHT+2*R_BORDER-1);
|
||||
|
||||
//Flood fill
|
||||
for (y=R_BORDER;y<R_HEIGHT+R_BORDER;y+=step)
|
||||
for (x=R_BORDER;x<R_WIDTH+R_BORDER;x+=step)
|
||||
if (IsSolidSquare(b_desired,x,y,step,not_rect_dft) && GrPeek(b_actual,x>>step_bits,y>>step_bits)==rect_dft) {
|
||||
Bts(body,bit++); //Show not end of flood-fill lst
|
||||
yy=y; xx=x;
|
||||
for (k=0;k<4;k++) {
|
||||
yy2=yy;
|
||||
while (yy2<R_HEIGHT+R_BORDER-1 &&
|
||||
IsSolidSquare(b_desired,xx,yy2,step,not_rect_dft) && GrPeek(b_actual,xx>>step_bits,yy2>>step_bits)==rect_dft)
|
||||
yy2++;
|
||||
while (yy>R_BORDER &&
|
||||
IsSolidSquare(b_desired,xx,yy,step,not_rect_dft) && GrPeek(b_actual,xx>>step_bits,yy>>step_bits)==rect_dft)
|
||||
yy--;
|
||||
yy1=yy+yy2;
|
||||
yy=yy1/2;
|
||||
|
||||
xx2=xx;
|
||||
while (xx2<R_WIDTH+R_BORDER-1 &&
|
||||
IsSolidSquare(b_desired,xx2,yy,step,not_rect_dft) && GrPeek(b_actual,xx2>>step_bits,yy>>step_bits)==rect_dft)
|
||||
xx2++;
|
||||
while (xx>R_BORDER &&
|
||||
IsSolidSquare(b_desired,xx,yy,step,not_rect_dft) && GrPeek(b_actual,xx>>step_bits,yy>>step_bits)==rect_dft)
|
||||
xx--;
|
||||
xx1=xx+xx2;
|
||||
xx=xx1/2;
|
||||
|
||||
}
|
||||
GrFloodFill(b_actual,xx>>step_bits,yy>>step_bits);
|
||||
BFieldOrU32(body,bit,xx1); //Flood fill X-coordinate in rect
|
||||
bit+=R_BITS+1;
|
||||
BFieldOrU32(body,bit,yy1); //Flood fill Y-coordinate in rect
|
||||
bit+=R_BITS+1;
|
||||
}
|
||||
DCDel(b_actual);
|
||||
Btr(body,bit); //Temp end of flood-fill lst
|
||||
}
|
||||
bit++; //End of flood-fill lst
|
||||
}
|
||||
|
||||
DCDel(b_desired);
|
||||
DCDel(b_edge);
|
||||
DCDel(b_link_check);
|
||||
|
||||
if (_max_poly_line_cnt_bits) *_max_poly_line_cnt_bits=max_poly_line_cnt_bits;
|
||||
|
||||
return bit-_bit;
|
||||
}
|
||||
|
||||
|
||||
#define TEMP_BODY_SIZE 0x10000
|
||||
public CGrVectMap *DC2VectMap(CDC *dc,CTask *mem_task=NULL,I64 *_size=NULL)
|
||||
{ //Currently does not convert outer 1 pixel border
|
||||
I64 i,j,k,cnt,size,
|
||||
w=(dc->width-R_BORDER*2+R_WIDTH-1)/R_WIDTH,
|
||||
h=(dc->height-R_BORDER*2+R_HEIGHT-1)/R_HEIGHT,
|
||||
rect_cnt=w*h,poly_line_cnt_bits=12,max_poly_line_cnt_bits=3;
|
||||
U32 *rect_start_bits;
|
||||
U8 *body;
|
||||
CGrVectMap *result,tempv;
|
||||
|
||||
body=MAlloc(TEMP_BODY_SIZE);
|
||||
|
||||
//Pass 1: Get max_poly_line_cnt_bits
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++) {
|
||||
MemSet(&tempv,0,sizeof(CGrVectMap));
|
||||
MemSet(body,0,TEMP_BODY_SIZE);
|
||||
tempv.width =dc->width-R_BORDER*2;
|
||||
tempv.height=dc->height-R_BORDER*2;
|
||||
tempv.body=body;
|
||||
tempv.rect_cnt=rect_cnt;
|
||||
tempv.r_bits=R_BITS;
|
||||
tempv.poly_line_cnt_bits=poly_line_cnt_bits;
|
||||
VectizeRect(dc,R_BORDER+j*R_WIDTH,R_BORDER+i*R_HEIGHT,&tempv,0,poly_line_cnt_bits,&max_poly_line_cnt_bits);
|
||||
}
|
||||
|
||||
//Pass 2: Get cnt
|
||||
poly_line_cnt_bits=max_poly_line_cnt_bits;
|
||||
cnt=0;
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++) {
|
||||
MemSet(&tempv,0,sizeof(CGrVectMap));
|
||||
MemSet(body,0,TEMP_BODY_SIZE);
|
||||
tempv.width =dc->width-R_BORDER*2;
|
||||
tempv.height=dc->height-R_BORDER*2;
|
||||
tempv.body=body;
|
||||
tempv.rect_cnt=rect_cnt;
|
||||
tempv.r_bits=R_BITS;
|
||||
tempv.poly_line_cnt_bits=poly_line_cnt_bits;
|
||||
cnt+=VectizeRect(dc,R_BORDER+j*R_WIDTH,R_BORDER+i*R_HEIGHT,&tempv,0,poly_line_cnt_bits,NULL);
|
||||
}
|
||||
Free(body);
|
||||
|
||||
//Pass 3
|
||||
size=(cnt+7)/8;
|
||||
result=CAlloc(sizeof(CGrVectMap),mem_task);
|
||||
result->body=CAlloc(size,mem_task);
|
||||
rect_start_bits=MAlloc((rect_cnt+1)*sizeof(U32),mem_task);
|
||||
result->width =dc->width-R_BORDER*2;
|
||||
result->height=dc->height-R_BORDER*2;
|
||||
result->rect_cnt=rect_cnt;
|
||||
result->r_bits=R_BITS;
|
||||
result->poly_line_cnt_bits=poly_line_cnt_bits;
|
||||
result->rect_start_bits=rect_start_bits;
|
||||
k=0;
|
||||
cnt=0;
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++) {
|
||||
rect_start_bits[k++]=cnt;
|
||||
cnt+=VectizeRect(dc,R_BORDER+j*R_WIDTH,R_BORDER+i*R_HEIGHT,result,cnt,poly_line_cnt_bits,NULL);
|
||||
}
|
||||
rect_start_bits[k]=cnt;
|
||||
|
||||
if (_size) *_size=size;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 VectMapDel(CGrVectMap *vm)
|
||||
{
|
||||
Free(vm->rect_start_bits);
|
||||
Free(vm->body);
|
||||
Free(vm);
|
||||
}
|
||||
|
||||
U32 *VectMapRectStartBits(CGrVectMap *vm,CTask *mem_task=NULL)
|
||||
{
|
||||
I64 k=0,bit=0;
|
||||
U8 *body=vm->body;
|
||||
U32 *result=MAlloc((vm->rect_cnt+1)*sizeof(U32),mem_task);
|
||||
for (k=0;k<vm->rect_cnt;k++) {
|
||||
result[k]=bit++;
|
||||
while (Bt(body,bit++)) {
|
||||
bit+=2*R_BITS;
|
||||
bit+=vm->poly_line_cnt_bits+3*BFieldExtU32(body,bit,vm->poly_line_cnt_bits);
|
||||
}
|
||||
while (Bt(body,bit++))
|
||||
bit+=2*(R_BITS+1);
|
||||
}
|
||||
result[k]=bit;
|
||||
return result;
|
||||
}
|
||||
+163
-79
@@ -5,7 +5,84 @@ public I64 gr_x_offsets[8]={-1, 0, 1,-1,1,-1,0,1},
|
||||
gr_x_offsets2[4]={ 0,-1, 1, 0},
|
||||
gr_y_offsets2[4]={-1, 0, 0, 1};
|
||||
|
||||
public Bool Line(U8 *aux_data,
|
||||
public I64 Line(U8 *aux_data,
|
||||
I64 x1,I64 y1,I64 z1,
|
||||
I64 x2,I64 y2,I64 z2,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
I64 step=1,I64 start=0)
|
||||
{
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 i,j,d,dx=x2-x1,dy=y2-y1,dz=z2-z1,_x,_y,_z,
|
||||
adx=AbsI64(dx),ady=AbsI64(dy),adz=AbsI64(dz),result=0;
|
||||
Bool first=TRUE;
|
||||
if (adx>=ady) {
|
||||
if (adx>=adz) {
|
||||
if (d=adx) {
|
||||
if (dx>=0)
|
||||
dx=0x100000000;
|
||||
else
|
||||
dx=-0x100000000;
|
||||
dy=dy<<32/d;
|
||||
dz=dz<<32/d;
|
||||
}
|
||||
} else {
|
||||
if (d=adz) {
|
||||
dx=dx<<32/d;
|
||||
dy=dy<<32/d;
|
||||
if (dz>=0)
|
||||
dz=0x100000000;
|
||||
else
|
||||
dz=-0x100000000;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ady>=adz) {
|
||||
if (d=ady) {
|
||||
dx=dx<<32/d;
|
||||
if (dy>=0)
|
||||
dy=0x100000000;
|
||||
else
|
||||
dy=-0x100000000;
|
||||
dz=dz<<32/d;
|
||||
}
|
||||
} else {
|
||||
if (d=adz) {
|
||||
dx=dx<<32/d;
|
||||
dy=dy<<32/d;
|
||||
if (dz>=0)
|
||||
dz=0x100000000;
|
||||
else
|
||||
dz=-0x100000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
x1<<=32; y1<<=32; z1<<=32;
|
||||
for (j=0;j<start;j++) {
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
if (step!=1 && step!=0) {
|
||||
dx*=step;
|
||||
dy*=step;
|
||||
dz*=step;
|
||||
d/=step;
|
||||
}
|
||||
for (i=start;i<=d;i++) {
|
||||
if (_x!=x1.i32[1] || _y!=y1.i32[1] || _z!=z1.i32[1] || first) {
|
||||
if ((*fp_plot)(aux_data,x1.i32[1],y1.i32[1],z1.i32[1]))
|
||||
result++;
|
||||
}
|
||||
first=FALSE;
|
||||
_x=x1.i32[1]; _y=y1.i32[1]; _z=z1.i32[1];
|
||||
x1+=dx; y1+=dy; z1+=dz;
|
||||
}
|
||||
if (step==1 && (_x!=x2||_y!=y2||_z!=z2)) {
|
||||
if ((*fp_plot)(aux_data,x2,y2,z2))
|
||||
result++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool LOSLine(U8 *aux_data,
|
||||
I64 x1,I64 y1,I64 z1,
|
||||
I64 x2,I64 y2,I64 z2,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
@@ -82,14 +159,14 @@ public Bool Line(U8 *aux_data,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool Rect(U8 *aux_data,
|
||||
public I64 Rect(U8 *aux_data,
|
||||
I64 x1,I64 y1,I64 z1,
|
||||
I64 x2,I64 y2,I64 z2,
|
||||
I64 x3,I64 y3,I64 z3,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z))
|
||||
{
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
I64 i,j,
|
||||
I64 i,j,result=0,
|
||||
d1,dx1=x2-x1,dy1=y2-y1,dz1=z2-z1,
|
||||
d2,dx2=x3-x1,dy2=y3-y1,dz2=z3-z1,
|
||||
adx1=AbsI64(dx1),ady1=AbsI64(dy1),adz1=AbsI64(dz1),
|
||||
@@ -97,14 +174,28 @@ public Bool Rect(U8 *aux_data,
|
||||
last_x,last_y,last_z;
|
||||
Bool first=TRUE;
|
||||
|
||||
if (adx1>=ady1)
|
||||
d1=adx1>=adz1 ? adx1:adz1;
|
||||
else
|
||||
d1=ady1>=adz1 ? ady1:adz1;
|
||||
if (adx2>=ady2)
|
||||
d2=adx2>=adz2 ? adx2:adz2;
|
||||
else
|
||||
d2=ady2>=adz2 ? ady2:adz2;
|
||||
if (adx1>=ady1) {
|
||||
if (adx1>=adz1)
|
||||
d1=adx1;
|
||||
else
|
||||
d1=adz1;
|
||||
} else {
|
||||
if (ady1>=adz1)
|
||||
d1=ady1;
|
||||
else
|
||||
d1=adz1;
|
||||
}
|
||||
if (adx2>=ady2) {
|
||||
if (adx2>=adz2)
|
||||
d2=adx2;
|
||||
else
|
||||
d2=adz2;
|
||||
} else {
|
||||
if (ady2>=adz2)
|
||||
d2=ady2;
|
||||
else
|
||||
d2=adz2;
|
||||
}
|
||||
d1<<=1;
|
||||
d2<<=1;
|
||||
if (d1) {
|
||||
@@ -123,17 +214,16 @@ public Bool Rect(U8 *aux_data,
|
||||
for (j=0;j<=d1;j++) {
|
||||
x2=x1; y2=y1; z2=z1;
|
||||
for (i=0;i<=d2;i++) {
|
||||
if (x2.i32[1]!=last_x || y2.i32[1]!=last_y || z2.i32[1]!=last_z ||first) {
|
||||
if (!(*fp_plot)(aux_data,x2.i32[1],y2.i32[1],z2.i32[1]))
|
||||
return FALSE;
|
||||
}
|
||||
if ((x2.i32[1]!=last_x || y2.i32[1]!=last_y || z2.i32[1]!=last_z ||first) &&
|
||||
(*fp_plot)(aux_data,x2.i32[1],y2.i32[1],z2.i32[1]))
|
||||
result++;
|
||||
first=FALSE;
|
||||
last_x=x2.i32[1]; last_y=y2.i32[1]; last_z=z2.i32[1];
|
||||
x2+=dx2; y2+=dy2; z2+=dz2;
|
||||
}
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
}
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math/3D Transformation"
|
||||
@@ -471,7 +561,7 @@ public U0 GrLighting(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color
|
||||
v2.z=p3->z-p2->z;
|
||||
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the triangle joined at p2.
|
||||
//of the tri joined at p2.
|
||||
|
||||
vn_x=v1.y*v2.z-v1.z*v2.y;
|
||||
vn_y=v1.z*v2.x-v1.x*v2.z;
|
||||
@@ -523,7 +613,7 @@ public U0 GrLighting(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3,CColorROPU32 color
|
||||
#define SCALE2 8
|
||||
|
||||
#help_index "Graphics/Math"
|
||||
public Bool Circle(U8 *aux_data,
|
||||
public I64 Circle(U8 *aux_data,
|
||||
I64 cx,I64 cy,I64 cz,
|
||||
I64 radius,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
@@ -532,9 +622,9 @@ public Bool Circle(U8 *aux_data,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 i,j,len=Ceil(len_radians*radius),
|
||||
x,y,x1,y1,s1,s2,c;
|
||||
x,y,x1,y1,s1,s2,c,result=0;
|
||||
F64 t;
|
||||
if (radius<=0||!step) return TRUE;
|
||||
if (radius<=0||!step) return 0;
|
||||
t=1.0/radius;
|
||||
c=1<<SCALE1*Cos(t);
|
||||
if (step<0) {
|
||||
@@ -555,18 +645,18 @@ public Bool Circle(U8 *aux_data,
|
||||
x<<=SCALE2;
|
||||
y<<=SCALE2;
|
||||
for (i=0;i<=len;i+=step) {
|
||||
if (!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
return FALSE;
|
||||
if ((*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
result++;
|
||||
for (j=0;j<step;j++) {
|
||||
x1=(c*x+s1*y)>>SCALE1;
|
||||
y1=(s2*x+c*y)>>SCALE1;
|
||||
x=x1; y=y1;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool Ellipse(U8 *aux_data,
|
||||
public I64 Ellipse(U8 *aux_data,
|
||||
I64 cx,I64 cy,I64 cz,
|
||||
I64 x_radius,I64 y_radius,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
@@ -576,11 +666,12 @@ public Bool Ellipse(U8 *aux_data,
|
||||
F64 len_radians=2*ã)
|
||||
{
|
||||
I64 i,j,len,
|
||||
x,y,_x,_y,x1,y1,x2,y2, s1,s2,c, s12,s22,c2;
|
||||
x,y,_x,_y,x1,y1,x2,y2, s1,s2,c, s12,s22,c2,result;
|
||||
F64 t;
|
||||
Bool first=TRUE;
|
||||
if (x_radius<=0 || y_radius<=0 || !step)
|
||||
return TRUE;
|
||||
return 0;
|
||||
result=0;
|
||||
if (x_radius>=y_radius) {
|
||||
t=1.0/x_radius;
|
||||
len=Ceil(len_radians*x_radius);
|
||||
@@ -621,8 +712,8 @@ public Bool Ellipse(U8 *aux_data,
|
||||
|
||||
for (i=0;i<=len;i+=step) {
|
||||
if (x>>SCALE2!=_x || y>>SCALE2!=_y || first) {
|
||||
if (!(*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
return FALSE;
|
||||
if ((*fp_plot)(aux_data,cx+x>>SCALE2,cy+y>>SCALE2,cz))
|
||||
result++;
|
||||
}
|
||||
_x=x>>SCALE2; _y=y>>SCALE2; first=FALSE;
|
||||
for (j=0;j<step;j++) {
|
||||
@@ -635,10 +726,10 @@ public Bool Ellipse(U8 *aux_data,
|
||||
y=(s22*x1+c2*y1)>>SCALE1;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool RegPoly(U8 *aux_data,
|
||||
public I64 RegPoly(U8 *aux_data,
|
||||
I64 cx,I64 cy,I64 cz,
|
||||
I64 x_radius,I64 y_radius,I64 sides,
|
||||
Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),
|
||||
@@ -649,11 +740,13 @@ public Bool RegPoly(U8 *aux_data,
|
||||
{
|
||||
I64 i,n,x,y,x1,y1,x2,y2,
|
||||
xx1,yy1,xx2,yy2,
|
||||
s1,s2,c, s12,s22,c2;
|
||||
s1,s2,c, s12,s22,c2,result;
|
||||
F64 angle_step;
|
||||
|
||||
if (sides<=0 || x_radius<=0 || y_radius<=0)
|
||||
return TRUE;
|
||||
return 0;
|
||||
|
||||
result=0;
|
||||
|
||||
angle_step=2*ã/sides;
|
||||
n=len_radians*sides/(2*ã);
|
||||
@@ -694,11 +787,10 @@ public Bool RegPoly(U8 *aux_data,
|
||||
y=(s22*x1+c2*y1)>>SCALE1;
|
||||
xx2=cx+x>>SCALE2;
|
||||
yy2=cy+y>>SCALE2;
|
||||
if (!Line(aux_data,xx1,yy1,cz,xx2,yy2,cz,fp_plot,step))
|
||||
return FALSE;
|
||||
result+=Line(aux_data,xx1,yy1,cz,xx2,yy2,cz,fp_plot,step);
|
||||
xx1=xx2; yy1=yy2;
|
||||
}
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/CD3I32;Math/CD3I32"
|
||||
@@ -718,9 +810,9 @@ public I64 P3I32SqrNorm(CD3I32 *p)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Math"
|
||||
public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
public I64 Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
{//2nd order
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max,result=0;
|
||||
F64 x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z,
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
@@ -729,10 +821,8 @@ public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
P3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first) {
|
||||
if (!(*fp_plot)(aux_data,xx,yy,zz))
|
||||
return FALSE;
|
||||
}
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
result++;
|
||||
for (t=0.0;t<=1.0;t+=s) {
|
||||
t1=t*(1.0-t);
|
||||
t2=t*t;
|
||||
@@ -752,22 +842,21 @@ public Bool Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
s*=1.1;
|
||||
else {
|
||||
s*=0.9;
|
||||
if (!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
if ((*fp_plot)(aux_data,x,y,z))
|
||||
result++;
|
||||
xx=x;yy=y;zz=z;
|
||||
}
|
||||
}
|
||||
x=ctrl[2].x; y=ctrl[2].y; z=ctrl[2].z;
|
||||
if (xx!=x || yy!=y || zz!=z) {
|
||||
if (!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if ((xx!=x || yy!=y || zz!=z) &&
|
||||
(*fp_plot)(aux_data,x,y,z))
|
||||
result++;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
public I64 Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool first=TRUE)
|
||||
{ //3rd order
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max;
|
||||
I64 x,y,z,xx,yy,zz,dx,dy,dz,d_max,result=0;
|
||||
F64 x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z,
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
@@ -778,10 +867,8 @@ public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
P3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first) {
|
||||
if (!(*fp_plot)(aux_data,xx,yy,zz))
|
||||
return FALSE;
|
||||
}
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
result++;
|
||||
for (t=0.0;t<=1.0;t+=s) {
|
||||
nt=1.0-t;
|
||||
t1=t*nt*nt;
|
||||
@@ -803,25 +890,26 @@ public Bool Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64
|
||||
s*=1.1;
|
||||
else {
|
||||
s*=0.9;
|
||||
if (!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
if ((*fp_plot)(aux_data,x,y,z))
|
||||
result++;
|
||||
xx=x;yy=y;zz=z;
|
||||
}
|
||||
}
|
||||
x=ctrl[3].x; y=ctrl[3].y; z=ctrl[3].z;
|
||||
if (xx!=x || yy!=y || zz!=z) {
|
||||
if (!(*fp_plot)(aux_data,x,y,z))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
if ((xx!=x || yy!=y || zz!=z) &&
|
||||
(*fp_plot)(aux_data,x,y,z))
|
||||
result++;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
public I64 BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
{ //2nd order
|
||||
I64 i,j;
|
||||
I64 i,j,result;
|
||||
CD3I32 *c;
|
||||
Bool first=TRUE;
|
||||
if (cnt<3) return TRUE;
|
||||
Bool first;
|
||||
if (cnt<3) return 0;
|
||||
first=TRUE;
|
||||
result=0;
|
||||
if (closed) {
|
||||
cnt++;
|
||||
c=MAlloc(sizeof(CD3I32)*(cnt*2-1));
|
||||
@@ -873,23 +961,22 @@ public Bool BSpline2(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I
|
||||
}
|
||||
}
|
||||
for (i=0;i<cnt*2-2;i+=2) {
|
||||
if (!Bezier2(aux_data,&c[i],fp_plot,first)) {
|
||||
Free(c);
|
||||
return FALSE;
|
||||
}
|
||||
result+=Bezier2(aux_data,&c[i],fp_plot,first);
|
||||
first=FALSE;
|
||||
}
|
||||
Free(c);
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
public I64 BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I64 x,I64 y,I64 z),Bool closed=FALSE)
|
||||
{ //3rd order
|
||||
I64 i,j;
|
||||
I64 i,j,result;
|
||||
F64 x,y,z;
|
||||
CD3I32 *c;
|
||||
Bool first=TRUE;
|
||||
if (cnt<3) return TRUE;
|
||||
Bool first;
|
||||
if (cnt<3) return 0;
|
||||
first=TRUE;
|
||||
result=0;
|
||||
if (closed) {
|
||||
cnt++;
|
||||
c=MAlloc(sizeof(CD3I32)*(cnt*3-2));
|
||||
@@ -963,14 +1050,11 @@ public Bool BSpline3(U8 *aux_data,CD3I32 *ctrl,I64 cnt,Bool (*fp_plot)(U8 *aux,I
|
||||
}
|
||||
}
|
||||
for (i=0;i<cnt*3-3;i+=3) {
|
||||
if (!Bezier3(aux_data,&c[i],fp_plot,first)) {
|
||||
Free(c);
|
||||
return FALSE;
|
||||
}
|
||||
result+=Bezier3(aux_data,&c[i],fp_plot,first);
|
||||
first=FALSE;
|
||||
}
|
||||
Free(c);
|
||||
return TRUE;
|
||||
return result;
|
||||
}
|
||||
|
||||
#define CC_LEFT 1
|
||||
|
||||
Reference in new issue
Block a user