summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-01-05 19:45:28 +0000
committerscuri <scuri>2010-01-05 19:45:28 +0000
commitb710c137606af849d0864dbe5190ed29afdac10f (patch)
tree2b98a8e5ad11be4a672733b7667d74fd8baa207d
parentee94ff97d89c35170ec1b02e1b78085f05aa1f44 (diff)
*** empty log message ***
-rw-r--r--html/en/drv/printer.html22
-rw-r--r--src/wd.c6
-rw-r--r--src/win32/cdwin.c2
3 files changed, 27 insertions, 3 deletions
diff --git a/html/en/drv/printer.html b/html/en/drv/printer.html
index 3ef31d4..6b6ca19 100644
--- a/html/en/drv/printer.html
+++ b/html/en/drv/printer.html
@@ -84,6 +84,28 @@ before creating the canvas.</p>
the name of the selected printer.</li>
</ul>
+<h3>Notes</h3>
+
+<h4>Patterns</h4>
+<p>Usually when printing regions filled with patterns you have to compensate for
+the printer high resolution or the pattern will come out very small. If you
+don't want to create a high resolution version of your pattern, then the
+simplest way is to use <strong>wdCanvasPattern</strong> to resize the pattern to
+an expected millimeter size. This will increase the pattern raster size so it
+will be more visible in the printer.</p>
+<p>But on some printers the result were not what we expect:</p>
+<ul>
+ <li>
+ Laser printers automatically increase the real size of the pattern, so it
+ seems that <strong>wdCanvasPattern</strong> is not necessary on those
+ printers.</li>
+ <li>
+ PDF and Postscript based printer drivers (like Adobe PDF Creator and CutePDF
+ Writer) need that the pattern has a width multiple of 8, if not they will
+ appear distorted with an increasing horizontal shift on every line. This
+ does NOT applies to the CD_PDF or CD_PS drivers.</li>
+</ul>
+
</body>
</html>
diff --git a/src/wd.c b/src/wd.c
index 0bd4f9a..9332518 100644
--- a/src/wd.c
+++ b/src/wd.c
@@ -522,7 +522,7 @@ void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char *s,
void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w_mm, double h_mm)
{
- long *pattern = 0;
+ long *pattern = NULL;
int w_pxl, h_pxl, x, y, cx, cy;
int wratio, hratio;
int *XTab, *YTab;
@@ -531,6 +531,7 @@ void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w
cdCanvasMM2Pixel(canvas, w_mm, h_mm, &w_pxl, &h_pxl);
+ /* to preserve the pattern characteristics must be an integer number */
wratio = cdRound((double)w_pxl/(double)w);
hratio = cdRound((double)h_pxl/(double)h);
@@ -564,7 +565,7 @@ void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w
void wdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char *fgbg, double w_mm, double h_mm)
{
- unsigned char *stipple = 0;
+ unsigned char *stipple = NULL;
int w_pxl, h_pxl, x, y, cx, cy;
int wratio, hratio;
int *XTab, *YTab;
@@ -573,6 +574,7 @@ void wdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char *fgbg,
cdCanvasMM2Pixel(canvas, w_mm, h_mm, &w_pxl, &h_pxl);
+ /* to preserve the pattern characteristics must be an integer number */
wratio = cdRound((double)w_pxl/(double)w);
hratio = cdRound((double)h_pxl/(double)h);
diff --git a/src/win32/cdwin.c b/src/win32/cdwin.c
index 4b38187..313e833 100644
--- a/src/win32/cdwin.c
+++ b/src/win32/cdwin.c
@@ -595,7 +595,7 @@ static void cdpattern(cdCtxCanvas* ctxcanvas, int w, int h, const long int *colo
if (!cdwCreateDIB(&dib))
return;
- /* important to preserve pattern size during printing */
+ /* trying to preserve pattern size during printing */
set_dib_res(&dib, ctxcanvas);
cdwDIBEncodePattern(&dib, colors);