diff options
author | Henry Stiles <henry.stiles@artifex.com> | 2009-08-10 18:52:21 +0000 |
---|---|---|
committer | Henry Stiles <henry.stiles@artifex.com> | 2009-08-10 18:52:21 +0000 |
commit | ef84623cd429875d8c156c247c3b3351c679c825 (patch) | |
tree | d85b6ff09d93337895cce3e21ec22b54bc3c0655 /gs/base/gdevmem.c | |
parent | 295f40c116dfb12c5cbea66b5a83b823c662b2a5 (diff) |
Add a new memory device constructor which uses copydevice.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@9965 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevmem.c')
-rw-r--r-- | gs/base/gdevmem.c | 29 |
1 files changed, 29 insertions, 0 deletions
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 |