📄 cagraph.c
字号:
* as is, which is a bit redundant) */ PDLI_GET_PHYSICAL_GRID(xl_st.cur_sxl.sixel_size.xval, &xl_st.aspect_ratio, &xl_st.cur_sxl.sixel_size); /* * Reset the repeat count for just one sixel */ xl_st.cur_sxl.sixel_repeat = 1; }/********************************************************************** * * This routine is called when a graphic sixel is encountered. * * The end results of this routine is to create hex values of * the sixel data. After every 8 sixels, 6 hex bytes of data * will be produced. The 6 hex bytes will be in the same column * (6 current rows) of the output file. * * The text-oriented check_ap routine is called to make sure * that we wrap at the end of a page, and that we handle the * first character flag properly. It also helps us to make sure * that sixels, no matter what their size or shape, are aligned * at the top when they are side by side, by passing 700 as the * above baseline value and subtracting that number from the * current sixel size to compute the below baseline value. * **********************************************************************/VOID dec_gr_sxl() {#ifdef DUMP { oprintf("DECGRAPHICS SIXEL \n"); }#endif /* * If the previous sixel pushed us past the right margin, * or so close we can't even fit one sixel, then ignore * the current sixel and all sixels that follow until a graphic carriage * return or newline is encountered (done by not updating the ahp, and * by doing nothing more than resetting the repeat count). * * This is meant to overwrite what check_ap does with horz autowrap. */ if ((xl_st.cur_sxl.sixel_ap.xval + xl_st.cur_sxl.sixel_size.xval )> xl_st.h_lim_bound.max) { xl_st.cur_sxl.sixel_repeat = 1; /* reset repeat count for one sixel */ return; /* ignore the current sixel */ } /* if the sixel is too long for the line, truncate it */ if (xl_st.cur_sxl.sixel_ap.xval + (xl_st.cur_sxl.sixel_size.xval * (LONG)xl_st.cur_sxl.sixel_repeat ) > xl_st.h_lim_bound.max) { xl_st.cur_sxl.sixel_repeat = ( xl_st.h_lim_bound.max - xl_st.cur_sxl.sixel_ap.xval ) / xl_st.cur_sxl.sixel_size.xval ; } /* * Update the ahp based on the ending position of the previous sixel *//* xl_st.curchar.ahp = xl_st.cur_sxl.sixel_ap.xval;*/ /* * Wrap the current sixel position to the next page, if necessary, and * handle the first character flag accordingly. Update the current sixel * position based on the results of check_ap. Since an ahp too large is * covered by the previous conditional exit, and we should never get an * ahp too small while in sixels, the setting of the current sixel xval * is probably redundant. */ check_ap((LONG)(700L - 1), (LONG)(xl_st.cur_sxl.sixel_size.yval - 700L));/* xl_st.cur_sxl.sixel_ap.xval = xl_st.curchar.ahp;*/ xl_st.cur_sxl.sixel_ap.yval = xl_st.curchar.ap.yval; /* * Subtract the first sixel offset to convert the incoming code into * a true sixel code, and image it. The conversion of repeat count of * zero to repeat count of one is probably redundant. */ xl_st.cur_sxl.sixel_code = (cp_c7 - FIRST_SIXEL_CODE); process_sixel(&xl_st.cur_sxl); /* * Update the current sixel position based on whether or not * the current sixel was repeated or not. */ xl_st.cur_sxl.sixel_ap.xval += (xl_st.cur_sxl.sixel_size.xval * (LONG)xl_st.cur_sxl.sixel_repeat ); /* * Reset the repeat count for just one sixel */ xl_st.cur_sxl.sixel_repeat = 1; } /********************************************************************** * * Graphic new line found - output current hex data * **********************************************************************/VOID dec_gnl() {#ifdef DUMP { oprintf("DECGNL \n"); }#endif vpos_rel_w_wrap(xl_st.cur_sxl.sixel_size.yval); xl_st.cur_sxl.sixel_ap.xval = gr_left_bound; xl_st.cur_sxl.sixel_ap.yval = xl_st.curchar.ap.yval; }/********************************************************************** * * Set repeat_cnt to the incoming value * **********************************************************************/VOID dec_gri() {#ifdef DUMP { oprintf("DECGRI \n"); pprint(); }#endif if (cp_pbuf[0] > MAX_RPT_CNT) xl_st.cur_sxl.sixel_repeat = MAX_RPT_CNT; else xl_st.cur_sxl.sixel_repeat = (cp_pbuf[0] != 0) ? (cp_pbuf[0]) : (1); }/********************************************************************** * * Set repeat_cnt to the incoming value * **********************************************************************/VOID ca_zap_repeat() { xl_st.cur_sxl.sixel_repeat = 1; }/********************************************************************** * * Enter here if a graphic carrage return ($) has been encountered. * * This routine will reset the byte count back to zero so that the next * line will be ORed over the preceding line. * **********************************************************************/VOID dec_gcr() {#ifdef DUMP { oprintf("DECGCR \n"); }#endif xl_st.cur_sxl.sixel_ap.xval = gr_left_bound; }/********************************************************************** * * This will be called when the sixel set raster command (") is * encountered. * * " P1 ; P2 ; P3 ; P4 ; P5 ; ... ; Pn * * P1 : Aspect Ratio Numerator * P2 : Aspect Ratio Denominator * P3 : Horizontal Extent * P4 : Verticle Extent * P5 - Pn : Ignored * * This will override any Aspect Ratio and Grid size that * has been set so long that there has not been any sixel data or line * feeds encountered. * * If P1 and/or P2 are zero, they will default to one. * * Horizontal and Verticle Grid sizes will be dependent upon the SSU. * **********************************************************************/VOID dec_gra() {#ifdef DUMP { oprintf("DECGRA \n"); pprint(); }#endif xl_st.aspect_ratio.xval = (cp_pbuf[0] != 0) /* numerator */ ? (cp_pbuf[0]) : (1); xl_st.aspect_ratio.yval = (cp_pbuf[1] != 0) /* denominator */ ? (cp_pbuf[1]) : (1); PDLI_GET_PHYSICAL_GRID(xl_st.cur_sxl.sixel_size.xval, &xl_st.aspect_ratio, &xl_st.cur_sxl.sixel_size); }/************************************************************************** Color Introducer - *************************************************************************/VOID dec_gci() { COLOR cur_color; /* current color map */#ifdef DUMP { oprintf("DECGCI \n"); pprint(); }#endif if (cp_pcnt == 0) { xl_st.cur_sxl.sixel_color = (UBYTE)cp_pbuf[0]; } else { switch (cp_pbuf[1]) { case 0: return; /* invalid param, so exit */ case 1: if ( (cp_pbuf[2] > 360) || (cp_pbuf[3] > 100) || (cp_pbuf[4] > 100) ) { return; /* invalid param, so exit */ } xl_st.cur_sxl.sixel_color = cur_color.color_map_entry = cp_pbuf[0]; cur_color.color_defn.coordsys = cp_pbuf[1]; cur_color.color_defn.hue_angle = cp_pbuf[2]; cur_color.color_defn.lightness = cp_pbuf[3]; cur_color.color_defn.saturation = cp_pbuf[4]; process_color(&cur_color); break; case 2: if ( (cp_pbuf[2] > 100) || (cp_pbuf[3] > 100) || (cp_pbuf[4] > 100) ) { return; /* invalid param, so exit */ } xl_st.cur_sxl.sixel_color = cur_color.color_map_entry = cp_pbuf[0]; cur_color.color_defn.coordsys = cp_pbuf[1]; cur_color.color_defn.hue_angle = cp_pbuf[2]; cur_color.color_defn.lightness = cp_pbuf[3]; cur_color.color_defn.saturation = cp_pbuf[4]; process_color(&cur_color); break; default: return; /* invalid param, so exit */ } } }/* * Exit Graphics Mode (same as Graphics CR for now) */VOID dec_gr_term() { xl_st.curchar.ap.xval = gr_left_bound; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -