]> granicus.if.org Git - imagemagick/blob - MagickCore/draw-private.h
(no commit message)
[imagemagick] / MagickCore / draw-private.h
1 /*
2   Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
3   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)
22 extern "C" {
23 #endif
24
25 #include "MagickCore/cache.h"
26 #include "MagickCore/image.h"
27 #include "MagickCore/memory_.h"
28
29 static inline MagickBooleanType GetFillColor(const DrawInfo *draw_info,
30   const ssize_t x,const ssize_t y,PixelPacket *pixel)
31 {
32   Image
33     *pattern;
34
35   MagickBooleanType
36     status;
37
38   pattern=draw_info->fill_pattern;
39   if (pattern == (Image *) NULL)
40     {
41       *pixel=draw_info->fill;
42       return(MagickTrue);
43     }
44 #if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
45   #pragma omp critical
46 #endif
47   status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
48     x+pattern->tile_offset.x,y+pattern->tile_offset.y,pixel,
49     &pattern->exception);
50   if (pattern->matte == MagickFalse)
51     pixel->alpha=OpaqueAlpha;
52   return(status);
53 }
54
55 static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
56   const ssize_t x,const ssize_t y,PixelPacket *pixel)
57 {
58   Image
59     *pattern;
60
61   MagickBooleanType
62     status;
63
64   pattern=draw_info->stroke_pattern;
65   if (pattern == (Image *) NULL)
66     {
67       *pixel=draw_info->stroke;
68       return(MagickTrue);
69     }
70 #if defined(MAGICKCORE_OPENMP_SUPPORT) && (_OPENMP >= 200203)
71   #pragma omp critical
72 #endif
73   status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
74     x+pattern->tile_offset.x,y+pattern->tile_offset.y,pixel,
75     &pattern->exception);
76   if (pattern->matte == MagickFalse)
77     pixel->alpha=OpaqueAlpha;
78   return(status);
79 }
80
81 #if defined(__cplusplus) || defined(c_plusplus)
82 }
83 #endif
84
85 #endif