libocr$(A): $(ocr_objects) devices/ocr.$(O)
$(AR) r libocr$(A) $(ocr_objects) devices/ocr.$(O)
+ $(RANLIB) libocr$(A)
libbase$(A): $(base_objects) Makefile
$(AR) r libbase$(A) $(base_objects)
+ $(RANLIB) libbase$(A)
libgfxswf$(A): devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
$(AR) r libgfxswf$(A) devices/swf.$(O) readers/swf2.$(O) readers/image.$(O)
+ $(RANLIB) libgfxswf$(A)
libgfx$(A): $(gfx_objects) $(gfxpoly_objects) Makefile
$(AR) r libgfx$(A) $(gfx_objects) $(gfxpoly_objects)
+ $(RANLIB) libgfx$(A)
librfxswf$(A): Makefile $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects) Makefile
$(AR) r librfxswf$(A) $(rfxswf_objects) rfxswf.$(O) drawer.$(O) MD5.$(O) $(lame_in_source) $(h263_objects) $(as12compiler_in_source) $(as3compiler_objects)
reader->pos += ret;
return ret;
}
+static void reader_fileread_dealloc(reader_t*r)
+{
+ memset(r, 0, sizeof(reader_t));
+}
void reader_init_filereader(reader_t*r, int handle)
{
r->read = reader_fileread;
+ r->dealloc = reader_fileread_dealloc;
r->internal = (void*)handle;
r->type = READER_TYPE_FILE;
r->mybyte = 0;
static void swf_drawlink(gfxdevice_t*dev, gfxline_t*line, const char*action);
static void swf_startframe(gfxdevice_t*dev, int width, int height);
static void swf_endframe(gfxdevice_t*dev);
+static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points);
+static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points);
+static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points);
+
static gfxresult_t* swf_finish(gfxdevice_t*driver);
static swfoutput_internal* init_internal_struct()
/* Add AVM2 actionscript */
if(i->config_flashversion>=9 &&
- (i->config_insertstoptag || i->hasbuttons)) {
+ (i->config_insertstoptag || i->hasbuttons) && !i->config_linknameurl) {
swf_AddButtonLinks(i->swf, i->config_insertstoptag,
i->config_internallinkfunction||i->config_externallinkfunction);
}
}
-static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, const char*url);
+static void drawlink(gfxdevice_t*dev, ActionTAG*,ActionTAG*, gfxline_t*points, char mouseover, char*type, const char*url);
static void swfoutput_namedlink(gfxdevice_t*dev, char*name, gfxline_t*points);
static void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points);
static void swfoutput_linktourl(gfxdevice_t*dev, const char*url, gfxline_t*points);
}
actions = action_End(actions);
- drawlink(dev, actions, 0, points, 0, url);
-
+ drawlink(dev, actions, 0, points, 0, "url", url);
+
swf_ActionFree(actions);
}
void swfoutput_linktopage(gfxdevice_t*dev, int page, gfxline_t*points)
char name[80];
sprintf(name, "page%d", page);
- drawlink(dev, actions, 0, points, 0, name);
+ drawlink(dev, actions, 0, points, 0, "page", name);
swf_ActionFree(actions);
}
if(i->textmode)
endtext(dev);
+ char*type = 0;
if(!strncmp(tmp, "call:", 5))
{
char*x = strchr(&tmp[5], ':');
}
actions2 = action_End(0);
mouseover = 0;
+ type = "call";
}
else
{
actions2 = action_PushString(actions2, "");
actions2 = action_SetVariable(actions2);
actions2 = action_End(actions2);
+ type = "subtitle";
}
- drawlink(dev, actions1, actions2, points, mouseover, name);
+ drawlink(dev, actions1, actions2, points, mouseover, type, name);
swf_ActionFree(actions1);
swf_ActionFree(actions2);
}
-static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, const char*url)
+static void drawlink(gfxdevice_t*dev, ActionTAG*actions1, ActionTAG*actions2, gfxline_t*points, char mouseover, char*type, const char*url)
{
swfoutput_internal*i = (swfoutput_internal*)dev->internal;
RGBA rgb;
int buttonid = getNewID(dev);
gfxbbox_t bbox = gfxline_getbbox(points);
+ if(i->config_linknameurl) {
+ actions1 = 0;
+ actions2 = 0;
+ }
+
i->hasbuttons = 1;
/* shape */
void (*fillbitmap)(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*imgcoord2devcoord, gfxcxform_t*cxform); //cxform? tiling?
void (*fillgradient)(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*gradcoord2devcoord); //?
- /* deprecated */ void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font);
+ void (*addfont)(struct _gfxdevice*dev, gfxfont_t*font);
void (*drawchar)(struct _gfxdevice*dev, gfxfont_t*font, int glyph, gfxcolor_t*color, gfxmatrix_t*matrix);
//#ifdef SHEAR
// double shear = find_shear_value(svp);
-// gfxline_t*line = gfxpoly_to_gfxline((gfxpoly_t*)svp);
+// gfxline_t*line = gfxline_from_gfxpoly((gfxpoly_t*)svp);
// gfxline_t*l = line;
// while(l) {
// l->y += l->x*shear;
return result;
}
-gfxline_t* gfxpoly_to_gfxline(gfxpoly_t*poly)
+gfxline_t* gfxline_from_gfxpoly(gfxpoly_t*poly)
{
ArtSVP*svp = (ArtSVP*)poly;
int size = 0;
}
}
-gfxpoly_t* gfxpoly_fillToPoly(gfxline_t*line)
+gfxpoly_t* gfxpoly_from_fill(gfxline_t*line, double gridsize)
{
/* I'm not sure whether doing perturbation here is actually
a good idea- if that line has been run through the machinery
return (gfxpoly_t*)svp;
}
-gfxpoly_t* gfxpoly_strokeToPoly(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit)
+gfxpoly_t* gfxpoly_from_stroke(gfxline_t*line, gfxcoord_t width, gfx_capType cap_style, gfx_joinType joint_style, double miterLimit, double gridsize)
{
ArtVpath* vec = gfxline_to_ArtVpath(line, 0);
msg("<verbose> Casting gfxline of %d segments to a stroke-polygon", gfxline_len(line));
return (gfxpoly_t*)svp;
}
-gfxline_t* gfxline_circularToEvenOdd(gfxline_t*line)
+gfxline_t* gfxpoly_circular_to_evenodd(gfxline_t*line, double gridsize)
{
msg("<verbose> Converting circular-filled gfxline of %d segments to even-odd filled gfxline", gfxline_len(line));
ArtSVP* svp = gfxfillToSVP(line, 1);
return 0;
}
- gfxline_t* result = gfxpoly_to_gfxline((gfxpoly_t*)svp_rewinded);
+ gfxline_t* result = gfxline_from_gfxpoly((gfxpoly_t*)svp_rewinded);
art_svp_free(svp);
art_svp_free(svp_rewinded);
return result;
}
-gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2)
+gfxpoly_t* gfxpoly_createbox(double x1, double y1,double x2, double y2, double gridsize)
{
ArtVpath *vec = art_new (ArtVpath, 5+1);
vec[0].code = ART_MOVETO;
return (gfxpoly_t*)svp;
}
-void gfxpoly_free(gfxpoly_t*poly)
+void gfxpoly_destroy(gfxpoly_t*poly)
{
ArtSVP*svp = (ArtSVP*)poly;
art_svp_free(svp);
$(CC) -c stroke.c -o stroke.o
GFX=../gfxfont.o ../gfxtools.o ../devices/ops.o ../devices/polyops.o ../devices/text.o ../devices/bbox.o ../devices/render.o ../devices/rescale.o ../devices/record.o
-
stroke: test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a ../libbase.a
- $(CC) test_stroke.c $(OBJS) ../librfxswf.a ../libgfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS)
+ $(CC) test_stroke.c $(OBJS) ../libgfxswf.a ../librfxswf.a $(GFX) ../libbase.a -o stroke $(LIBS)
SWF = ../librfxswf.a ../libpdf.a -lstdc++
test: ../libbase.a test.c $(OBJS) poly.h convert.h $(GFX)
- $(CC) test.c $(OBJS) $(SWF) ../libbase.a $(GFX) -o test $(LIBS)
+ $(CC) test.c $(OBJS) $(SWF) $(GFX) ../libbase.a -o test $(LIBS)
clean:
rm -f *.o test stroke
#include <math.h>
#include "../gfxtools.h"
+#include "convert.h"
#include "stroke.h"
#include "convert.h"
int has_alpha = swf_ImageHasAlpha(mem,width,height);
/* try lossless image */
+
+#ifdef NO_LOSSLESS
+ tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0);
+ tag1->len = 0x7fffffff;
+#else
tag1 = swf_InsertTag(0, /*ST_DEFINEBITSLOSSLESS1/2*/0);
swf_SetU16(tag1, bitid);
swf_SetLosslessImage(tag1, mem, width, height);
+#endif
#if defined(HAVE_JPEGLIB)
/* try jpeg image */
gfxmatrix_t m = this->current_font_matrix;
this->transformXY(state, x-originX, y-originY, &m.tx, &m.ty);
//m.tx += originX; m.ty += originY;
-
- msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont);
- if((render == RENDER_FILL && !config_drawonlyshapes) || render == RENDER_INVISIBLE) {
+ msg("<debug> drawChar(%f,%f,c='%c' (%d), u=%d <%d>) CID=%d render=%d glyphid=%d font=%08x",m.tx,m.ty,(charid&127)>=32?charid:'?', charid, u, uLen, font->isCIDFont(), render, glyphid, current_gfxfont);
+
+ if((render == RENDER_FILL && !config_drawonlyshapes) ||
+ (render == RENDER_FILLSTROKE && state->getTransformedLineWidth()<1.0) ||
+ (render == RENDER_INVISIBLE)) {
+
int space = this->current_fontinfo->space_char;
if(config_extrafontdata && space>=0 && m.m00 && !m.m01) {
/* space char detection */
msg("<notice> Some texts will be rendered as shape");
gfxglobals->textmodeinfo = 1;
}
+
gfxline_t*glyph = current_gfxfont->glyphs[glyphid].line;
gfxline_t*tglyph = gfxline_clone(glyph);
gfxline_transform(tglyph, &m);
gfxmatrix_t m = this->current_font_matrix;
this->transformXY(state, 0, 0, &m.tx, &m.ty);
- m.m00*=INTERNAL_FONT_SIZE;
+
+ /*m.m00*=INTERNAL_FONT_SIZE;
m.m01*=INTERNAL_FONT_SIZE;
m.m10*=INTERNAL_FONT_SIZE;
- m.m11*=INTERNAL_FONT_SIZE;
+ m.m11*=INTERNAL_FONT_SIZE;*/
if(!current_fontinfo || (unsigned)charid >= current_fontinfo->num_glyphs || !current_fontinfo->glyphs[charid]) {
msg("<error> Invalid charid %d for font", charid);
current_gfxfont = this->current_fontinfo->getGfxFont();
device->addfont(device, current_gfxfont);
free(id);
+
+ device->addfont(device, current_gfxfont);
updateFontMatrix(state);
}
int num_polygons;
int num_textfields;
- void finish();
void dumpfonts(gfxdevice_t*dev);
InfoOutputDev(XRef*xref);
void swf_SetS16(TAG * t,int v)
{
if(v>32767 || v<-32768) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr, "Warning: S16 overflow: %d\n", v);
+ #endif
}
swf_SetU16(t, (S16)v);
}
nbits = swf_CountBits(r->ymin,nbits);
nbits = swf_CountBits(r->ymax,nbits);
if(nbits>=32) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr, "rfxswf: Warning: num_bits overflow in swf_SetRect\n");
+ #endif
nbits=31;
}
nbits = swf_CountBits(m->sy,nbits);
if(nbits>=32) {
/* TODO: happens on AMD64 systems for normal values? */
+ #ifdef DEBUG_RFXSWF
fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ #endif
nbits = 31;
}
swf_SetBits(t,nbits,5);
nbits = swf_CountBits(m->r0,0);
nbits = swf_CountBits(m->r1,nbits);
if(nbits>=32) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ #endif
nbits = 31;
}
swf_SetBits(t,nbits,5);
nbits = swf_CountBits(m->tx,0);
nbits = swf_CountBits(m->ty,nbits);
if(nbits>=32) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr,"rfxswf: Error: matrix values too large\n");
+ #endif
nbits = 31;
}
swf_SetBits(t,nbits,5);
{ t->data = (U8*)rfx_alloc(t->len);
t->memsize = t->len;
if (reader->read(reader, t->data, t->len) != t->len) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr, "rfxswf: Warning: Short read (tagid %d). File truncated?\n", t->id);
+ #endif
free(t->data);t->data=0;
free(t);
return NULL;
if(t->id!=ST_DEFINESPRITE)
return;
if(!t->len) {
+ #ifdef DEBUG_RFXSWF
fprintf(stderr, "Error: Sprite has no ID!");
+ #endif
return;
}
if(t->len>4) {
return "pixel at (%d,%d)" % (self.x2,self.y2)
class PixelBrighterThan(TwoPixelCheck):
- pass
+ def verifies(self, model):
+ p1 = model.getPixel(self.x,self.y)
+ p2 = model.getPixel(self.x2,self.y2)
+ val1 = p1[0] + p1[1] + p1[2]
+ val2 = p2[0] + p2[1] + p2[2]
+ return val1 > val2
class PixelDarkerThan(TwoPixelCheck):
pass
pagenum = 0;
gfxdevice_t*out = create_output_device();;
+ pdf->prepare(pdf, out);
+
for(pagenr = 1; pagenr <= pdf->num_pages; pagenr++)
{
if(is_in_range(pagenr, pagerange)) {
swf_WriteSWF(fi, &newswf);
}
close(fi);
- return 0;
+
+ return 0; //ok
}