fz_device *fz_new_trace_device(fz_context *ctx)
{
	fz_device *dev = fz_new_device(ctx, NULL);

	dev->fill_path = fz_trace_fill_path;
	dev->stroke_path = fz_trace_stroke_path;
	dev->clip_path = fz_trace_clip_path;
	dev->clip_stroke_path = fz_trace_clip_stroke_path;

	dev->fill_text = fz_trace_fill_text;
	dev->stroke_text = fz_trace_stroke_text;
	dev->clip_text = fz_trace_clip_text;
	dev->clip_stroke_text = fz_trace_clip_stroke_text;
	dev->ignore_text = fz_trace_ignore_text;

	dev->fill_shade = fz_trace_fill_shade;
	dev->fill_image = fz_trace_fill_image;
	dev->fill_image_mask = fz_trace_fill_image_mask;
	dev->clip_image_mask = fz_trace_clip_image_mask;

	dev->pop_clip = fz_trace_pop_clip;

	dev->begin_mask = fz_trace_begin_mask;
	dev->end_mask = fz_trace_end_mask;
	dev->begin_group = fz_trace_begin_group;
	dev->end_group = fz_trace_end_group;

	dev->begin_tile = fz_trace_begin_tile;
	dev->end_tile = fz_trace_end_tile;

	/* SumatraPDF: support transfer functions */
	dev->apply_transfer_function = fz_trace_apply_transfer_function;

	return dev;
}
Esempio n. 2
0
fz_device *fz_new_ofpath_device(fz_context *ctx, vector< ofPtr<ofPath> > &paths)
{
	fz_ofpath_device *ddev = fz_malloc_struct(ctx, fz_ofpath_device);
	ddev->paths = &paths;
	
	fz_device *dev = fz_new_device(ctx, ddev);
	
	dev->fill_path = ofpath_fill_path;
	dev->stroke_path = ofpath_stroke_path;
	dev->clip_path = ofpath_clip_path;
	dev->clip_stroke_path = ofpath_clip_stroke_path;
	
	dev->fill_text = ofpath_fill_text;
	dev->stroke_text = ofpath_stroke_text;
	dev->clip_text = ofpath_clip_text;
	dev->clip_stroke_text = ofpath_clip_stroke_text;
	dev->ignore_text = ofpath_ignore_text;
	
	dev->fill_shade = ofpath_fill_shade;
	dev->fill_image = ofpath_fill_image;
	dev->fill_image_mask = ofpath_fill_image_mask;
	dev->clip_image_mask = ofpath_clip_image_mask;
	
	dev->pop_clip = ofpath_pop_clip;
	
	dev->begin_mask = ofpath_begin_mask;
	dev->end_mask = ofpath_end_mask;
	dev->begin_group = ofpath_begin_group;
	dev->end_group = ofpath_end_group;
	
	dev->begin_tile = ofpath_begin_tile;
	dev->end_tile = ofpath_end_tile;
	
	return dev;
}
Esempio n. 3
0
fz_device *
fz_new_text_device(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
{
	fz_text_device *dev = fz_new_device(ctx, sizeof *dev);

	dev->super.hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;

	dev->super.drop_imp = fz_text_drop_imp;
	dev->super.begin_page = fz_text_begin_page;
	dev->super.end_page = fz_text_end_page;
	dev->super.fill_text = fz_text_fill_text;
	dev->super.stroke_text = fz_text_stroke_text;
	dev->super.clip_text = fz_text_clip_text;
	dev->super.clip_stroke_text = fz_text_clip_stroke_text;
	dev->super.ignore_text = fz_text_ignore_text;
	dev->super.fill_image = fz_text_fill_image;
	dev->super.fill_image_mask = fz_text_fill_image_mask;

	dev->sheet = sheet;
	dev->page = page;
	dev->spans = NULL;
	dev->cur_span = NULL;
	dev->lastchar = ' ';

	return (fz_device*)dev;
}
Esempio n. 4
0
fz_device *
fz_new_list_device(fz_display_list *list)
{
	fz_device *dev = fz_new_device(list);

	dev->fill_path = fz_list_fill_path;
	dev->stroke_path = fz_list_stroke_path;
	dev->clip_path = fz_list_clip_path;
	dev->clip_stroke_path = fz_list_clip_stroke_path;

	dev->fill_text = fz_list_fill_text;
	dev->stroke_text = fz_list_stroke_text;
	dev->clip_text = fz_list_clip_text;
	dev->clip_stroke_text = fz_list_clip_stroke_text;
	dev->ignore_text = fz_list_ignore_text;

	dev->fill_shade = fz_list_fill_shade;
	dev->fill_image = fz_list_fill_image;
	dev->fill_image_mask = fz_list_fill_image_mask;
	dev->clip_image_mask = fz_list_clip_image_mask;

	dev->pop_clip = fz_list_pop_clip;

	dev->begin_mask = fz_list_begin_mask;
	dev->end_mask = fz_list_end_mask;
	dev->begin_group = fz_list_begin_group;
	dev->end_group = fz_list_end_group;

	dev->begin_tile = fz_list_begin_tile;
	dev->end_tile = fz_list_end_tile;

	return dev;
}
Esempio n. 5
0
fz_device *
fz_new_test_device(fz_context *ctx, int *is_color, float threshold)
{
	struct test *t;
	fz_device *dev;

	t = fz_malloc_struct(ctx, struct test);
	t->is_color = is_color;
	t->threshold = threshold;

	fz_try(ctx)
	{
		dev = fz_new_device(ctx, t);
	}
	fz_catch(ctx)
	{
		fz_free(ctx, t);
		fz_rethrow(ctx);
	}

	dev->fill_path = fz_test_fill_path;
	dev->stroke_path = fz_test_stroke_path;
	dev->fill_text = fz_test_fill_text;
	dev->stroke_text = fz_test_stroke_text;
	dev->fill_shade = fz_test_fill_shade;
	dev->fill_image = fz_test_fill_image;
	dev->fill_image_mask = fz_test_fill_image_mask;
	dev->free_user = fz_test_free;

	*t->is_color = 0;

	return dev;
}
Esempio n. 6
0
fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height)
{
	svg_device *sdev = fz_malloc_struct(ctx, svg_device);
	fz_device *dev;

	fz_try(ctx)
	{
		sdev->ctx = ctx;
		sdev->out = out;
		sdev->out_store = out;
		sdev->id = 0;

		dev = fz_new_device(ctx, sdev);
	}
	fz_catch(ctx)
	{
		fz_free(ctx, sdev);
		fz_rethrow(ctx);
	}

	dev->rebind = svg_rebind;
	dev->free_user = svg_dev_free_user;

	dev->fill_path = svg_dev_fill_path;
	dev->stroke_path = svg_dev_stroke_path;
	dev->clip_path = svg_dev_clip_path;
	dev->clip_stroke_path = svg_dev_clip_stroke_path;

	dev->fill_text = svg_dev_fill_text;
	dev->stroke_text = svg_dev_stroke_text;
	dev->clip_text = svg_dev_clip_text;
	dev->clip_stroke_text = svg_dev_clip_stroke_text;
	dev->ignore_text = svg_dev_ignore_text;

	dev->fill_shade = svg_dev_fill_shade;
	dev->fill_image = svg_dev_fill_image;
	dev->fill_image_mask = svg_dev_fill_image_mask;
	dev->clip_image_mask = svg_dev_clip_image_mask;

	dev->pop_clip = svg_dev_pop_clip;

	dev->begin_mask = svg_dev_begin_mask;
	dev->end_mask = svg_dev_end_mask;
	dev->begin_group = svg_dev_begin_group;
	dev->end_group = svg_dev_end_group;

	dev->begin_tile = svg_dev_begin_tile;
	dev->end_tile = svg_dev_end_tile;

	dev->hints |= FZ_MAINTAIN_CONTAINER_STACK;

	fz_printf(out, "<?xml version=\"1.0\" standalone=\"no\"?>\n");
	fz_printf(out, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
	fz_printf(out, "<svg xmlns=\"http://www.w3.org/2000/svg\" "
		"xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" "
		"width=\"%gcm\" height=\"%gcm\" viewBox=\"0 0 %g %g\">\n",
		page_width*2.54/72, page_height*2.54/72, page_width, page_height);

	return dev;
}
Esempio n. 7
0
fz_device *fz_new_trace_device(void)
{
	fz_device *dev = fz_new_device(NULL);

	dev->fill_path = fz_trace_fill_path;
	dev->stroke_path = fz_trace_stroke_path;
	dev->clip_path = fz_trace_clip_path;
	dev->clip_stroke_path = fz_trace_clip_stroke_path;

	dev->fill_text = fz_trace_fill_text;
	dev->stroke_text = fz_trace_stroke_text;
	dev->clip_text = fz_trace_clip_text;
	dev->clip_stroke_text = fz_trace_clip_stroke_text;
	dev->ignore_text = fz_trace_ignore_text;

	dev->fill_shade = fz_trace_fill_shade;
	dev->fill_image = fz_trace_fill_image;
	dev->fill_image_mask = fz_trace_fill_image_mask;
	dev->clip_image_mask = fz_trace_clip_image_mask;

	dev->pop_clip = fz_trace_pop_clip;

	dev->begin_mask = fz_trace_begin_mask;
	dev->end_mask = fz_trace_end_mask;
	dev->begin_group = fz_trace_begin_group;
	dev->end_group = fz_trace_end_group;

	dev->begin_tile = fz_trace_begin_tile;
	dev->end_tile = fz_trace_end_tile;

	return dev;
}
Esempio n. 8
0
fz_device *
fz_new_text_device(fz_context *ctx, fz_text_sheet *sheet, fz_text_page *page)
{
	fz_device *dev;

	fz_text_device *tdev = fz_malloc_struct(ctx, fz_text_device);
	tdev->sheet = sheet;
	tdev->page = page;
	tdev->point.x = -1;
	tdev->point.y = -1;
	tdev->lastchar = ' ';

	init_line(ctx, &tdev->cur_line);
	init_span(ctx, &tdev->cur_span, NULL);

	dev = fz_new_device(ctx, tdev);
	dev->hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
	dev->free_user = fz_text_free_user;
	dev->fill_text = fz_text_fill_text;
	dev->stroke_text = fz_text_stroke_text;
	dev->clip_text = fz_text_clip_text;
	dev->clip_stroke_text = fz_text_clip_stroke_text;
	dev->ignore_text = fz_text_ignore_text;
	return dev;
}
Esempio n. 9
0
fz_device *
fz_new_draw_device(fz_context *ctx, fz_glyph_cache *cache, fz_pixmap *dest)
{
	fz_device *dev;
	fz_draw_device *ddev = fz_malloc(ctx, sizeof(fz_draw_device));
	ddev->cache = cache;
	ddev->gel = fz_new_gel(ctx);
	ddev->dest = dest;
	ddev->shape = NULL;
	ddev->top = 0;
	ddev->blendmode = 0;
	ddev->flags = 0;
	ddev->stack = &ddev->init_stack[0];
	ddev->stack_max = STACK_SIZE;
	ddev->ctx = ctx;

	ddev->scissor.x0 = dest->x;
	ddev->scissor.y0 = dest->y;
	ddev->scissor.x1 = dest->x + dest->w;
	ddev->scissor.y1 = dest->y + dest->h;

	dev = fz_new_device(ctx, ddev);
	dev->free_user = fz_draw_free_user;

	dev->fill_path = fz_draw_fill_path;
	dev->stroke_path = fz_draw_stroke_path;
	dev->clip_path = fz_draw_clip_path;
	dev->clip_stroke_path = fz_draw_clip_stroke_path;

	dev->fill_text = fz_draw_fill_text;
	dev->stroke_text = fz_draw_stroke_text;
	dev->clip_text = fz_draw_clip_text;
	dev->clip_stroke_text = fz_draw_clip_stroke_text;
	dev->ignore_text = fz_draw_ignore_text;

	dev->fill_image_mask = fz_draw_fill_image_mask;
	dev->clip_image_mask = fz_draw_clip_image_mask;
	dev->fill_image = fz_draw_fill_image;
	dev->fill_shade = fz_draw_fill_shade;

	dev->pop_clip = fz_draw_pop_clip;

	dev->begin_mask = fz_draw_begin_mask;
	dev->end_mask = fz_draw_end_mask;
	dev->begin_group = fz_draw_begin_group;
	dev->end_group = fz_draw_end_group;

	dev->begin_tile = fz_draw_begin_tile;
	dev->end_tile = fz_draw_end_tile;

	return dev;
}
Esempio n. 10
0
fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height)
{
	svg_device *dev = fz_new_device(ctx, sizeof *dev);

	dev->super.close_device = svg_dev_close_device;
	dev->super.drop_device = svg_dev_drop_device;

	dev->super.fill_path = svg_dev_fill_path;
	dev->super.stroke_path = svg_dev_stroke_path;
	dev->super.clip_path = svg_dev_clip_path;
	dev->super.clip_stroke_path = svg_dev_clip_stroke_path;

	dev->super.fill_text = svg_dev_fill_text;
	dev->super.stroke_text = svg_dev_stroke_text;
	dev->super.clip_text = svg_dev_clip_text;
	dev->super.clip_stroke_text = svg_dev_clip_stroke_text;
	dev->super.ignore_text = svg_dev_ignore_text;

	dev->super.fill_shade = svg_dev_fill_shade;
	dev->super.fill_image = svg_dev_fill_image;
	dev->super.fill_image_mask = svg_dev_fill_image_mask;
	dev->super.clip_image_mask = svg_dev_clip_image_mask;

	dev->super.pop_clip = svg_dev_pop_clip;

	dev->super.begin_mask = svg_dev_begin_mask;
	dev->super.end_mask = svg_dev_end_mask;
	dev->super.begin_group = svg_dev_begin_group;
	dev->super.end_group = svg_dev_end_group;

	dev->super.begin_tile = svg_dev_begin_tile;
	dev->super.end_tile = svg_dev_end_tile;

	dev->super.hints |= FZ_MAINTAIN_CONTAINER_STACK;

	dev->out = out;
	dev->out_store = out;
	dev->id = 0;

	fz_printf(ctx, out, "<?xml version=\"1.0\" standalone=\"no\"?>\n");
	fz_printf(ctx, out, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
	fz_printf(ctx, out, "<svg xmlns=\"http://www.w3.org/2000/svg\" "
		"xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\" "
		"width=\"%gcm\" height=\"%gcm\" viewBox=\"0 0 %g %g\">\n",
		page_width*2.54/72, page_height*2.54/72, page_width, page_height);

	return (fz_device*)dev;
}
Esempio n. 11
0
fz_device *
fz_new_draw_device(fz_glyph_cache *cache, fz_pixmap *dest)
{
	fz_device *dev;
	fz_draw_device *ddev = fz_malloc(sizeof(fz_draw_device));
	ddev->cache = cache;
	ddev->gel = fz_new_gel();
	ddev->dest = dest;
	ddev->top = 0;

	ddev->scissor.x0 = dest->x;
	ddev->scissor.y0 = dest->y;
	ddev->scissor.x1 = dest->x + dest->w;
	ddev->scissor.y1 = dest->y + dest->h;

	dev = fz_new_device(ddev);
	dev->free_user = fz_draw_free_user;

	dev->fill_path = fz_draw_fill_path;
	dev->stroke_path = fz_draw_stroke_path;
	dev->clip_path = fz_draw_clip_path;
	dev->clip_stroke_path = fz_draw_clip_stroke_path;

	dev->fill_text = fz_draw_fill_text;
	dev->stroke_text = fz_draw_stroke_text;
	dev->clip_text = fz_draw_clip_text;
	dev->clip_stroke_text = fz_draw_clip_stroke_text;
	dev->ignore_text = fz_draw_ignore_text;

	dev->fill_image_mask = fz_draw_fill_image_mask;
	dev->clip_image_mask = fz_draw_clip_image_mask;
	dev->fill_image = fz_draw_fill_image;
	dev->fill_shade = fz_draw_fill_shade;

	dev->pop_clip = fz_draw_pop_clip;

	dev->begin_mask = fz_draw_begin_mask;
	dev->end_mask = fz_draw_end_mask;
	dev->begin_group = fz_draw_begin_group;
	dev->end_group = fz_draw_end_group;

	dev->begin_tile = fz_draw_begin_tile;
	dev->end_tile = fz_draw_end_tile;

	return dev;
}
Esempio n. 12
0
fz_device *fzNewPathExtDevice(fz_context *ctx, PathExt *user)
{
  fz_device *dev = NULL;
  fz_var(dev);

  fz_try(ctx) {
    dev = fz_new_device(ctx, user);
  } fz_catch(ctx) {
    return NULL;
  }

#if 0
  dev->free_user = pathext_free_user;

  dev->fill_path        = pathext_fill_path;
#endif
  dev->stroke_path      = pathext_stroke_path;
#if 0
  dev->clip_path        = pathext_clip_path;
  dev->clip_stroke_path = pathext_clip_stroke_path;

  dev->fill_text        = pathext_fill_text;
  dev->stroke_text      = pathext_stroke_text;
  dev->clip_text        = pathext_clip_text;
  dev->clip_stroke_text = pathext_clip_stroke_text;
  dev->ignore_text      = pathext_ignore_text;

  dev->fill_image_mask = pathext_fill_image_mask;
  dev->clip_image_mask = pathext_clip_image_mask;
  dev->fill_image      = pathext_fill_image;
  dev->fill_shade      = pathext_fill_shade;

  dev->pop_clip = pathext_pop_clip;

  dev->begin_mask  = pathext_begin_mask;
  dev->end_mask    = pathext_end_mask;
  dev->begin_group = pathext_begin_group;
  dev->end_group   = pathext_end_group;

  dev->begin_tile = pathext_begin_tile;
  dev->end_tile   = pathext_end_tile;
#endif

  return dev;
}
Esempio n. 13
0
fz_device *
fz_new_bbox_device(fz_context *ctx, fz_rect *result)
{
	fz_device *dev;

	dev = fz_new_device(ctx, result);

	dev->fill_path = fz_bbox_fill_path;
	dev->stroke_path = fz_bbox_stroke_path;
	dev->fill_text = fz_bbox_fill_text;
	dev->stroke_text = fz_bbox_stroke_text;
	dev->fill_shade = fz_bbox_fill_shade;
	dev->fill_image = fz_bbox_fill_image;
	dev->fill_image_mask = fz_bbox_fill_image_mask;

	*result = fz_empty_rect;

	return dev;
}
Esempio n. 14
0
fz_device *
fz_new_test_device(fz_context *ctx, int *is_color, float threshold)
{
	fz_test_device *dev = fz_new_device(ctx, sizeof *dev);

	dev->super.fill_path = fz_test_fill_path;
	dev->super.stroke_path = fz_test_stroke_path;
	dev->super.fill_text = fz_test_fill_text;
	dev->super.stroke_text = fz_test_stroke_text;
	dev->super.fill_shade = fz_test_fill_shade;
	dev->super.fill_image = fz_test_fill_image;
	dev->super.fill_image_mask = fz_test_fill_image_mask;

	dev->is_color = is_color;
	dev->threshold = threshold;

	*dev->is_color = 0;

	return (fz_device*)dev;
}
Esempio n. 15
0
fz_device *
fz_new_text_device(fz_context *ctx, fz_text_span *root)
{
	fz_device *dev;
	fz_text_device *tdev = fz_malloc_struct(ctx, fz_text_device);
	tdev->head = root;
	tdev->span = root;
	tdev->point.x = -1;
	tdev->point.y = -1;

	dev = fz_new_device(ctx, tdev);
	dev->hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
	dev->free_user = fz_text_free_user;
	dev->fill_text = fz_text_fill_text;
	dev->stroke_text = fz_text_stroke_text;
	dev->clip_text = fz_text_clip_text;
	dev->clip_stroke_text = fz_text_clip_stroke_text;
	dev->ignore_text = fz_text_ignore_text;
	return dev;
}
Esempio n. 16
0
fz_device *
fz_new_bbox_device(fz_context *ctx, fz_bbox *result)
{
	fz_device *dev;

	fz_bbox_data *user = fz_malloc_struct(ctx, fz_bbox_data);
	user->result = result;
	user->top = 0;
	user->ignore = 0;
	dev = fz_new_device(ctx, user);
	dev->free_user = fz_bbox_free_user;

	dev->fill_path = fz_bbox_fill_path;
	dev->stroke_path = fz_bbox_stroke_path;
	dev->clip_path = fz_bbox_clip_path;
	dev->clip_stroke_path = fz_bbox_clip_stroke_path;

	dev->fill_text = fz_bbox_fill_text;
	dev->stroke_text = fz_bbox_stroke_text;
	dev->clip_text = fz_bbox_clip_text;
	dev->clip_stroke_text = fz_bbox_clip_stroke_text;

	dev->fill_shade = fz_bbox_fill_shade;
	dev->fill_image = fz_bbox_fill_image;
	dev->fill_image_mask = fz_bbox_fill_image_mask;
	dev->clip_image_mask = fz_bbox_clip_image_mask;

	dev->pop_clip = fz_bbox_pop_clip;

	dev->begin_mask = fz_bbox_begin_mask;
	dev->end_mask = fz_bbox_end_mask;
	dev->begin_group = fz_bbox_begin_group;
	dev->end_group = fz_bbox_end_group;

	dev->begin_tile = fz_bbox_begin_tile;
	dev->end_tile = fz_bbox_end_tile;

	*result = fz_empty_bbox;

	return dev;
}
Esempio n. 17
0
fz_device *
fz_new_bbox_device(fz_context *ctx, fz_rect *result)
{
	fz_bbox_device *dev = fz_new_device(ctx, sizeof *dev);

	dev->super.drop_imp = fz_bbox_drop_imp;

	dev->super.fill_path = fz_bbox_fill_path;
	dev->super.stroke_path = fz_bbox_stroke_path;
	dev->super.clip_path = fz_bbox_clip_path;
	dev->super.clip_stroke_path = fz_bbox_clip_stroke_path;

	dev->super.fill_text = fz_bbox_fill_text;
	dev->super.stroke_text = fz_bbox_stroke_text;
	dev->super.clip_text = fz_bbox_clip_text;
	dev->super.clip_stroke_text = fz_bbox_clip_stroke_text;

	dev->super.fill_shade = fz_bbox_fill_shade;
	dev->super.fill_image = fz_bbox_fill_image;
	dev->super.fill_image_mask = fz_bbox_fill_image_mask;
	dev->super.clip_image_mask = fz_bbox_clip_image_mask;

	dev->super.pop_clip = fz_bbox_pop_clip;

	dev->super.begin_mask = fz_bbox_begin_mask;
	dev->super.end_mask = fz_bbox_end_mask;
	dev->super.begin_group = fz_bbox_begin_group;
	dev->super.end_group = fz_bbox_end_group;

	dev->super.begin_tile = fz_bbox_begin_tile;
	dev->super.end_tile = fz_bbox_end_tile;

	dev->result = result;
	dev->top = 0;
	dev->ignore = 0;

	*result = fz_empty_rect;

	return (fz_device*)dev;
}
Esempio n. 18
0
fz_device *
fz_new_list_device(fz_context *ctx, fz_display_list *list)
{
	fz_device *dev = fz_new_device(ctx, list);

	dev->begin_page = fz_list_begin_page;
	dev->end_page = fz_list_end_page;

	dev->fill_path = fz_list_fill_path;
	dev->stroke_path = fz_list_stroke_path;
	dev->clip_path = fz_list_clip_path;
	dev->clip_stroke_path = fz_list_clip_stroke_path;

	dev->fill_text = fz_list_fill_text;
	dev->stroke_text = fz_list_stroke_text;
	dev->clip_text = fz_list_clip_text;
	dev->clip_stroke_text = fz_list_clip_stroke_text;
	dev->ignore_text = fz_list_ignore_text;

	dev->fill_shade = fz_list_fill_shade;
	dev->fill_image = fz_list_fill_image;
	dev->fill_image_mask = fz_list_fill_image_mask;
	dev->clip_image_mask = fz_list_clip_image_mask;

	dev->pop_clip = fz_list_pop_clip;

	dev->begin_mask = fz_list_begin_mask;
	dev->end_mask = fz_list_end_mask;
	dev->begin_group = fz_list_begin_group;
	dev->end_group = fz_list_end_group;

	dev->begin_tile = fz_list_begin_tile;
	dev->end_tile = fz_list_end_tile;

	/* SumatraPDF: support transfer functions */
	dev->apply_transfer_function = fz_list_apply_transfer_function;

	return dev;
}
Esempio n. 19
0
fz_device *fz_new_trace_device(fz_context *ctx, fz_output *out)
{
	fz_trace_device *dev = fz_new_device(ctx, sizeof *dev);

	dev->super.begin_page = fz_trace_begin_page;
	dev->super.end_page = fz_trace_end_page;

	dev->super.fill_path = fz_trace_fill_path;
	dev->super.stroke_path = fz_trace_stroke_path;
	dev->super.clip_path = fz_trace_clip_path;
	dev->super.clip_stroke_path = fz_trace_clip_stroke_path;

	dev->super.fill_text = fz_trace_fill_text;
	dev->super.stroke_text = fz_trace_stroke_text;
	dev->super.clip_text = fz_trace_clip_text;
	dev->super.clip_stroke_text = fz_trace_clip_stroke_text;
	dev->super.ignore_text = fz_trace_ignore_text;

	dev->super.fill_shade = fz_trace_fill_shade;
	dev->super.fill_image = fz_trace_fill_image;
	dev->super.fill_image_mask = fz_trace_fill_image_mask;
	dev->super.clip_image_mask = fz_trace_clip_image_mask;

	dev->super.pop_clip = fz_trace_pop_clip;

	dev->super.begin_mask = fz_trace_begin_mask;
	dev->super.end_mask = fz_trace_end_mask;
	dev->super.begin_group = fz_trace_begin_group;
	dev->super.end_group = fz_trace_end_group;

	dev->super.begin_tile = fz_trace_begin_tile;
	dev->super.end_tile = fz_trace_end_tile;

	dev->out = out;

	return (fz_device*)dev;
}
Esempio n. 20
0
fz_device *
fz_new_draw_device(fz_context *ctx, fz_pixmap *dest)
{
	fz_device *dev = NULL;
	fz_draw_device *ddev = fz_malloc_struct(ctx, fz_draw_device);

	fz_var(dev);
	fz_try(ctx)
	{
		ddev->gel = fz_new_gel(ctx);
		ddev->flags = 0;
		ddev->ctx = ctx;
		ddev->top = 0;
		ddev->stack = &ddev->init_stack[0];
		ddev->stack_max = STACK_SIZE;
		ddev->stack[0].dest = dest;
		ddev->stack[0].shape = NULL;
		ddev->stack[0].mask = NULL;
		ddev->stack[0].blendmode = 0;
		ddev->stack[0].scissor.x0 = dest->x;
		ddev->stack[0].scissor.y0 = dest->y;
		ddev->stack[0].scissor.x1 = dest->x + dest->w;
		ddev->stack[0].scissor.y1 = dest->y + dest->h;

		dev = fz_new_device(ctx, ddev);
	}
	fz_catch(ctx)
	{
		fz_free_gel(ddev->gel);
		fz_free(ctx, ddev);
		fz_rethrow(ctx);
	}
	dev->free_user = fz_draw_free_user;

	dev->fill_path = fz_draw_fill_path;
	dev->stroke_path = fz_draw_stroke_path;
	dev->clip_path = fz_draw_clip_path;
	dev->clip_stroke_path = fz_draw_clip_stroke_path;

	dev->fill_text = fz_draw_fill_text;
	dev->stroke_text = fz_draw_stroke_text;
	dev->clip_text = fz_draw_clip_text;
	dev->clip_stroke_text = fz_draw_clip_stroke_text;
	dev->ignore_text = fz_draw_ignore_text;

	dev->fill_image_mask = fz_draw_fill_image_mask;
	dev->clip_image_mask = fz_draw_clip_image_mask;
	dev->fill_image = fz_draw_fill_image;
	dev->fill_shade = fz_draw_fill_shade;

	dev->pop_clip = fz_draw_pop_clip;

	dev->begin_mask = fz_draw_begin_mask;
	dev->end_mask = fz_draw_end_mask;
	dev->begin_group = fz_draw_begin_group;
	dev->end_group = fz_draw_end_group;

	dev->begin_tile = fz_draw_begin_tile;
	dev->end_tile = fz_draw_end_tile;

	return dev;
}