From 06aa9dc1fe16b6965b7ea00dbcfaeb8209cdf1bc Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 5 Jul 2004 10:59:32 +0000 Subject: [PATCH] bounding boxes are not required to start at zero anymore. --- pdf2swf/SWFOutputDev.cc | 16 +++++----------- pdf2swf/swfoutput.cc | 16 ++++++++++------ pdf2swf/swfoutput.h | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pdf2swf/SWFOutputDev.cc b/pdf2swf/SWFOutputDev.cc index ea19016..da2899f 100644 --- a/pdf2swf/SWFOutputDev.cc +++ b/pdf2swf/SWFOutputDev.cc @@ -144,7 +144,7 @@ public: void startDoc(XRef *xref); // Start a page. - virtual void startPage(int pageNum, GfxState *state, double x1, double y1, double x2, double y2) ; + virtual void startPage(int pageNum, GfxState *state) ; //----- link borders virtual void drawLink(Link *link, Catalog *catalog) ; @@ -700,27 +700,21 @@ void SWFOutputDev::endType3Char(GfxState *state) msg(" endType3Char"); } -void SWFOutputDev::startPage(int pageNum, GfxState *state, double crop_x1, double crop_y1, double crop_x2, double crop_y2) +void SWFOutputDev::startPage(int pageNum, GfxState *state) { double x1,y1,x2,y2; laststate = state; msg(" startPage %d\n", pageNum); msg(" processing page %d", pageNum); - /*state->transform(state->getX1(),state->getY1(),&x1,&y1); + state->transform(state->getX1(),state->getY1(),&x1,&y1); state->transform(state->getX2(),state->getY2(),&x2,&y2); - */ - x1 = crop_x1; - y1 = crop_y1; - x2 = crop_x2; - y2 = crop_y2; - if(x2 Bounding box is (%f,%f)-(%f,%f)", crop_x1,crop_y1,crop_x2,crop_y2); - swfoutput_init(&output, swffilename,(int)crop_x1,(int)crop_y1,(int)crop_y2,(int)crop_y2); + msg(" Bounding box is (%f,%f)-(%f,%f)", x1,y1,x2,y2); + swfoutput_init(&output, swffilename,(int)x1,(int)y1,(int)y2,(int)y2); outputstarted = 1; } else diff --git a/pdf2swf/swfoutput.cc b/pdf2swf/swfoutput.cc index 5e5e4da..6285081 100644 --- a/pdf2swf/swfoutput.cc +++ b/pdf2swf/swfoutput.cc @@ -1352,15 +1352,15 @@ void swfoutput_drawchar(struct swfoutput* obj,double x,double y,char*character, } /* initialize the swf writer */ -void swfoutput_init(struct swfoutput* obj, char*_filename, int _sizex, int _sizey) +void swfoutput_init(struct swfoutput* obj, char*_filename, int x1, int y1, int x2, int y2) { GLYPH *glyph; RGBA rgb; SRECT r; memset(obj, 0, sizeof(struct swfoutput)); filename = _filename; - sizex = _sizex; - sizey = _sizey; + sizex = x2; + sizey = y2; msg(" initializing swf output for size %d*%d\n", sizex,sizey); @@ -1370,8 +1370,10 @@ void swfoutput_init(struct swfoutput* obj, char*_filename, int _sizex, int _size swf.fileVersion = flashversion; swf.frameRate = 0x0040; // 1 frame per 4 seconds - swf.movieSize.xmax = 20*sizex; - swf.movieSize.ymax = 20*sizey; + swf.movieSize.xmin = 20*x1; + swf.movieSize.ymin = 20*y1; + swf.movieSize.xmax = 20*x2; + swf.movieSize.ymax = 20*y2; swf.firstTag = swf_InsertTag(NULL,ST_SETBACKGROUNDCOLOR); tag = swf.firstTag; @@ -1379,8 +1381,10 @@ void swfoutput_init(struct swfoutput* obj, char*_filename, int _sizex, int _size rgb.g = 0xff; rgb.b = 0xff; swf_SetRGB(tag,&rgb); - if(flag_protected) // good practice! /r + + if(flag_protected) tag = swf_InsertTag(tag, ST_PROTECT); + depth = 1; startdepth = depth; } diff --git a/pdf2swf/swfoutput.h b/pdf2swf/swfoutput.h index 4c09086..5e1c94c 100644 --- a/pdf2swf/swfoutput.h +++ b/pdf2swf/swfoutput.h @@ -102,7 +102,7 @@ struct swfoutput #define DRAWMODE_CLIP 4 #define DRAWMODE_EOCLIP 5 -void swfoutput_init(struct swfoutput*, char*filename, int sizex, int sizey); +void swfoutput_init(struct swfoutput*, char*filename, int x1, int y1, int x2, int y2); void swfoutput_setprotected(); //write PROTECT tag void swfoutput_newpage(struct swfoutput*); -- 1.7.10.4