1
/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.c,v 1.11 2005/08/31 08:01:05 chofchof Exp $
1
/* $Header: /home/cvsroot/dvipdfmx/src/pdfdraw.c,v 1.13 2006/12/11 12:46:03 chofchof Exp $
3
3
This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
1151
/* Implementation of the optimization of adjacent transform
1152
* matrices, for example, "1 0 0 1 a b cm 1 0 0 1 c d cm" results
1153
* "1 0 0 1 a+c b+d cm".
1155
* The static variable ptM holds the information of pending
1156
* transform matrices, and it will be flushed before any non
1157
* transform command appears.
1159
static pdf_tmatrix *ptM = NULL;
1160
static char tmatrix_buf[1024]; /* FIXME: To avoid confliction with fmt_buf. */
1162
/* pdf_dev_flushtmatrix() is called from pdf_doc_add_page_content()
1166
pdf_dev_flushtmatrix (char **buf)
1172
(*buf)[len++] = ' ';
1173
len += pdf_sprint_matrix((*buf) + len, ptM);
1174
/* Do not flush "1 0 0 1 0 0 cm". Sting check is faster than
1175
* checking six double variables. */
1176
if (!strncmp((*buf) + 1, "1 0 0 1 0 0", 11)) {
1179
(*buf)[len++] = ' ';
1180
(*buf)[len++] = 'c';
1181
(*buf)[len++] = 'm';
1190
1152
pdf_dev_concat (const pdf_tmatrix *M)
1212
pdf_concatmatrix(ptM, M);
1214
ptM = NEW(1, pdf_tmatrix);
1215
pdf_copymatrix(ptM, M);
1176
len += pdf_sprint_matrix(buf + len, M);
1180
pdf_doc_add_page_content(buf, len);
1218
1182
pdf_concatmatrix(CTM, M);
1358
pdf_dev_reset_color (void)
1360
m_stack *gss = &_gsstck;
1361
pdf_gstate *gs = m_stack_top(gss);
1362
pdf_color fill, stroke;
1364
pdf_color_copycolor(&fill, &gs->fillcolor);
1365
pdf_color_copycolor(&stroke, &gs->strokecolor);
1367
/* Clear current color: */
1368
pdf_color_graycolor(&gs->fillcolor, 0.0);
1369
pdf_color_graycolor(&gs->strokecolor, 0.0);
1371
pdf_dev_setcolor(&stroke, 0);
1372
pdf_dev_setcolor(&fill, 1);
1378
pdf_dev_setcolor (const pdf_color *color, int is_fill)
1380
m_stack *gss = &_gsstck;
1381
pdf_gstate *gs = m_stack_top(gss);
1382
pdf_color *fcl = &gs->fillcolor;
1383
pdf_color *scl = &gs->strokecolor;
1388
WARN("No color specified.");
1392
colormode = pdf_dev_get_param(PDF_DEV_PARAM_COLORMODE);
1394
WARN("setcolor ignored. (Ignore color option set)");
1398
curcol = is_fill ? fcl : scl;
1399
if (!pdf_color_compare_color(color, curcol)) {
1404
pdf_color_print_color(color, is_fill);
1406
pdf_color_copycolor(curcol, color);
1413
1315
* num w LW linewidth (g.t. 0)
1414
1316
* int J LC linecap