From ef84623cd429875d8c156c247c3b3351c679c825 Mon Sep 17 00:00:00 2001 From: Henry Stiles Date: Mon, 10 Aug 2009 18:52:21 +0000 Subject: Add a new memory device constructor which uses copydevice. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9965 a1074d23-0009-0410-80fe-cf8c14f379e6 --- gs/base/gdevmem.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'gs/base/gdevmem.c') diff --git a/gs/base/gdevmem.c b/gs/base/gdevmem.c index caf92802a..34caa98d3 100644 --- a/gs/base/gdevmem.c +++ b/gs/base/gdevmem.c @@ -14,6 +14,7 @@ /* Generic "memory" (stored bitmap) device */ #include "memory_.h" #include "gx.h" +#include "gsdevice.h" #include "gserrors.h" #include "gsrect.h" #include "gsstruct.h" @@ -178,6 +179,34 @@ gs_make_mem_device(gx_device_memory * dev, const gx_device_memory * mdproto, gx_device_fill_in_procs((gx_device *)dev); dev->band_y = 0; } + +/* Make a monobit memory device using copydevice */ +int +gs_make_mem_mono_device_with_copydevice(gx_device_memory ** ppdev, gs_memory_t * mem, + gx_device * target) +{ + int code; + gx_device_memory *pdev; + + if (mem == 0) + return -1; + + code = gs_copydevice((gx_device **)&pdev, + (const gx_device *)&mem_mono_device, + mem); + if (code < 0) + return code; + + set_dev_proc(pdev, get_page_device, gx_default_get_page_device); + gx_device_set_target((gx_device_forward *)pdev, target); + gdev_mem_mono_set_inverted(pdev, true); + check_device_separable((gx_device *)pdev); + gx_device_fill_in_procs((gx_device *)pdev); + *ppdev = pdev; + return 0; +} + + /* Make a monobit memory device. This is never a page device. */ /* Note that white=0, black=1. */ void -- cgit v1.2.3