• R/O
  • SSH

wp2latex: Commit

WP2LaTeX sources.


Commit MetaInfo

Revision6e1c6c1a6b658123b576228c1b82d1c1a8725c20 (tree)
Time2024-04-09 08:26:41
AuthorJaroslav Fojtik
CommiterJaroslav Fojtik

Log Message

Wrong bounding box during creating EPS has been fixed.

Change Summary

Incremental Difference

diff -r 1d5094c42e32 -r 6e1c6c1a6b65 trunk/sources.cc/images/ras_img.cc
--- a/trunk/sources.cc/images/ras_img.cc Mon Apr 08 19:19:09 2024 +0200
+++ b/trunk/sources.cc/images/ras_img.cc Tue Apr 09 01:26:41 2024 +0200
@@ -1722,7 +1722,7 @@
17221722 #if SupportEPS>=3
17231723
17241724
1725-/** This function returns true, when arg is close to zero. */
1725+/** This function returns true, when arg decimal part is close to zero. */
17261726 static int IsZero2p(double arg)
17271727 {
17281728 int argi;
@@ -2325,7 +2325,7 @@
23252325
23262326 fprintf(f,"%2.0f %2.0f %2.0f %2.0f",
23272327 floor(WPG2PS(bbx.MinX)), floor(WPG2PS(bbx.MinY)), ceil(WPG2PS(bbx.MaxX)), ceil(WPG2PS(bbx.MaxY)));
2328- if(!(IsZero2p(bbx.MinX*71/25.4) && IsZero2p(bbx.MinY*71/25.4) && IsZero2p(bbx.MaxX*71/25.4) && IsZero2p(bbx.MaxY*71/25.4)))
2328+ if(!(IsZero2p(WPG2PS(bbx.MinX)) && IsZero2p(WPG2PS(bbx.MinY)) && IsZero2p(WPG2PS(bbx.MaxX)) && IsZero2p(WPG2PS(bbx.MaxY))))
23292329 {
23302330 fprintf(f,"\n%%%%HiResBoundingBox: %2.2f %2.2f %2.2f %2.2f",
23312331 WPG2PS(bbx.MinX), WPG2PS(bbx.MinY), WPG2PS(bbx.MaxX), WPG2PS(bbx.MaxY));
@@ -2378,7 +2378,7 @@
23782378 DumpRaster2File(f, CurrImg->Raster, CurrImg->Palette,
23792379 WPG2PS((CurrImg->x + fabs(CurrImg->dx)/2)),
23802380 WPG2PS((CurrImg->y + fabs(CurrImg->dy)/2)),
2381- WPG2PS(CurrImg->dx), WPG2PS(CurrImg->dy), CurrImg->RotAngle, CurrImg->ImageType());
2381+ WPG2PS(CurrImg->dx/2), WPG2PS(CurrImg->dy/2), CurrImg->RotAngle, CurrImg->ImageType());
23822382
23832383 fputs("% stop using temporary dictionary\n"
23842384 "end\n"
diff -r 1d5094c42e32 -r 6e1c6c1a6b65 trunk/sources.cc/images/vecraster.cc
--- a/trunk/sources.cc/images/vecraster.cc Mon Apr 08 19:19:09 2024 +0200
+++ b/trunk/sources.cc/images/vecraster.cc Tue Apr 09 01:26:41 2024 +0200
@@ -184,9 +184,11 @@
184184 return temp_string();
185185 }
186186
187+/// @param[in] dx2 half width
188+/// @param[in] dy2 half height
187189 void DumpRaster2File(FILE *f, Raster2DAbstract *Raster, APalette *Palette,
188190 float CenterX, float CenterY,
189- float dx, float dy, float RotAngle, int ColorMode)
191+ float dx2, float dy2, float RotAngle, int ColorMode)
190192 {
191193 unsigned X, Y;
192194 RGBQuad RGB;
@@ -235,14 +237,14 @@
235237 if(fabs(RotAngle) > 1e-5)
236238 {
237239 fprintf(f,"\n%2.2f %2.2f translate\n%g rotate\n%2.2f %2.2f translate",
238- CenterX,CenterY, RotAngle, -CenterX,-CenterY);
240+ CenterX,CenterY, RotAngle, -CenterX,-CenterY);
239241 }
240242
241243 {
242244 float XStart = CenterX;
243245 float YStart = CenterY;
244- XStart -= dx;
245- YStart -= dy;
246+ XStart -= dx2;
247+ YStart -= dy2;
246248
247249 if(fabs(XStart)>1e-3 || fabs(YStart)>1e-3)
248250 {
@@ -253,7 +255,7 @@
253255
254256 fprintf(f,"\n"
255257 "%% size of image (on paper, in 1/72inch coords)\n"
256- "%2.2f %2.2f scale\n\n", 2*dx, 2*dy);
258+ "%2.2f %2.2f scale\n\n", 2*dx2, 2*dy2);
257259
258260 if((ColorMode==ImagePalette || ColorMode==12)) Y=8;
259261 else
@@ -284,8 +286,8 @@
284286 unsigned BytesPerLine = (((unsigned long)RasterPlanes)*Raster->GetSize1D()+7) / 8;
285287
286288 // When negative size is given, flip raster data
287- if(dy < 0) Flip2D(Raster);
288- if(dx < 0) Flip1D(Raster);
289+ if(dy2 < 0) Flip2D(Raster);
290+ if(dx2 < 0) Flip1D(Raster);
289291
290292 for(Y=0; Y<Raster->Size2D; Y++)
291293 {
@@ -406,8 +408,8 @@
406408 fputs("\ngrestore\n",f);
407409
408410 // Return original flip
409- if(dy < 0) Flip2D(Raster);
410- if(dx < 0) Flip1D(Raster);
411+ if(dy2 < 0) Flip2D(Raster);
412+ if(dx2 < 0) Flip1D(Raster);
411413 }
412414
413415
diff -r 1d5094c42e32 -r 6e1c6c1a6b65 trunk/sources.cc/wp2latex.h
--- a/trunk/sources.cc/wp2latex.h Mon Apr 08 19:19:09 2024 +0200
+++ b/trunk/sources.cc/wp2latex.h Tue Apr 09 01:26:41 2024 +0200
@@ -18,7 +18,7 @@
1818 #define LineLength 80 /* Split lines after more than LineLength charcters */
1919
2020 #define VersionWP2L "4.pre6"
21-#define VersionDate "7 Apr 2024" /* day (space) month (space) full year */
21+#define VersionDate "8 Apr 2024" /* day (space) month (space) full year */
2222
2323
2424 /** Constants for a flag InputPS */
Show on old repository browser