MagickCore  7.0.8
Convert, Edit, Or Compose Bitmap Images
draw-private.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2018 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  https://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 #include "MagickCore/cache.h"
22 #include "MagickCore/image.h"
23 #include "MagickCore/memory_.h"
24 
25 #if defined(__cplusplus) || defined(c_plusplus)
26 extern "C" {
27 #endif
28 
29 static inline void GetFillColor(const DrawInfo *draw_info,const ssize_t x,
30  const ssize_t y,PixelInfo *fill,ExceptionInfo *exception)
31 {
32  if (draw_info->fill_pattern == (Image *) NULL)
33  {
34  *fill=draw_info->fill;
35  return;
36  }
37  {
38  Image
39  *pattern;
40 
41  pattern=draw_info->fill_pattern;
43  pattern->tile_offset.x,y+pattern->tile_offset.y,fill,exception);
44  if (fabs(draw_info->fill_alpha-TransparentAlpha) >= MagickEpsilon)
45  fill->alpha*=QuantumScale*draw_info->fill_alpha;
46  }
47 }
48 
49 static inline void GetStrokeColor(const DrawInfo *draw_info,const ssize_t x,
50  const ssize_t y,PixelInfo *stroke,ExceptionInfo *exception)
51 {
52  if (draw_info->stroke_pattern == (Image *) NULL)
53  {
54  *stroke=draw_info->stroke;
55  return;
56  }
57  {
58  Image
59  *pattern;
60 
61  pattern=draw_info->stroke_pattern;
63  pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,exception);
64  if (fabs(draw_info->stroke_alpha-TransparentAlpha) >= MagickEpsilon)
65  stroke->alpha*=QuantumScale*draw_info->stroke_alpha;
66  }
67 }
68 
69 #if defined(__cplusplus) || defined(c_plusplus)
70 }
71 #endif
72 
73 #endif
PixelInfo fill
Definition: draw.h:214
#define TransparentAlpha
Definition: image.h:26
PixelInfo stroke
Definition: draw.h:214
static void GetFillColor(const DrawInfo *draw_info, const ssize_t x, const ssize_t y, PixelInfo *fill, ExceptionInfo *exception)
Definition: draw-private.h:29
Image * fill_pattern
Definition: draw.h:220
double fill_alpha
Definition: draw.h:326
MagickRealType alpha
Definition: pixel.h:191
#define MagickEpsilon
Definition: magick-type.h:110
RectangleInfo tile_offset
Definition: image.h:261
Definition: image.h:151
Image * stroke_pattern
Definition: draw.h:220
static void GetStrokeColor(const DrawInfo *draw_info, const ssize_t x, const ssize_t y, PixelInfo *stroke, ExceptionInfo *exception)
Definition: draw-private.h:49
MagickExport MagickBooleanType GetOneVirtualPixelInfo(const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, PixelInfo *pixel, ExceptionInfo *exception)
Definition: cache.c:2098
#define QuantumScale
Definition: magick-type.h:113
ssize_t x
Definition: geometry.h:134
double stroke_alpha
Definition: draw.h:326
ssize_t y
Definition: geometry.h:134