TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
+42
-48
@@ -1,54 +1,48 @@
|
||||
#help_index "Graphics"
|
||||
U0 GrInit1()
|
||||
{
|
||||
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\0Polygon\0Planar Symmetry\0"
|
||||
"Dither Color 8Bit\0Rotated Rect\0Mesh\0Shiftable Mesh\0"
|
||||
"Transform On\0Transform Off\0Arrow\0Text Box\0Text Diamond\0");
|
||||
DefineLstLoad("ST_SPRITE_TYPES",
|
||||
"End\0Color 8Bit\0Dither Color 8Bit\0"
|
||||
"Width\0Planar Symmetry\0Transform On\0Transform Off\0Shift\0"
|
||||
"Point\0PolyPoint\0Line\0PolyLine\0Rect\0Rotated Rect\0"
|
||||
"Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0BSpline3\0BSpline3 Closed\0"
|
||||
"Flood Fill\0Flood Fill Not Color\0BitMap 8Bit\0Mesh\0Shiftable Mesh\0"
|
||||
"Arrow\0Text\0Text Box\0Text Diamond\0");
|
||||
}
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/CSprite"
|
||||
#define GRST_END 0
|
||||
//Unused
|
||||
#define GRST_COLOR8 2
|
||||
//Unused
|
||||
#define GRST_PT 4
|
||||
#define GRST_LINE 5
|
||||
#define GRST_POLYLINE 6
|
||||
#define GRST_POLYPT 7
|
||||
#define GRST_WIDTH 8
|
||||
#define GRST_SHIFT 9
|
||||
#define GRST_BSPLINE2 10
|
||||
#define GRST_BSPLINE3 11
|
||||
#define GRST_BSPLINE2_CLOSED 12
|
||||
#define GRST_BSPLINE3_CLOSED 13
|
||||
//Unused
|
||||
//Unused
|
||||
//Unused
|
||||
#define GRST_RECT 17
|
||||
#define GRST_CIRCLE 18
|
||||
#define GRST_FLOOD_FILL_NOT 19
|
||||
#define GRST_FLOOD_FILL 20
|
||||
#define GRST_BITMAP8 21
|
||||
//Unused
|
||||
#define GRST_TEXT 23
|
||||
#define GRST_ELLIPSE 24
|
||||
#define GRST_POLYGON 25
|
||||
#define GRST_PLANAR_SYMMETRY 26
|
||||
#define GRST_DITHER_COLOR8 27
|
||||
#define GRST_ROTATED_RECT 28
|
||||
#define GRST_MESH 29
|
||||
#define GRST_SHIFTABLE_MESH 30
|
||||
#define GRST_TRANSFORM_ON 31
|
||||
#define GRST_TRANSFORM_OFF 32
|
||||
#define GRST_ARROW 33
|
||||
#define GRST_TEXT_BOX 34
|
||||
#define GRST_TEXT_DIAMOND 35
|
||||
#define GRST_NUM_TYPES 36
|
||||
#define GRST_COLOR8 1
|
||||
#define GRST_DITHER_COLOR8 2
|
||||
#define GRST_WIDTH 3
|
||||
#define GRST_PLANAR_SYMMETRY 4
|
||||
#define GRST_TRANSFORM_ON 5
|
||||
#define GRST_TRANSFORM_OFF 6
|
||||
#define GRST_SHIFT 7
|
||||
#define GRST_PT 8
|
||||
#define GRST_POLYPT 9
|
||||
#define GRST_LINE 10
|
||||
#define GRST_POLYLINE 11
|
||||
#define GRST_RECT 12
|
||||
#define GRST_ROTATED_RECT 13
|
||||
#define GRST_CIRCLE 14
|
||||
#define GRST_ELLIPSE 15
|
||||
#define GRST_POLYGON 16
|
||||
#define GRST_BSPLINE2 17
|
||||
#define GRST_BSPLINE2_CLOSED 18
|
||||
#define GRST_BSPLINE3 19
|
||||
#define GRST_BSPLINE3_CLOSED 20
|
||||
#define GRST_FLOOD_FILL 21
|
||||
#define GRST_FLOOD_FILL_NOT 22
|
||||
#define GRST_BITMAP8 23
|
||||
#define GRST_MESH 24
|
||||
#define GRST_SHIFTABLE_MESH 25
|
||||
#define GRST_ARROW 26
|
||||
#define GRST_TEXT 27
|
||||
#define GRST_TEXT_BOX 28
|
||||
#define GRST_TEXT_DIAMOND 29
|
||||
#define GRST_NUM_TYPES 30
|
||||
|
||||
class CMeshTri
|
||||
{
|
||||
@@ -116,11 +110,11 @@ extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
|
||||
#define GE_EXIT 0
|
||||
#define GE_CONT 1
|
||||
|
||||
#include "CSpriteNew"
|
||||
#include "SpriteNew"
|
||||
#include "GrSpritePlot"
|
||||
#include "CSpriteMesh"
|
||||
#include "CSpriteBitMap"
|
||||
#include "CSpriteEd"
|
||||
#include "CSpriteMain"
|
||||
#include "SpriteMesh"
|
||||
#include "SpriteBitMap"
|
||||
#include "SpriteEd"
|
||||
#include "SpriteMain"
|
||||
#help_index ""
|
||||
|
||||
+22
-22
@@ -12,9 +12,9 @@ _PLOT_SCREEN_U8::
|
||||
ENTER 0
|
||||
MOV RBX,U64 SF_ARG2[RBP]
|
||||
MOV RAX,U64 SF_ARG3[RBP]
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
@@ -44,22 +44,22 @@ _PLOT_WIN_U8::
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG4[RBP]
|
||||
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
ADD RBX,U64 CTask.win_left[RCX]
|
||||
CMP RBX,U64 CTask.win_right[RCX]
|
||||
JG @@05
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
ADD RAX,U64 CTask.win_top[RCX]
|
||||
CMP RAX,U64 CTask.win_bottom[RCX]
|
||||
JG @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@05
|
||||
@@ -94,7 +94,7 @@ _PLOT_WIN_STR2::
|
||||
ADD RDI,U64 SF_ARG5[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
@@ -109,7 +109,7 @@ _PLOT_WIN_STR2::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
@@ -124,12 +124,12 @@ _PLOT_WIN_STR2::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG6[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@30
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@30
|
||||
@@ -171,7 +171,7 @@ _PLOT_ATTR_STR2::
|
||||
ADD RDI,U64 SF_ARG4[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
SHL RDI,2
|
||||
@@ -187,7 +187,7 @@ _PLOT_ATTR_STR2::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
SHL RDI,2
|
||||
@@ -203,12 +203,12 @@ _PLOT_ATTR_STR2::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG5[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@30
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@30
|
||||
@@ -248,7 +248,7 @@ _PLOT_ATTR::
|
||||
ADD RDI,U64 SF_ARG4[RBP]
|
||||
MOV RCX,U64 SF_ARG2[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
XOR RDI,RDI
|
||||
@@ -262,7 +262,7 @@ _PLOT_ATTR::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
XOR RDI,RDI
|
||||
@@ -276,12 +276,12 @@ _PLOT_ATTR::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG5[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@35
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@35
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@35
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@35
|
||||
@@ -293,7 +293,7 @@ _PLOT_ATTR::
|
||||
MOV RBX,U64 SF_ARG3[RBP]
|
||||
MOV RSI,RDI
|
||||
@@25: LODSD
|
||||
OR AL,AL
|
||||
TEST AL,AL
|
||||
JNZ @@30
|
||||
MOV RAX,RBX
|
||||
STOSD
|
||||
@@ -331,7 +331,7 @@ _PLOT_BORDER_U8::
|
||||
INC RDX
|
||||
CMP RBX,RDX
|
||||
JG @@05
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
@@ -344,7 +344,7 @@ _PLOT_BORDER_U8::
|
||||
INC RDX
|
||||
CMP RAX,RDX
|
||||
JG @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@05
|
||||
@@ -624,7 +624,7 @@ _GR_ROP_EQU_U8_NO_CLIPPING::
|
||||
JNC @@05
|
||||
MOV RBX,0xFF00000000000000
|
||||
OR RAX,RBX
|
||||
@@05: OR RAX,RAX
|
||||
@@05: TEST RAX,RAX
|
||||
JZ I32 @@10
|
||||
|
||||
PUSH RSI
|
||||
|
||||
@@ -831,8 +831,8 @@ public I64 GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
public I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{
|
||||
I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Use $LK,"GrPrint","MN:GrPrint"$()
|
||||
I64 x0,ch,result;
|
||||
if (!_s) return 0;
|
||||
x0=x;
|
||||
@@ -851,8 +851,8 @@ public I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Vertical text
|
||||
I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Vertical Text. Use $LK,"GrVPrint","MN:GrVPrint"$()
|
||||
I64 y0,result;
|
||||
U8 buf[2];
|
||||
if (!_s) return 0;
|
||||
@@ -874,18 +874,22 @@ public I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrPrintF(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
public I64 GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrPutS(dc,x,y,buf);
|
||||
I64 result;
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrVPrintF(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
public I64 GrVPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrVPutS(dc,x,y,buf);
|
||||
I64 result;
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrVPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -1089,7 +1093,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1100,7 +1104,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1122,11 +1126,11 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
gr_1_to_8_bits[0xAA]&gr_1_to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (probability_dither) {
|
||||
if (RandU16<dc->dither_probability)
|
||||
@@ -1221,7 +1225,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1232,7 +1236,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1245,11 +1249,11 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//See $LK,"SYS_BIOS_GR_MODE","FF:D:/TempleOS/Kernel/KStart.CPP,SYS_BIOS_GR_MODE:2"$
|
||||
//See $LK,"SysGrInit","MN:SysGrInit"$()
|
||||
|
||||
//This allows constants to be used
|
||||
//This allows consts to be used
|
||||
//instead of vars.
|
||||
DefinePrintF("BIOS_GR_MODE","%d",bios_gr_mode);
|
||||
DefinePrintF("GR_WIDTH","%d",gr_width);
|
||||
DefinePrintF("GR_HEIGHT","%d",gr_height);
|
||||
DefinePrintF("TEXT_ROWS","%d",text_rows);
|
||||
DefinePrintF("TEXT_COLS","%d",text_cols);
|
||||
DefinePrint("BIOS_GR_MODE","%d",bios_gr_mode);
|
||||
DefinePrint("GR_WIDTH","%d",gr_width);
|
||||
DefinePrint("GR_HEIGHT","%d",gr_height);
|
||||
DefinePrint("TEXT_ROWS","%d",text_rows);
|
||||
DefinePrint("TEXT_COLS","%d",text_cols);
|
||||
@@ -1,4 +1,29 @@
|
||||
#help_index "Graphics"
|
||||
public I64 GrRectB(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{
|
||||
if (x2<x1) SwapU64(&x1,&x2);
|
||||
if (y2<y1) SwapU64(&y1,&y2);
|
||||
return GrRect(dc,x1,y1,x2-x1+1,y2-y1+1);
|
||||
}
|
||||
|
||||
public I64 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
{ //Clipping and transformation
|
||||
CD3I32 poly[4];
|
||||
poly[0].x=x;
|
||||
poly[0].y=y;
|
||||
poly[0].z=z;
|
||||
poly[1].x=x+w;
|
||||
poly[1].y=y;
|
||||
poly[1].z=z;
|
||||
poly[2].x=x+w;
|
||||
poly[2].y=y+h;
|
||||
poly[2].z=z;
|
||||
poly[3].x=x;
|
||||
poly[3].y=y+h;
|
||||
poly[3].z=z;
|
||||
return GrFillPoly3(dc,4,poly);
|
||||
}
|
||||
|
||||
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+BLACK
|
||||
@@ -76,7 +101,7 @@ public I64 GrTextBox3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
w+=FONT_WIDTH;
|
||||
}
|
||||
if (w>w_max) w_max=w;
|
||||
result=GrPutS(dc,x1,y1,s);
|
||||
result=GrPrint(dc,x1,y1,"%s",s);
|
||||
result+=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
result+=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
result+=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
@@ -120,10 +145,10 @@ public I64 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+=GrPrint(dc,x1-w,y,"%s",st);
|
||||
first=FALSE;
|
||||
} else
|
||||
result+=GrPutS(dc,x1-w,y,st);
|
||||
result+=GrPrint(dc,x1-w,y,"%s",st);
|
||||
if (w) {
|
||||
w+=border;
|
||||
do {
|
||||
|
||||
@@ -41,7 +41,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
|
||||
public CDC *DCNew(I64 type,I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{ //This internally only allows widths which are divisible by 8
|
||||
//Don't forget these $MA+A-X+PU,"sizeof(CDC)","Grep(\"sizeof(CDC)\",\"/TempleOS/\"FILENAME_MASK_TXT);View;"$.
|
||||
//Don't forget these $MA+A-X+PU,"sizeof(CDC)","Grep(\"sizeof(CDC)\",\"/TempleOS/*\");View;"$.
|
||||
CDC *result;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
@@ -136,19 +136,21 @@ public U0 DCMono(CDC *dc,
|
||||
}
|
||||
}
|
||||
|
||||
public U0 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=COLOR_TRANSPARENT)
|
||||
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=COLOR_TRANSPARENT)
|
||||
{
|
||||
I64 i;
|
||||
I64 i,result=0;
|
||||
U8 *dst;
|
||||
if (dc->type==DCT_COLOR8) {
|
||||
dst=dc->body;
|
||||
i=dc->width_internal*dc->height;
|
||||
while (i--)
|
||||
if (*dst==src_color)
|
||||
if (*dst==src_color) {
|
||||
*dst++=dst_color;
|
||||
else
|
||||
result++;
|
||||
} else
|
||||
dst++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,Bool compressed=TRUE)
|
||||
|
||||
+175
-131
@@ -271,7 +271,7 @@ ff_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool GrPlot3b(CDC *dc,I64 x,I64 y,I64 z)
|
||||
public Bool GrPlot3B(CDC *dc,I64 x,I64 y,I64 z)
|
||||
{ //Clipping and transformation but no pen_width
|
||||
I64 _x,_y,_z;
|
||||
Bool was_transform=FALSE,was_symmetry=FALSE;
|
||||
@@ -552,43 +552,37 @@ gr_done:
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
|
||||
public Bool GrPutChar3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 ch)
|
||||
public Bool GrPutChar3(CDC *dc,I64 x,I64 y,I64 z,U8 ch)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrPutChar(dc,x1,y1,ch);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
return GrPutChar(dc,x,y,ch);
|
||||
}
|
||||
|
||||
public Bool GrPutS3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s)
|
||||
public I64 GrPrint3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrPutS(dc,x1,y1,s);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool GrVPutS3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s)
|
||||
public I64 GrVPrint3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
//transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrVPutS(dc,x1,y1,s);
|
||||
}
|
||||
|
||||
public U0 GrPrintF3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrPutS3(dc,x,y,z,buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 GrVPrintF3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrVPutS3(dc,x,y,z,buf);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrVPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -731,49 +725,6 @@ gr_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
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,result=0;
|
||||
CDC *old_brush=dc->brush;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->brush=NULL;
|
||||
x2=x+w; y2=y; z2=z;
|
||||
x3=x; y3=y+h; z3=z;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
(*dc->transform)(dc,&x3,&y3,&z3);
|
||||
if (!(dc->flags&DCF_JUST_MIRROR) ||
|
||||
!(dc->flags&DCF_SYMMETRY))
|
||||
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);
|
||||
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)
|
||||
result=Rect(dc,x,y,z,x+w,y,z,x,y+h,z,&GrLinePlot);
|
||||
else
|
||||
result=GrRect(dc,x,y,w,h);
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
dc->brush=NULL;
|
||||
x2=x+w; y2=y; z2=z;
|
||||
x3=x; y3=y+h; z3=z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x3,&y3,&z3);
|
||||
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 I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
@@ -1169,21 +1120,21 @@ gr_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
{
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Returns cnt of pixels changed
|
||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,result=0,i,y_min,y_max;
|
||||
CTask *win_task;
|
||||
//p1 is min x
|
||||
if (p3->x<p2->x)
|
||||
SwapU64(&p3,&p2);
|
||||
if (p4->x<p2->x)
|
||||
SwapU64(&p4,&p2);
|
||||
if (p2->x<p1->x)
|
||||
SwapU64(&p2,&p1);
|
||||
|
||||
//p2 is min y of remainder
|
||||
if (p3->y<p2->y)
|
||||
SwapU64(&p3,&p2);
|
||||
//p2y<=p4y
|
||||
if (p4->y<p2->y)
|
||||
SwapU64(&p4,&p2);
|
||||
|
||||
y_min=0;
|
||||
y_max=dc->height;
|
||||
@@ -1195,16 +1146,47 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
y_max=win_task->win_pixel_bottom-(win_task->win_scroll_y+win_task->win_pixel_top);
|
||||
}
|
||||
|
||||
if ((dy2=p3->y-p1->y)<0) {
|
||||
if (dy1=p2->y-p1->y) {
|
||||
dx1=(p1->x-p2->x)<<32/dy1;
|
||||
dz1=(p1->z-p2->z)<<32/dy1;
|
||||
} else {
|
||||
dx1=0;
|
||||
dz1=0;
|
||||
}
|
||||
dx2=(p1->x-p3->x)<<32/dy2;
|
||||
dz2=(p1->z-p3->z)<<32/dy2;
|
||||
if ((dy2=p4->y-p1->y)<0) {
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p2y<=
|
||||
p4y<
|
||||
p1y
|
||||
|
||||
6
|
||||
1
|
||||
|
||||
6
|
||||
1
|
||||
|
||||
24
|
||||
1
|
||||
|
||||
42
|
||||
1
|
||||
|
||||
2
|
||||
4
|
||||
1
|
||||
|
||||
24
|
||||
1
|
||||
|
||||
42
|
||||
1
|
||||
|
||||
2
|
||||
4
|
||||
1
|
||||
|
||||
*/
|
||||
dy1=p2->y-p1->y;
|
||||
dx1=(p1->x-p2->x)<<32/dy1;
|
||||
dz1=(p1->z-p2->z)<<32/dy1;
|
||||
|
||||
dx2=(p1->x-p4->x)<<32/dy2;
|
||||
dz2=(p1->z-p4->z)<<32/dy2;
|
||||
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
|
||||
if (y+dy2<y_min) {
|
||||
i=y_min-(y+dy2);
|
||||
@@ -1230,9 +1212,9 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z1+=dz1;
|
||||
z2+=dz2;
|
||||
}
|
||||
if (dy2=p2->y-p3->y) {
|
||||
dx2=(p3->x-p2->x)<<32/dy2;
|
||||
dz2=(p3->z-p2->z)<<32/dy2;
|
||||
if (dy2=p2->y-p4->y) {
|
||||
dx2=(p4->x-p2->x)<<32/dy2;
|
||||
dz2=(p4->z-p2->z)<<32/dy2;
|
||||
if (y+dy2<y_min) {
|
||||
i=y_min-(y+dy2);
|
||||
if (i>-dy2) goto ft_done;
|
||||
@@ -1258,13 +1240,36 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
} else if ((dy2=p2->y-p1->y)>0) {
|
||||
if (dy1=p3->y-p1->y) {
|
||||
dx1=(p3->x-p1->x)<<32/dy1;
|
||||
dz1=(p3->z-p1->z)<<32/dy1;
|
||||
} else {
|
||||
dx1=0;
|
||||
dz1=0;
|
||||
}
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p1y<
|
||||
p2y<=
|
||||
p4y
|
||||
|
||||
1
|
||||
6
|
||||
|
||||
1
|
||||
6
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
*/
|
||||
dy1=p4->y-p1->y;
|
||||
dx1=(p4->x-p1->x)<<32/dy1;
|
||||
dz1=(p4->z-p1->z)<<32/dy1;
|
||||
|
||||
dx2=(p2->x-p1->x)<<32/dy2;
|
||||
dz2=(p2->z-p1->z)<<32/dy2;
|
||||
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
|
||||
@@ -1292,9 +1297,9 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z1+=dz1;
|
||||
z2+=dz2;
|
||||
}
|
||||
if (dy2=p3->y-p2->y) {
|
||||
dx2=(p3->x-p2->x)<<32/dy2;
|
||||
dz2=(p3->z-p2->z)<<32/dy2;
|
||||
if (dy2=p4->y-p2->y) {
|
||||
dx2=(p4->x-p2->x)<<32/dy2;
|
||||
dz2=(p4->z-p2->z)<<32/dy2;
|
||||
if (y+dy2>=y_max) {
|
||||
i=y+dy2-y_max+1;
|
||||
if (i>dy2) goto ft_done;
|
||||
@@ -1320,12 +1325,55 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p2y<=
|
||||
p1y<=
|
||||
p4y
|
||||
|
||||
7
|
||||
|
||||
16
|
||||
|
||||
124
|
||||
|
||||
3
|
||||
4
|
||||
|
||||
2
|
||||
5
|
||||
|
||||
3
|
||||
4
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
*/
|
||||
if (dy1=p2->y-p1->y) {
|
||||
dx1=(p2->x-p1->x)<<32/dy1;
|
||||
dz1=(p2->z-p1->z)<<32/dy1;
|
||||
if (dy2=p2->y-p3->y) {
|
||||
dx2=(p2->x-p3->x)<<32/dy2;
|
||||
dz2=(p2->z-p3->z)<<32/dy2;
|
||||
if (dy2=p2->y-p4->y) {
|
||||
dx2=(p2->x-p4->x)<<32/dy2;
|
||||
dz2=(p2->z-p4->z)<<32/dy2;
|
||||
} else {
|
||||
dx2=0;
|
||||
dz2=0;
|
||||
@@ -1352,17 +1400,17 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
}
|
||||
if (dy1=p3->y-p1->y) {
|
||||
dx1=(p1->x-p3->x)<<32/dy1;
|
||||
dz1=(p1->z-p3->z)<<32/dy1;
|
||||
if (dy2=p3->y-p2->y) {
|
||||
dx2=(p2->x-p3->x)<<32/dy2;
|
||||
dz2=(p2->z-p3->z)<<32/dy2;
|
||||
if (dy1=p4->y-p1->y) {
|
||||
dx1=(p1->x-p4->x)<<32/dy1;
|
||||
dz1=(p1->z-p4->z)<<32/dy1;
|
||||
if (dy2=p4->y-p2->y) {
|
||||
dx2=(p2->x-p4->x)<<32/dy2;
|
||||
dz2=(p2->z-p4->z)<<32/dy2;
|
||||
} else {
|
||||
dx2=0;
|
||||
dz2=0;
|
||||
}
|
||||
x1=x2=p3->x<<32; y=p3->y; z1=z2=p3->z<<32;
|
||||
x1=x2=p4->x<<32; y=p4->y; z1=z2=p4->z<<32;
|
||||
if (y-dy1<y_min) {
|
||||
i=y_min-(y-dy1);
|
||||
if (i>dy1) goto ft_done;
|
||||
@@ -1396,36 +1444,34 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
{ //Must be convex.
|
||||
//Returns cnt of pixels changed
|
||||
CD3I32 tri[3];
|
||||
I64 i,j,x0,y0,z0,x1,y1,z1,x2,y2,z2,result=0;
|
||||
I64 i,j,x,y,z,result=0;
|
||||
if (n<3) return 0;
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=i-1;
|
||||
if (i==1) {
|
||||
x0=poly[j].x; y0=poly[j].y; z0=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x0,&y0,&z0);
|
||||
GrReflect(dc,&x0,&y0,&z0);
|
||||
tri[0].x=x0; tri[0].y=y0; tri[0].z=z0;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
tri[0].x=x; tri[0].y=y; tri[0].z=z;
|
||||
}
|
||||
|
||||
j++;
|
||||
if (i==1) {
|
||||
x1=poly[j].x; y1=poly[j].y; z1=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
GrReflect(dc,&x1,&y1,&z1);
|
||||
} else {
|
||||
x1=x2; y1=y2; z1=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
}
|
||||
tri[1].x=x1; tri[1].y=y1; tri[1].z=z1;
|
||||
tri[1].x=x; tri[1].y=y; tri[1].z=z;
|
||||
|
||||
j++;
|
||||
x2=poly[j].x; y2=poly[j].y; z2=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
@@ -1435,27 +1481,25 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=i-1;
|
||||
if (i==1) {
|
||||
x0=poly[j].x; y0=poly[j].y; z0=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x0,&y0,&z0);
|
||||
tri[0].x=x0; tri[0].y=y0; tri[0].z=z0;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tri[0].x=x; tri[0].y=y; tri[0].z=z;
|
||||
}
|
||||
|
||||
j++;
|
||||
if (i==1) {
|
||||
x1=poly[j].x; y1=poly[j].y; z1=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
} else {
|
||||
x1=x2; y1=y2; z1=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
}
|
||||
tri[1].x=x1; tri[1].y=y1; tri[1].z=z1;
|
||||
tri[1].x=x; tri[1].y=y; tri[1].z=z;
|
||||
|
||||
j++;
|
||||
x2=poly[j].x; y2=poly[j].y; z2=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public U0 DCClear(CDC *dc=NULL)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Screen"
|
||||
public I64 gr_pan_text_x=0,gr_pan_text_y=0; // [-7,7]
|
||||
public U0 (*fp_final_screen_update)(CDC *dc)=NULL;
|
||||
public U0 (*fp_wall_paper)(CTask *task)=NULL;
|
||||
|
||||
@@ -361,9 +362,9 @@ U0 GrInit4()
|
||||
|
||||
gr_text_base=CAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U32));
|
||||
gr_vga_text_cache=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
gr_win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
gr_win_uncovered_bitmap=CAlloc(65536/8);
|
||||
gr_highest_uncovered=0;
|
||||
gr_win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
|
||||
gr_dc2=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
gr_dc2->flags|=DCF_SCREEN_BITMAP;
|
||||
@@ -583,25 +584,71 @@ U0 GrZoomInScreen()
|
||||
|
||||
U0 GrUpdateBackgroundOfText()
|
||||
{
|
||||
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;
|
||||
nounusedwarn w2;
|
||||
for (row=TEXT_ROWS;row--;) {
|
||||
for (col=TEXT_COLS;col--;) {
|
||||
I64 reg RSI *dst=gr_dc2->body,reg R13 c,row,col,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,i,j,cur_ch,
|
||||
reg R12 w1=gr_dc2->width_internal,w2=-7*w1+8,w3=7*w1,w4=0;
|
||||
U32 *src=gr_text_base;
|
||||
Bool blink_flag=Blink;
|
||||
U8 *dst2=dst;
|
||||
|
||||
if (gr_pan_text_x) {
|
||||
gr_pan_text_x=LimitI64(gr_pan_text_x,-7,7);
|
||||
j=AbsI64(gr_pan_text_x)/FONT_WIDTH+1;
|
||||
num_cols-=j;
|
||||
if (gr_pan_text_x<0) {
|
||||
src+=j;
|
||||
i=FONT_WIDTH*j+gr_pan_text_x;
|
||||
} else
|
||||
i=gr_pan_text_x;
|
||||
dst2=dst(U8 *)+i;
|
||||
w4=j;
|
||||
w3+=j*FONT_WIDTH;
|
||||
|
||||
j*=FONT_WIDTH;
|
||||
dst(U8 *)=gr_dc2->body;
|
||||
for (row=num_rows*FONT_HEIGHT;row--;) {
|
||||
for (col=i;col--;)
|
||||
*dst(U8 *)++=0;
|
||||
dst(U8 *)+=w1-i-j;
|
||||
for (col=j;col--;)
|
||||
*dst(U8 *)++=0;
|
||||
}
|
||||
}
|
||||
dst=dst2;
|
||||
|
||||
if (gr_pan_text_y) {
|
||||
gr_pan_text_y=LimitI64(gr_pan_text_y,-7,7);
|
||||
j=AbsI64(gr_pan_text_y)/FONT_HEIGHT+1;
|
||||
num_rows-=j;
|
||||
if (gr_pan_text_y<0) {
|
||||
src+=w1/FONT_WIDTH*j;
|
||||
i=w1*(FONT_HEIGHT*j+gr_pan_text_y);
|
||||
} else
|
||||
i=w1*gr_pan_text_y;
|
||||
dst2=dst(U8 *)+i;
|
||||
|
||||
j*=w1*FONT_HEIGHT;
|
||||
dst(U8 *)=gr_dc2->body;
|
||||
for (row=i;row--;)
|
||||
*dst(U8 *)++=0;
|
||||
dst(U8 *)=gr_dc2->body+TEXT_ROWS*TEXT_COLS*FONT_HEIGHT*FONT_WIDTH-j;
|
||||
for (row=j;row--;)
|
||||
*dst(U8 *)++=0;
|
||||
}
|
||||
dst=dst2;
|
||||
|
||||
for (row=num_rows;row--;) {
|
||||
for (col=num_cols;col--;) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & (DOCET_SELECTED | DOCET_INVERT | DOCET_BLINK)) {
|
||||
if (cur_ch & DOCET_SELECTED)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & DOCET_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]= cur_ch.u8[1]<<4+ cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK && blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
}
|
||||
c=my_1_to_8_colors[cur_ch.u8[1]>>4];
|
||||
c=gr_1_to_8_colors[cur_ch.u8[1]>>4];
|
||||
asm {
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
@@ -618,9 +665,10 @@ asm {
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R10
|
||||
}
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
src+=w4;
|
||||
dst(U8 *)+=w3;
|
||||
}
|
||||
}
|
||||
@@ -638,24 +686,46 @@ asm {
|
||||
U0 GrUpdateForegroundOfText()
|
||||
{
|
||||
U32 *src=gr_text_base;
|
||||
I64 i,j,cur_ch,reg *dst=gr_dc2->body,
|
||||
reg w1=gr_dc2->width_internal,w2=7*w1,
|
||||
row,col;
|
||||
I64 i,j,cur_ch,*dst=gr_dc2->body,
|
||||
w1=gr_dc2->width_internal,w2=7*w1,w4=0,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,row,col;
|
||||
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--;) {
|
||||
|
||||
if (gr_pan_text_x) {
|
||||
gr_pan_text_x=LimitI64(gr_pan_text_x,-7,7);
|
||||
j=AbsI64(gr_pan_text_x)/FONT_WIDTH+1;
|
||||
num_cols-=j;
|
||||
if (gr_pan_text_x<0) {
|
||||
src+=j;
|
||||
dst(U8 *)+=FONT_WIDTH*j;
|
||||
}
|
||||
w4=j;
|
||||
w2+=j*FONT_WIDTH;
|
||||
}
|
||||
|
||||
if (gr_pan_text_y) {
|
||||
gr_pan_text_y=LimitI64(gr_pan_text_y,-7,7);
|
||||
j=AbsI64(gr_pan_text_y)/FONT_HEIGHT+1;
|
||||
num_rows-=j;
|
||||
if (gr_pan_text_y<0) {
|
||||
src+=w1/FONT_WIDTH*j;
|
||||
dst(U8 *)+=w1*FONT_HEIGHT*j;
|
||||
}
|
||||
}
|
||||
|
||||
for (row=num_rows;row--;) {
|
||||
for (col=num_cols;col--;) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & (DOCET_UNDERLINE | DOCET_SELECTED | DOCET_INVERT | DOCET_BLINK)) {
|
||||
if (cur_ch & DOCET_SELECTED)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & DOCET_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]= cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK && blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
}
|
||||
if (i=cur_ch.u16[1]&0x3FF) {
|
||||
if (i=cur_ch.u16[1]&0x3FF+gr_pan_text_x+gr_pan_text_y<<5) {
|
||||
j=i&0x1F;
|
||||
if (j&0x10) j|=~0x1F;
|
||||
i>>=5;
|
||||
@@ -667,6 +737,7 @@ U0 GrUpdateForegroundOfText()
|
||||
GrRopEquU8NoClipping(cur_ch&(DOCET_UNDERLINE+0xFFF),dst,w1);
|
||||
dst(U8 *)+=8;
|
||||
}
|
||||
src+=w4;
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ unions are used. It's kind-of a mess using a union.
|
||||
$LK,"SpriteSize","MN:SpriteSize"$() will return the size of a single
|
||||
operation, while $LK,"SpriteSize","MN:SpriteSize"$() with an 's' will
|
||||
return the size of an entire lst. Look at
|
||||
$LK,"gr_sprite_base_size","MN:gr_sprite_base_size"$.
|
||||
$LK,"sprite_base_size","MN:sprite_base_size"$.
|
||||
|
||||
To get familiar, type <CTRL-R> on sprite in
|
||||
a document and select "Display as Text". It
|
||||
@@ -72,7 +72,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
GrPlot3(dc,tempg->x1+x,tempg->y1+y,z);
|
||||
break;
|
||||
case GRST_TEXT:
|
||||
GrPutS3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrPrint3(dc,tempg->x1+x,tempg->y1+y,z,"%s",tempg->st);
|
||||
break;
|
||||
case GRST_TEXT_BOX:
|
||||
GrTextBox3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
@@ -289,7 +289,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
old_flags&(DCF_SYMMETRY|DCF_TRANSFORMATION);
|
||||
}
|
||||
|
||||
public U0 SpritePlot3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
public U0 SpritePlot3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
{
|
||||
I64 old_x=dc->x,old_y=dc->y,old_z=dc->z,
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
@@ -300,7 +300,7 @@ public U0 SpritePlot3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotMat3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
public U0 SpritePlotRotMat3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
{
|
||||
I64 *old_r=dc->r,old_m[16],
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
@@ -315,24 +315,24 @@ public U0 SpritePlotRotMat3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotX3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
|
||||
public U0 SpritePlotRotX3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 è=0)
|
||||
{
|
||||
I64 *r=GrRotX(è);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotY3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
|
||||
public U0 SpritePlotRotY3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 ê=0)
|
||||
{
|
||||
I64 *r=GrRotY(ê);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotZ3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
public U0 SpritePlotRotZ3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
{
|
||||
I64 *r=GrRotZ(é);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
@@ -498,10 +498,10 @@ public CDocEntry *DocPutSprite(CDoc *doc=NULL,U8 *elems,U8 *txt=NULL)
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
if (txt)
|
||||
st=MSPrintF(txt,doc->cur_bin_num++);
|
||||
st=MPrint(txt,doc->cur_bin_num++);
|
||||
else
|
||||
st=MSPrintF("$$SP,\"\",%d$$",doc->cur_bin_num++);
|
||||
doc_e=DocPutS(doc,st);
|
||||
st=MPrint("$$SP,\"\",%d$$",doc->cur_bin_num++);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
Free(st);
|
||||
doc_e->bin_data=tempb;
|
||||
if (doc_e && Bt(doc_tag_types,doc_e->type_u8) && doc_e->tag && *doc_e->tag)
|
||||
|
||||
+10
-10
@@ -794,17 +794,17 @@ public I64 RegPoly(U8 *aux_data,
|
||||
}
|
||||
|
||||
#help_index "Graphics/CD3I32;Math/CD3I32"
|
||||
public F64 P3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
{
|
||||
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
||||
}
|
||||
|
||||
public F64 P3I32Norm(CD3I32 *p)
|
||||
public F64 D3I32Norm(CD3I32 *p)
|
||||
{
|
||||
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
||||
}
|
||||
|
||||
public I64 P3I32SqrNorm(CD3I32 *p)
|
||||
public I64 D3I32SqrNorm(CD3I32 *p)
|
||||
{
|
||||
return SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z);
|
||||
}
|
||||
@@ -816,9 +816,9 @@ public I64 Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y
|
||||
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,
|
||||
t,d=P3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
P3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
P3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
@@ -861,10 +861,10 @@ public I64 Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y
|
||||
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,
|
||||
x3=ctrl[3].x-x0,y3=ctrl[3].y-y0,z3=ctrl[3].z-z0,
|
||||
t,d=P3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
P3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
P3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
P3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
D3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
|
||||
@@ -52,7 +52,7 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
st2="";
|
||||
}
|
||||
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
|
||||
DocPrint(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"
|
||||
@@ -82,7 +82,7 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 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.");
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -410,7 +410,7 @@ bm_menu:
|
||||
case GEBM_TEXT:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPutS(dc,p1,p2,st);
|
||||
GrPrint(dc,p1,p2,"%s",st);
|
||||
break;
|
||||
case GEBM_TEXT_BOX:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -537,7 +537,7 @@ bm_menu:
|
||||
case GEBM_TEXT:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPutS(dc,p1,p2,st);
|
||||
GrPrint(dc,p1,p2,"%s",st);
|
||||
break;
|
||||
case GEBM_TEXT_BOX:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -648,7 +648,7 @@ bm_menu:
|
||||
break;
|
||||
case GEBM_TEXT:
|
||||
img->color=color;
|
||||
GrPutS(img,p1-xx1,p2-yy1,st);
|
||||
GrPrint(img,p1-xx1,p2-yy1,"%s",st);
|
||||
goto bm_menu;
|
||||
case GEBM_TEXT_BOX:
|
||||
img->color=color;
|
||||
@@ -6,7 +6,7 @@ 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]);
|
||||
CSprite *tempg=CAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
@@ -60,7 +60,7 @@ I64 SpriteCntQue(CSprite *root)
|
||||
|
||||
U0 GrEdUpdate(CDoc *doc,CDocBin *tempb,CSprite *root)
|
||||
{
|
||||
I64 i,size=gr_sprite_base_size[GRST_END];
|
||||
I64 i,size=sprite_base_size[GRST_END];
|
||||
CSprite *tempg=root->next;
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -175,7 +175,7 @@ CSprite *GrTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,radius=tempg->x2<<16;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[GRST_ELLIPSE]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(GRST_ELLIPSE));
|
||||
tempg1->type=GRST_ELLIPSE;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
@@ -202,7 +202,7 @@ CSprite *GrTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
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]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(tempg->type));
|
||||
tempg1->type=tempg->type;
|
||||
if (tempg->type==GRST_POLYGON)
|
||||
tempg1->sides=tempg->sides;
|
||||
@@ -243,7 +243,7 @@ CSprite *GrTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
x_radius=(tempg->x2-tempg->x1)<<16,
|
||||
y_radius=(tempg->y2-tempg->y1)<<16;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[GRST_ROTATED_RECT]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(GRST_ROTATED_RECT));
|
||||
tempg1->type=GRST_ROTATED_RECT;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
@@ -490,7 +490,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg1=tempg2;
|
||||
}
|
||||
|
||||
tempg3=CAlloc(gr_sprite_qued_base_size[GRST_POLYPT]+
|
||||
tempg3=CAlloc(SpriteQuedBaseSize(GRST_POLYPT)+
|
||||
sizeof(I32)*2+(num*3+7)>>3);
|
||||
ptr=&tempg3->y1;
|
||||
ptr[0]=x2;
|
||||
@@ -596,28 +596,28 @@ U0 PickSpriteDocNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||
I64 cur_num=0;
|
||||
U8 *st;
|
||||
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n"
|
||||
DocPrint(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,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
DocPrint(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrint(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
} else {
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
}
|
||||
Free(st);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (cur_num==old_num) {
|
||||
DocPutS(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
DocPrint(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrint(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
} else {
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
}
|
||||
if (doc_e)
|
||||
doc->cur_entry=doc_e;
|
||||
@@ -658,7 +658,7 @@ U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *_cur_num)
|
||||
|
||||
U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *_cur_num,CTask *mem_task=NULL)
|
||||
{
|
||||
I64 num=0,size=gr_sprite_base_size[GRST_END];
|
||||
I64 num=0,size=sprite_base_size[GRST_END];
|
||||
U8 *result,*dst;
|
||||
Bool unlock_doc=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
@@ -694,14 +694,14 @@ 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"
|
||||
DocPrint(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);
|
||||
DocPrintF(doc,"$$FG,BLUE$$%s$$FG$$\n",st);
|
||||
DocPrint(doc,"$$FG,BLUE$$%s$$FG$$\n",st);
|
||||
Free(st);
|
||||
doc_e=DocPrintF(doc,"$$HX,%d,16$$",SpriteElemSize(tempg));
|
||||
doc_e=DocPrint(doc,"$$HX,%d,16$$",SpriteElemSize(tempg));
|
||||
doc_e->data=&tempg->start;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
CTask *pu_task;
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit Menu\"$$\n"
|
||||
DocPrint(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"
|
||||
@@ -760,7 +760,7 @@ I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
"\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);
|
||||
st=MPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
i=PopUpMenu(doc);
|
||||
@@ -1189,7 +1189,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_nu
|
||||
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=MAlloc(SpriteQuedBaseSize(GRST_SHIFT));
|
||||
tempg->type=GRST_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
@@ -13,7 +13,7 @@ I64 PopUpSpriteMain(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
CTask *pu_task;
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Main Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Main Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteMain.TXT.Z\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU-UL,\"Color (4-bit)\",GRST_COLOR8$$\n"
|
||||
"$$MU-UL,\"Dither Color (4-bit)\",GRST_DITHER_COLOR8$$\n"
|
||||
@@ -49,8 +49,8 @@ I64 PopUpSpriteMain(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
"$$FG,PURPLE$$$$MU-UL,\"+] Sprite Edit Menu\",GRST_ED_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GRST_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$\n",snap,ip_scaler);
|
||||
DocPutS(doc,"\nRight-Click to get back to this menu.");
|
||||
st=MSPrintF("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
st=MPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
i=PopUpMenu(doc);
|
||||
@@ -67,21 +67,21 @@ Bool PopUpExtents(I64 *_x1,I64 *_x2,I64 *_y1,I64 *_y2)
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e;
|
||||
doc_e=DocPutS(doc," $$DA,32,\"x1:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"x1:%%d\"$$\n");
|
||||
doc_e->data=_x1;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"x2:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"x2:%%d\"$$\n");
|
||||
doc_e->data=_x2;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"y1:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"y1:%%d\"$$\n");
|
||||
doc_e->data=_y1;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"y2:%d\"$$\n\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"y2:%%d\"$$\n\n");
|
||||
doc_e->data=_y2;
|
||||
DocDataFmt(doc_e);
|
||||
|
||||
DocPutS(doc," $$BT,\"Use These Extents\",TRUE$$");
|
||||
DocPutS(doc,"$$CM,3,0$$$$BT,\"Drag-Out New Extents\",FALSE$$\n\n");
|
||||
DocPrint(doc," $$BT,\"Use These Extents\",TRUE$$");
|
||||
DocPrint(doc,"$$CM,3,0$$$$BT,\"Drag-Out New Extents\",FALSE$$\n\n");
|
||||
do i=PopUpMenu(doc);
|
||||
while (i!=FALSE && i!=TRUE);
|
||||
DocDel(doc);
|
||||
@@ -230,7 +230,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpColor(,,FALSE);
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_COLOR8]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_COLOR8));
|
||||
tempg->type=GRST_COLOR8;
|
||||
tempg->color8=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -245,7 +245,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpColorDither;
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_DITHER_COLOR8]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_DITHER_COLOR8));
|
||||
tempg->type=GRST_DITHER_COLOR8;
|
||||
tempg->dither_color8=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -287,8 +287,8 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
} else
|
||||
old_mesh=NULL;
|
||||
if (mesh=CSpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_MESH]-sizeof(I32)*2+size);
|
||||
if (mesh=SpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=GRST_MESH;
|
||||
MemCpy(&tempg->vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
@@ -369,7 +369,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpRangeI64(1,16,1,"Pen Width\n");
|
||||
if (i>=1) {
|
||||
width=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_WIDTH]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_WIDTH));
|
||||
tempg->type=GRST_WIDTH;
|
||||
tempg->width=width;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -381,7 +381,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
break;
|
||||
case GRST_TRANSFORM_ON:
|
||||
case GRST_TRANSFORM_OFF:
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_TRANSFORM_ON]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_TRANSFORM_ON));
|
||||
if (eletype==GRST_TRANSFORM_ON)
|
||||
tempg->type=GRST_TRANSFORM_ON;
|
||||
else
|
||||
@@ -414,13 +414,13 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
x1=0; y1=0;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrPutS3(dc,x1,y1,0,st);
|
||||
GrPrint3(dc,x1,y1,0,"%s",st);
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -446,7 +446,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT_BOX]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT_BOX)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT_BOX;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -472,7 +472,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT_DIAMOND]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT_DIAMOND)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT_DIAMOND;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -499,7 +499,7 @@ ei_restart:
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_KEY_DOWN | 1<<MSG_IP_L_DOWN | 1<<MSG_IP_R_UP);
|
||||
if (msg_code==MSG_IP_R_UP) {
|
||||
if (eletype==GRST_PLANAR_SYMMETRY) {
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_PLANAR_SYMMETRY]);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_PLANAR_SYMMETRY));
|
||||
tempg->type=GRST_PLANAR_SYMMETRY;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
@@ -532,7 +532,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_LINE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_LINE));
|
||||
tempg->type=GRST_LINE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -555,7 +555,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_ARROW]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_ARROW));
|
||||
tempg->type=GRST_ARROW;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -580,7 +580,7 @@ ei_restart:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PLANAR_SYMMETRY]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PLANAR_SYMMETRY));
|
||||
tempg->type=GRST_PLANAR_SYMMETRY;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -618,7 +618,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_RECT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_RECT));
|
||||
tempg->type=GRST_RECT;
|
||||
tempg->x1=xx1-x;
|
||||
tempg->y1=yy1-y;
|
||||
@@ -655,7 +655,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
ei_bitmap:
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -685,7 +685,7 @@ ei_bitmap:
|
||||
case GE_EXIT:
|
||||
case GE_CONT:
|
||||
Free(tempg);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -736,7 +736,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=GRST_BITMAP8;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -777,7 +777,7 @@ ei_bitmap:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_CIRCLE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_CIRCLE));
|
||||
tempg->type=GRST_CIRCLE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -798,7 +798,7 @@ ei_bitmap:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_ELLIPSE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_ELLIPSE));
|
||||
tempg->type=GRST_ELLIPSE;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
@@ -848,7 +848,7 @@ ei_bitmap:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_POLYGON]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_POLYGON));
|
||||
tempg->type=GRST_POLYGON;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
@@ -890,7 +890,7 @@ ei_bitmap:
|
||||
break;
|
||||
case GRST_PT:
|
||||
x1=p1; y1=p2;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -901,7 +901,7 @@ ei_bitmap:
|
||||
case GRST_FLOOD_FILL:
|
||||
case GRST_FLOOD_FILL_NOT:
|
||||
x1=p1; y1=p2;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_FLOOD_FILL]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_FLOOD_FILL));
|
||||
tempg->type=eletype;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -929,7 +929,7 @@ ei_bitmap:
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
@@ -939,7 +939,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYLINE]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYLINE)+
|
||||
(num+1)<<1*sizeof(I32));
|
||||
ptr=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
@@ -991,7 +991,7 @@ ei_bitmap:
|
||||
tempg=tempg1;
|
||||
}
|
||||
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYPT]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYPT)+
|
||||
sizeof(I32)*2+(num*3+7)>>3);
|
||||
ptr=&tempg2->y1;
|
||||
ptr[0]=x3;
|
||||
@@ -1040,7 +1040,7 @@ ei_bitmap:
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
@@ -1050,7 +1050,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYLINE]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYLINE)+
|
||||
(num+1)*sizeof(CD3I32));
|
||||
p=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
@@ -1104,8 +1104,8 @@ ei_shiftable_mesh:
|
||||
z=0;
|
||||
old_mesh=NULL;
|
||||
}
|
||||
if (mesh=CSpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_SHIFTABLE_MESH]-sizeof(I32)*2+size);
|
||||
if (mesh=SpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=GRST_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->shiftable_vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
@@ -1176,12 +1176,12 @@ U0 EdInsGraphic(CDoc *doc,I64 x,I64 y)
|
||||
unlock=DocLock(doc);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tempb->type=DOCBT_CSPRITE;
|
||||
tempb->size=gr_sprite_base_size[GRST_END];
|
||||
tempb->size=sprite_base_size[GRST_END];
|
||||
tempb->data=CAlloc(tempb->size,doc->mem_task);
|
||||
tempb->num=doc->cur_bin_num++;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
doc_e=DocPutS(doc,st);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
doc_e->bin_data=tempb;
|
||||
Free(st);
|
||||
if (doc_e && Bt(doc_tag_types,doc_e->type_u8) && doc_e->tag && *doc_e->tag)
|
||||
@@ -634,7 +634,7 @@ GrMClipBoardInit;
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
CGrMFrame *e=NamedFramePtr("CGrMFrame",task);
|
||||
CGrMFrame *e=FramePtr("CGrMFrame",task);
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
F64 d;
|
||||
I64 i,x,y,z;
|
||||
@@ -664,7 +664,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->ls.x=x;
|
||||
dc->ls.y=y;
|
||||
dc->ls.z=z;
|
||||
d=1<<16/P3I32Norm(&dc->ls); //Light source normalized to 65536.
|
||||
d=1<<16/D3I32Norm(&dc->ls); //Light source normalized to 65536.
|
||||
dc->ls.x*=d;
|
||||
dc->ls.y*=d;
|
||||
dc->ls.z*=d;
|
||||
@@ -725,7 +725,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=ROP_XOR+RED^COLOR_TRANSPARENT;
|
||||
else
|
||||
dc->color=ROP_XOR+COLOR_TRANSPARENT;
|
||||
GrPrintF(dc,0,0,"%6.3f%% (%d,%d,%d)",e->view_scale*100,x,y,z);
|
||||
GrPrint(dc,0,0,"%6.3f%% (%d,%d,%d)",e->view_scale*100,x,y,z);
|
||||
dc->pen_width=1;
|
||||
dc->color&=0xF;
|
||||
if (Blink(10))
|
||||
@@ -871,7 +871,7 @@ U0 GrMUpdateMenu(CGrMFrame *e)
|
||||
tempse->checked=ToBool(e->flip_y);
|
||||
}
|
||||
|
||||
I32 *CSpriteMesh(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
I32 *SpriteMesh(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
/*$WW,1$
|
||||
|
||||
Fmt for mesh:
|
||||
@@ -985,7 +985,7 @@ $WW,0$*/
|
||||
GrMInit(&e,flip_y);
|
||||
if (root)
|
||||
GrMLoad(&e,root);
|
||||
NamedFramePtrAdd("CGrMFrame",&e);
|
||||
FramePtrAdd("CGrMFrame",&e);
|
||||
Fs->draw_it=&DrawIt;
|
||||
GrMCurSnap(&e);
|
||||
GrMRecalcCxCy(Fs,&e);
|
||||
@@ -1370,7 +1370,7 @@ mesh_done:
|
||||
else
|
||||
root=NULL;
|
||||
GrMCleanUp(&e);
|
||||
NamedFramePtrDel("CGrMFrame");
|
||||
FramePtrDel("CGrMFrame");
|
||||
if (old_s) {
|
||||
MemCpy(c->state,old_s,sizeof(CViewAngles));
|
||||
Free(old_s);
|
||||
@@ -1,90 +1,48 @@
|
||||
#help_index "Graphics/CSprite"
|
||||
#help_file "::/TempleOS/Doc/Sprite"
|
||||
|
||||
I64 gr_sprite_base_size[GRST_NUM_TYPES]=
|
||||
I64 sprite_base_size[GRST_NUM_TYPES]=
|
||||
{
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_END
|
||||
1,
|
||||
1+offset(CSprite.color8)-offset(CSprite.start), //GRST_COLOR8
|
||||
1,
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_PT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYLINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYPT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_WIDTH
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_SHIFT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3_CLOSED
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //GRST_CIRCLE
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL
|
||||
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_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_tri_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_WIDTH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_PLANAR_SYMMETRY
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_SHIFT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_PT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYPT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYLINE
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_RECT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ROTATED_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //GRST_CIRCLE
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //GRST_POLYGON
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3_CLOSED
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_BITMAP8
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_ARROW
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT_BOX
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
I64 gr_sprite_qued_base_size[GRST_NUM_TYPES]=
|
||||
I64 SpriteQuedBaseSize(I64 type)
|
||||
{
|
||||
offset(CSprite.x1),//GRST_END
|
||||
1,
|
||||
1+offset(CSprite.color8), //GRST_COLOR8
|
||||
1,
|
||||
offset(CSprite.x2), //GRST_PT
|
||||
offset(CSprite.linespeed), //GRST_LINE
|
||||
offset(CSprite.y1), //GRST_POLYLINE
|
||||
offset(CSprite.y1), //GRST_POLYPT
|
||||
offset(CSprite.y1), //GRST_WIDTH
|
||||
offset(CSprite.x2), //GRST_SHIFT
|
||||
offset(CSprite.y1), //GRST_BSPLINE2
|
||||
offset(CSprite.y1), //GRST_BSPLINE3
|
||||
offset(CSprite.y1), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1), //GRST_BSPLINE3_CLOSED
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
offset(CSprite.linespeed), //GRST_RECT
|
||||
offset(CSprite.y2), //GRST_CIRCLE
|
||||
offset(CSprite.x2), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.x2), //GRST_FLOOD_FILL
|
||||
offset(CSprite.linespeed), //GRST_BITMAP8
|
||||
1,
|
||||
offset(CSprite.st), //GRST_TEXT
|
||||
offset(CSprite.sides), //GRST_ELLIPSE
|
||||
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_tri_cnt)+sizeof(I32), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.linespeed), //GRST_ARROW
|
||||
offset(CSprite.st), //GRST_TEXT_BOX
|
||||
offset(CSprite.st), //GRST_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
return sprite_base_size[type]+offset(CSprite.start);
|
||||
}
|
||||
|
||||
I64 SpriteElemSize(CSprite *tempg)
|
||||
{
|
||||
I64 i=gr_sprite_base_size[tempg->type];
|
||||
I64 i=sprite_base_size[tempg->type];
|
||||
switch (tempg->type) {
|
||||
case GRST_POLYLINE:
|
||||
i+=tempg->num<<1*sizeof(I32);
|
||||
@@ -121,7 +79,7 @@ public I64 SpriteSize(U8 *elems)
|
||||
CSprite *tempg=elems-offset(CSprite.start),*tempg1=tempg;
|
||||
while (tempg->type)
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
return tempg(U8 *)-tempg1(U8 *)+gr_sprite_base_size[GRST_END];
|
||||
return tempg(U8 *)-tempg1(U8 *)+sprite_base_size[GRST_END];
|
||||
}
|
||||
|
||||
I64 SpriteTypeMask(U8 *elems)
|
||||
@@ -151,9 +109,9 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
tempb1=tempb;
|
||||
temp_bitmap=FALSE;
|
||||
}
|
||||
tempg=CAlloc(gr_sprite_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(sprite_base_size[GRST_BITMAP8]+
|
||||
tempb1->width_internal*tempb1->height+
|
||||
gr_sprite_base_size[GRST_END])
|
||||
sprite_base_size[GRST_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=GRST_BITMAP8;
|
||||
tempg->width=tempb1->width;
|
||||
@@ -171,63 +129,63 @@ 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_SPRITE_TYPES");
|
||||
SPrint(buf,"%Z",tempg->type,"ST_SPRITE_TYPES");
|
||||
*buf2=0;
|
||||
switch (tempg->type) {
|
||||
case GRST_COLOR8:
|
||||
SPrintF(buf2," %s",Color2Text(buf3,tempg->color8));
|
||||
SPrint(buf2," %s",Color2Text(buf3,tempg->color8));
|
||||
break;
|
||||
case GRST_PT:
|
||||
case GRST_FLOOD_FILL:
|
||||
case GRST_FLOOD_FILL_NOT:
|
||||
case GRST_SHIFT:
|
||||
SPrintF(buf2," %d,%d",tempg->x1,tempg->y1);
|
||||
SPrint(buf2," %d,%d",tempg->x1,tempg->y1);
|
||||
break;
|
||||
case GRST_LINE:
|
||||
case GRST_ARROW:
|
||||
case GRST_PLANAR_SYMMETRY:
|
||||
case GRST_RECT:
|
||||
case GRST_ROTATED_RECT:
|
||||
SPrintF(buf2," (%d,%d)-(%d,%d)",
|
||||
SPrint(buf2," (%d,%d)-(%d,%d)",
|
||||
tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
break;
|
||||
case GRST_CIRCLE:
|
||||
SPrintF(buf2," %d,%d:%dR",
|
||||
SPrint(buf2," %d,%d:%dR",
|
||||
tempg->x1,tempg->y1,tempg->x2);
|
||||
break;
|
||||
case GRST_WIDTH:
|
||||
SPrintF(buf2," %d",tempg->width);
|
||||
SPrint(buf2," %d",tempg->width);
|
||||
break;
|
||||
case GRST_TEXT:
|
||||
case GRST_TEXT_BOX:
|
||||
case GRST_TEXT_DIAMOND:
|
||||
SPrintF(buf2," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
SPrint(buf2," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
break;
|
||||
case GRST_DITHER_COLOR8:
|
||||
SPrintF(buf2," %s",Color2Text(buf3,ROPF_DITHER|tempg->dither_color8.u8[0]|tempg->dither_color8.u8[1]<<COLORROP_BITS));
|
||||
SPrint(buf2," %s",Color2Text(buf3,ROPF_DITHER|tempg->dither_color8.u8[0]|tempg->dither_color8.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case GRST_POLYLINE:
|
||||
case GRST_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
SPrintF(buf2," %d %d,%d",tempg->num,ptr[0],ptr[1]);
|
||||
SPrint(buf2," %d %d,%d",tempg->num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_POLYGON:
|
||||
case GRST_BITMAP8:
|
||||
SPrintF(buf2," %dW,%dH:%d,%d",
|
||||
SPrint(buf2," %dW,%dH:%d,%d",
|
||||
tempg->width,tempg->height,tempg->x2,tempg->y2);
|
||||
break;
|
||||
case GRST_BSPLINE2:
|
||||
case GRST_BSPLINE3:
|
||||
case GRST_BSPLINE2_CLOSED:
|
||||
case GRST_BSPLINE3_CLOSED:
|
||||
SPrintF(buf2," %d",tempg->num);
|
||||
SPrint(buf2," %d",tempg->num);
|
||||
break;
|
||||
case GRST_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
SPrint(buf2," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
break;
|
||||
case GRST_SHIFTABLE_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
SPrint(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
break;
|
||||
}
|
||||
StrCat(buf,buf2);
|
||||
Reference in new issue
Block a user