📄 do_trns.c
字号:
} pointer = sp_get_args(pointer, format1, &P0); sp_globals.P0 = P0;#if DEBUG printf("MOVE %6.1f, %6.1f\n", (real)sp_globals.P0.x / (real)sp_globals.onepix, (real)sp_globals.P0.y / (real)sp_globals.onepix);#endif fn_begin_contour(sp_globals.P0, (boolean)(format1 & BIT4)); continue; case 6: /* Undefined */#if DEBUG printf("*** Undefined instruction (Hex %4x)\n", format1);#endif continue; case 7: /* Undefined */#if DEBUG printf("*** Undefined instruction (Hex %4x)\n", format1);#endif continue; default: /* CRVE */ format2 = NEXT_BYTE(pointer); pointer = sp_get_args(pointer, format1, &P1); pointer = sp_get_args(pointer, format2, &P2); pointer = sp_get_args(pointer, (ufix8)(format2 >> 4), &P3); depth = (format1 >> 4) & 0x07;#if DEBUG printf("CRVE %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %6.1f, %d\n", (real)P1.x / (real)sp_globals.onepix, (real)P1.y / (real)sp_globals.onepix, (real)P2.x / (real)sp_globals.onepix, (real)P2.y / (real)sp_globals.onepix, (real)P3.x / (real)sp_globals.onepix, (real)P3.y / (real)sp_globals.onepix, depth);#endif depth += sp_globals.depth_adj; if (sp_globals.curves_out) { fn_curve(P1, P2, P3, depth); sp_globals.P0 = P3; continue; } if (depth <= 0) { fn_line(P3); sp_globals.P0 = P3; continue; } sp_split_curve(P1, P2, P3, depth); continue; } }}FUNCTION static void sp_split_curve(P1, P2, P3, depth)GDECLpoint_t P1; /* First control point of Bezier curve */point_t P2; /* Second control point of Bezier curve */point_t P3; /* End point of Bezier curve */fix15 depth; /* Levels of recursive subdivision required *//* * Called by proc_outl_data() to subdivide Bezier curves into an * appropriate number of vectors, whenever curves are not enabled * for output to the currently selected output module. * sp_split_curve() calls itself recursively to the depth specified * at which point it calls line() to deliver each vector resulting * from the spliting process. */{fix31 X0 = (fix31)sp_globals.P0.x;fix31 Y0 = (fix31)sp_globals.P0.y;fix31 X1 = (fix31)P1.x;fix31 Y1 = (fix31)P1.y;fix31 X2 = (fix31)P2.x;fix31 Y2 = (fix31)P2.y;fix31 X3 = (fix31)P3.x;fix31 Y3 = (fix31)P3.y;point_t Pmid;point_t Pctrl1;point_t Pctrl2;#if DEBUGprintf("CRVE(%3.1f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f)\n", (real)P1.x / (real)sp_globals.onepix, (real)P1.y / (real)sp_globals.onepix, (real)P2.x / (real)sp_globals.onepix, (real)P2.y / (real)sp_globals.onepix, (real)P3.x / (real)sp_globals.onepix, (real)P3.y / (real)sp_globals.onepix);#endifPmid.x = (X0 + (X1 + X2) * 3 + X3 + 4) >> 3;Pmid.y = (Y0 + (Y1 + Y2) * 3 + Y3 + 4) >> 3;if ((--depth) <= 0) { fn_line(Pmid); sp_globals.P0 = Pmid; fn_line(P3); sp_globals.P0 = P3; }else { Pctrl1.x = (X0 + X1 + 1) >> 1; Pctrl1.y = (Y0 + Y1 + 1) >> 1; Pctrl2.x = (X0 + (X1 << 1) + X2 + 2) >> 2; Pctrl2.y = (Y0 + (Y1 << 1) + Y2 + 2) >> 2; sp_split_curve(Pctrl1, Pctrl2, Pmid, depth); Pctrl1.x = (X1 + (X2 << 1) + X3 + 2) >> 2; Pctrl1.y = (Y1 + (Y2 << 1) + Y3 + 2) >> 2; Pctrl2.x = (X2 + X3 + 1) >> 1; Pctrl2.y = (Y2 + Y3 + 1) >> 1; sp_split_curve(Pctrl1, Pctrl2, P3, depth); }}FUNCTION static ufix8 FONTFAR *sp_get_args(pointer, format, pP)GDECLufix8 FONTFAR *pointer; /* Pointer to next byte in char data */ufix8 format; /* Format specifiaction of argument pair */point_t STACKFAR *pP; /* Resulting transformed point *//* * Called by read_bbox() and proc_outl_data() to read an X Y argument * pair from the font. * The format is specified as follows: * Bits 0-1: Type of X argument. * Bits 2-3: Type of Y argument. * where the 4 possible argument types are: * Type 0: Controlled coordinate represented by one byte * index into the X or Y controlled coordinate table. * Type 1: Interpolated coordinate represented by a two-byte * signed integer. * Type 2: Interpolated coordinate represented by a one-byte * signed increment/decrement relative to the * proceding X or Y coordinate. * Type 3: Repeat of preceding X or Y argument value and type. * The units of P are sub-pixels. * Updates *ppointer to point to the byte following the * argument pair. */{ufix8 edge;/* Read X argument */switch(format & 0x03) {case 0: /* Index to controlled oru */ edge = NEXT_BYTE(pointer); sp_globals.x_orus = sp_plaid.orus[edge];#if INCL_RULES sp_globals.x_pix = sp_plaid.pix[edge];#endif break;case 1: /* 2 byte interpolated oru value */ sp_globals.x_orus = NEXT_WORD(pointer); goto L1;case 2: /* 1 byte signed oru increment */ sp_globals.x_orus += (fix15)((fix7)NEXT_BYTE(pointer));L1: #if INCL_RULES sp_globals.x_pix = TRANS(sp_globals.x_orus, sp_plaid.mult[sp_globals.x_int], sp_plaid.offset[sp_globals.x_int], sp_globals.mpshift);#endif break;default: /* No change in X value */ break; }/* Read Y argument */switch((format >> 2) & 0x03) {case 0: /* Index to controlled oru */ edge = sp_globals.Y_edge_org + NEXT_BYTE(pointer); sp_globals.y_orus = sp_plaid.orus[edge];#if INCL_RULES sp_globals.y_pix = sp_plaid.pix[edge];#endif break;case 1: /* 2 byte interpolated oru value */ sp_globals.y_orus = NEXT_WORD(pointer); goto L2;case 2: /* 1 byte signed oru increment */ sp_globals.y_orus += (fix15)((fix7)NEXT_BYTE(pointer));L2: #if INCL_RULES sp_globals.y_pix = TRANS(sp_globals.y_orus, sp_plaid.mult[sp_globals.y_int], sp_plaid.offset[sp_globals.y_int], sp_globals.mpshift);#endif break;default: /* No change in X value */ break; }#if INCL_RULESswitch(sp_globals.tcb.xmode) {case 0: /* X mode 0 */ pP->x = sp_globals.x_pix; break;case 1: /* X mode 1 */ pP->x = -sp_globals.x_pix; break;case 2: /* X mode 2 */ pP->x = sp_globals.y_pix; break;case 3: /* X mode 3 */ pP->x = -sp_globals.y_pix; break;default: /* X mode 4 */#endif pP->x = (MULT16(sp_globals.x_orus, sp_globals.tcb.xxmult) + MULT16(sp_globals.y_orus, sp_globals.tcb.xymult) + sp_globals.tcb.xoffset) >> sp_globals.mpshift;#if INCL_RULES break; }switch(sp_globals.tcb.ymode) {case 0: /* Y mode 0 */ pP->y = sp_globals.y_pix; break;case 1: /* Y mode 1 */ pP->y = -sp_globals.y_pix; break;case 2: /* Y mode 2 */ pP->y = sp_globals.x_pix; break;case 3: /* Y mode 3 */ pP->y = -sp_globals.x_pix; break;default: /* Y mode 4 */#endif pP->y = (MULT16(sp_globals.x_orus, sp_globals.tcb.yxmult) + MULT16(sp_globals.y_orus, sp_globals.tcb.yymult) + sp_globals.tcb.yoffset) >> sp_globals.mpshift;#if INCL_RULES break; }#endifreturn pointer;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -