WP2LaTeX sources.
| Revision | 6e1c6c1a6b658123b576228c1b82d1c1a8725c20 (tree) |
|---|---|
| Time | 2024-04-09 08:26:41 |
| Author | Jaroslav Fojtik |
| Commiter | Jaroslav Fojtik |
Wrong bounding box during creating EPS has been fixed.
| @@ -1722,7 +1722,7 @@ | ||
| 1722 | 1722 | #if SupportEPS>=3 |
| 1723 | 1723 | |
| 1724 | 1724 | |
| 1725 | -/** This function returns true, when arg is close to zero. */ | |
| 1725 | +/** This function returns true, when arg decimal part is close to zero. */ | |
| 1726 | 1726 | static int IsZero2p(double arg) |
| 1727 | 1727 | { |
| 1728 | 1728 | int argi; |
| @@ -2325,7 +2325,7 @@ | ||
| 2325 | 2325 | |
| 2326 | 2326 | fprintf(f,"%2.0f %2.0f %2.0f %2.0f", |
| 2327 | 2327 | 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)))) | |
| 2329 | 2329 | { |
| 2330 | 2330 | fprintf(f,"\n%%%%HiResBoundingBox: %2.2f %2.2f %2.2f %2.2f", |
| 2331 | 2331 | WPG2PS(bbx.MinX), WPG2PS(bbx.MinY), WPG2PS(bbx.MaxX), WPG2PS(bbx.MaxY)); |
| @@ -2378,7 +2378,7 @@ | ||
| 2378 | 2378 | DumpRaster2File(f, CurrImg->Raster, CurrImg->Palette, |
| 2379 | 2379 | WPG2PS((CurrImg->x + fabs(CurrImg->dx)/2)), |
| 2380 | 2380 | 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()); | |
| 2382 | 2382 | |
| 2383 | 2383 | fputs("% stop using temporary dictionary\n" |
| 2384 | 2384 | "end\n" |
| @@ -184,9 +184,11 @@ | ||
| 184 | 184 | return temp_string(); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | +/// @param[in] dx2 half width | |
| 188 | +/// @param[in] dy2 half height | |
| 187 | 189 | void DumpRaster2File(FILE *f, Raster2DAbstract *Raster, APalette *Palette, |
| 188 | 190 | float CenterX, float CenterY, |
| 189 | - float dx, float dy, float RotAngle, int ColorMode) | |
| 191 | + float dx2, float dy2, float RotAngle, int ColorMode) | |
| 190 | 192 | { |
| 191 | 193 | unsigned X, Y; |
| 192 | 194 | RGBQuad RGB; |
| @@ -235,14 +237,14 @@ | ||
| 235 | 237 | if(fabs(RotAngle) > 1e-5) |
| 236 | 238 | { |
| 237 | 239 | 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); | |
| 239 | 241 | } |
| 240 | 242 | |
| 241 | 243 | { |
| 242 | 244 | float XStart = CenterX; |
| 243 | 245 | float YStart = CenterY; |
| 244 | - XStart -= dx; | |
| 245 | - YStart -= dy; | |
| 246 | + XStart -= dx2; | |
| 247 | + YStart -= dy2; | |
| 246 | 248 | |
| 247 | 249 | if(fabs(XStart)>1e-3 || fabs(YStart)>1e-3) |
| 248 | 250 | { |
| @@ -253,7 +255,7 @@ | ||
| 253 | 255 | |
| 254 | 256 | fprintf(f,"\n" |
| 255 | 257 | "%% 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); | |
| 257 | 259 | |
| 258 | 260 | if((ColorMode==ImagePalette || ColorMode==12)) Y=8; |
| 259 | 261 | else |
| @@ -284,8 +286,8 @@ | ||
| 284 | 286 | unsigned BytesPerLine = (((unsigned long)RasterPlanes)*Raster->GetSize1D()+7) / 8; |
| 285 | 287 | |
| 286 | 288 | // 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); | |
| 289 | 291 | |
| 290 | 292 | for(Y=0; Y<Raster->Size2D; Y++) |
| 291 | 293 | { |
| @@ -406,8 +408,8 @@ | ||
| 406 | 408 | fputs("\ngrestore\n",f); |
| 407 | 409 | |
| 408 | 410 | // 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); | |
| 411 | 413 | } |
| 412 | 414 | |
| 413 | 415 |
| @@ -18,7 +18,7 @@ | ||
| 18 | 18 | #define LineLength 80 /* Split lines after more than LineLength charcters */ |
| 19 | 19 | |
| 20 | 20 | #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 */ | |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /** Constants for a flag InputPS */ |