blob: 48b1985898a75756067b9bb28f094f52d0e06b84 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy45ef08f2012-12-07 13:13:34 +00002 Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
7
8 http://www.imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore private image drawing methods.
17*/
18#ifndef _MAGICKCORE_DRAW_PRIVATE_H
19#define _MAGICKCORE_DRAW_PRIVATE_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
cristy4c08aed2011-07-01 19:47:50 +000025#include "MagickCore/cache.h"
26#include "MagickCore/image.h"
27#include "MagickCore/memory_.h"
cristy3ed852e2009-09-05 21:47:34 +000028
29static inline MagickBooleanType GetFillColor(const DrawInfo *draw_info,
cristy101ab702011-10-13 13:06:32 +000030 const ssize_t x,const ssize_t y,PixelInfo *fill,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +000031{
cristy2ed42f62011-10-02 19:49:57 +000032 if (draw_info->fill_pattern == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +000033 {
cristy2ed42f62011-10-02 19:49:57 +000034 *fill=draw_info->fill;
cristy3ed852e2009-09-05 21:47:34 +000035 return(MagickTrue);
36 }
cristy2ed42f62011-10-02 19:49:57 +000037 {
38 Image
39 *pattern;
40
41 MagickBooleanType
42 status;
43
cristy2ed42f62011-10-02 19:49:57 +000044 pattern=draw_info->fill_pattern;
cristy3aa93752011-12-18 15:54:24 +000045 status=GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
cristy52010022011-10-21 18:07:37 +000046 pattern->tile_offset.x,y+pattern->tile_offset.y,fill,exception);
cristy2ed42f62011-10-02 19:49:57 +000047 return(status);
48 }
cristy3ed852e2009-09-05 21:47:34 +000049}
50
51static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
cristy101ab702011-10-13 13:06:32 +000052 const ssize_t x,const ssize_t y,PixelInfo *stroke,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +000053{
cristy2ed42f62011-10-02 19:49:57 +000054 if (draw_info->stroke_pattern == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +000055 {
cristy2ed42f62011-10-02 19:49:57 +000056 *stroke=draw_info->stroke;
cristy3ed852e2009-09-05 21:47:34 +000057 return(MagickTrue);
58 }
cristy2ed42f62011-10-02 19:49:57 +000059 {
60 Image
61 *pattern;
62
63 MagickBooleanType
64 status;
65
cristy2ed42f62011-10-02 19:49:57 +000066 pattern=draw_info->stroke_pattern;
cristy3aa93752011-12-18 15:54:24 +000067 status=GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
cristy52010022011-10-21 18:07:37 +000068 pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,exception);
cristy2ed42f62011-10-02 19:49:57 +000069 return(status);
70 }
cristy3ed852e2009-09-05 21:47:34 +000071}
72
73#if defined(__cplusplus) || defined(c_plusplus)
74}
75#endif
76
77#endif