blob: 0528d9998bfa17229925b699ce46ddeea506d322 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy7e41fe82010-12-04 23:12:08 +00002 Copyright 1999-2011 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;
cristyb28d6472009-10-17 20:13:35 +000045#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
cristy2ed42f62011-10-02 19:49:57 +000046 #pragma omp critical
cristy3ed852e2009-09-05 21:47:34 +000047#endif
cristy3aa93752011-12-18 15:54:24 +000048 status=GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
cristy52010022011-10-21 18:07:37 +000049 pattern->tile_offset.x,y+pattern->tile_offset.y,fill,exception);
cristy2ed42f62011-10-02 19:49:57 +000050 return(status);
51 }
cristy3ed852e2009-09-05 21:47:34 +000052}
53
54static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
cristy101ab702011-10-13 13:06:32 +000055 const ssize_t x,const ssize_t y,PixelInfo *stroke,ExceptionInfo *exception)
cristy3ed852e2009-09-05 21:47:34 +000056{
cristy2ed42f62011-10-02 19:49:57 +000057 if (draw_info->stroke_pattern == (Image *) NULL)
cristy3ed852e2009-09-05 21:47:34 +000058 {
cristy2ed42f62011-10-02 19:49:57 +000059 *stroke=draw_info->stroke;
cristy3ed852e2009-09-05 21:47:34 +000060 return(MagickTrue);
61 }
cristy2ed42f62011-10-02 19:49:57 +000062 {
63 Image
64 *pattern;
65
66 MagickBooleanType
67 status;
68
cristy2ed42f62011-10-02 19:49:57 +000069 pattern=draw_info->stroke_pattern;
cristyb28d6472009-10-17 20:13:35 +000070#if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
cristy3ed852e2009-09-05 21:47:34 +000071 #pragma omp critical
72#endif
cristy3aa93752011-12-18 15:54:24 +000073 status=GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
cristy52010022011-10-21 18:07:37 +000074 pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,exception);
cristy2ed42f62011-10-02 19:49:57 +000075 return(status);
76 }
cristy3ed852e2009-09-05 21:47:34 +000077}
78
79#if defined(__cplusplus) || defined(c_plusplus)
80}
81#endif
82
83#endif