Author: manolo
Date: 2010-09-03 09:35:32 -0700 (Fri, 03 Sep 2010)
New Revision: 7695
Log:
PostScript output of Fl_Pixmap objects: accept now arbitrarily large pixmaps
Modified:
branches/branch-1.3/src/Fl_PostScript.cxx
branches/branch-1.3/src/ps_image.cxx
Modified: branches/branch-1.3/src/Fl_PostScript.cxx
===================================================================
--- branches/branch-1.3/src/Fl_PostScript.cxx 2010-09-02 19:38:08 UTC (rev
7694)
+++ branches/branch-1.3/src/Fl_PostScript.cxx 2010-09-03 16:35:32 UTC (rev
7695)
@@ -330,8 +330,6 @@
"IDD image GR} bind def\n"
// gray image dict
-
-
"/GII {GS /inter exch def /py exch def /px exch def /sy exch def /sx exch def
\n"
"translate \n"
"sx sy scale\n"
@@ -370,9 +368,7 @@
"/Times-BoldItalic ToLatin1 \n"
;
-static const char * prolog_2_pixmap = // prolog relevant only if lang_level
== 2 for pixmaps
-"/pixmap_size { /pixmap_sy exch def /pixmap_sx exch def } bind def\n"
-
+static const char * prolog_2_pixmap = // prolog relevant only if lang_level
== 2 for pixmaps/masked color images
"/pixmap_mat {[ pixmap_sx 0 0 pixmap_sy neg 0 pixmap_sy ]} bind def\n"
"/pixmap_dict {"
@@ -384,10 +380,10 @@
"/YStep pixmap_sy\n"
"/PaintProc "
"{ begin "
-"pixmap_sx pixmap_sy scale "
+"pixmap_w pixmap_h scale "
"pixmap_sx pixmap_sy 8 "
"pixmap_mat "
-"pixmap_data "
+"currentfile /ASCIIHexDecode filter "
"false 3 "
"colorimage "
"end "
@@ -397,28 +393,20 @@
"/pixmap_plot {"
"GS "
-"/pixmap_y exch def /pixmap_x exch def\n"
-"pixmap_x pixmap_y translate\n"
+"/pixmap_sy exch def /pixmap_sx exch def\n"
+"/pixmap_h exch def /pixmap_w exch def\n"
+"translate\n"
"pixmap_dict matrix makepattern setpattern\n"
-"pixmap_sx pixmap_sy scale\n"
+"pixmap_w pixmap_h scale\n"
"pixmap_sx pixmap_sy\n"
"true\n"
"pixmap_mat\n"
-"pixmap_mask\n"
+"currentfile /ASCIIHexDecode filter\n"
"imagemask\n"
"GR\n"
"} bind def\n"
-
-"/pixmap_loaddata { /pixmap_data currentfile pixmap_sx pixmap_sy 3 mul mul
string readhexstring "
-"} bind def\n"
-
-"/pixmap_loadmask { "
-"/pixmap_mask currentfile pixmap_sx 8 div ceiling cvi pixmap_sy mul string
readhexstring "
-"} bind def\n"
;
-
-
static const char * prolog_3 = // prolog relevant only if lang_level >2
// masked color images
Modified: branches/branch-1.3/src/ps_image.cxx
===================================================================
--- branches/branch-1.3/src/ps_image.cxx 2010-09-02 19:38:08 UTC (rev
7694)
+++ branches/branch-1.3/src/ps_image.cxx 2010-09-03 16:35:32 UTC (rev
7695)
@@ -277,7 +277,7 @@
}
else if (mask && lang_level_ == 2) {
level2_mask = 1; // use method for drawing masked color image with
PostScript level 2
- fprintf(output, "%d %d pixmap_size\n pixmap_loadmask\n", iw, ih);
+ fprintf(output, " %g %g %g %g %d %d pixmap_plot\n", x, y, w, h, iw, ih);
}
else {
fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw ,
ih, interpol);
@@ -291,38 +291,36 @@
uchar *curmask=mask;
if(level2_mask) {
- for (j = ih - 1; j >= 0; j--) {
- curmask = mask + j * my/ih * ((mx+7)/8);
- for(k=0; k < my/ih; k++) { // output mask data
- for (i=0; i < ((mx+7)/8); i++) {
- fprintf(output, "%.2x",swap_byte(*curmask));
- curmask++;
- }
- fprintf(output,"\n");
- }
- }
- fprintf(output,"pop def\n\npixmap_loaddata\n");
for (j = ih - 1; j >= 0; j--) { // output full image data
- call(data,0,j,iw,rgbdata);
- uchar *curdata=rgbdata;
- for(i=0 ; i<iw ; i++) {
- uchar r = curdata[0];
- uchar g = curdata[1];
- uchar b = curdata[2];
- //if (!(i%40)) fprintf(output, "\n");
- fprintf(output, "%.2x%.2x%.2x", r, g, b);
+ call(data, 0, j, iw, rgbdata);
+ uchar *curdata = rgbdata;
+ for (i=0 ; i<iw ; i++) {
+ if (!(i%20)) fputs("\n", output);
+ fprintf(output, "%.2x%.2x%.2x", curdata[0], curdata[1], curdata[2]);
curdata += D;
}
- fprintf(output,"\n");
+ fputs("\n", output);
}
- fprintf(output,"pop def\n\n%g %g pixmap_plot\n", x, y); // draw the masked
image
+ fputs(">\n", output);
+ for (j = ih - 1; j >= 0; j--) { // output mask data
+ curmask = mask + j * (my/ih) * ((mx+7)/8);
+ for (k=0; k < my/ih; k++) {
+ for (i=0; i < ((mx+7)/8); i++) {
+ if (!(i%40)) fputs("\n", output);
+ fprintf(output, "%.2x",swap_byte(*curmask));
+ curmask++;
+ }
+ fputs("\n", output);
+ }
}
+ fputs(">\n", output);
+ }
else {
for (j=0; j<ih;j++) {
if(mask && lang_level_ > 2) { // InterleaveType 2 mask data
- for(k=0; k<my/ih;k++) { //for alpha pseudo-masking
+ for (k=0; k<my/ih;k++) { //for alpha pseudo-masking
for (i=0; i<((mx+7)/8);i++) {
- if (!(i%40)) fprintf(output, "\n");
+ if (!(i%40)) fputs("\n", output);
fprintf(output, "%.2x",swap_byte(*curmask));
curmask++;
}
@@ -331,20 +329,20 @@
}
call(data,0,j,iw,rgbdata);
uchar *curdata=rgbdata;
- for(i=0 ; i<iw ; i++) {
+ for (i=0 ; i<iw ; i++) {
uchar r = curdata[0];
uchar g = curdata[1];
uchar b = curdata[2];
- if (!(i%40)) fprintf(output, "\n");
+ if (!(i%40)) fputs("\n", output);
fprintf(output, "%.2x%.2x%.2x", r, g, b);
curdata +=D;
}
- fprintf(output,"\n");
+ fputs("\n", output);
}
- fprintf(output,">\n");
+ fputs(">\n", output);
}
fprintf(output,"restore\n");
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit