MagickCore  6.9.11-60
Convert, Edit, Or Compose Bitmap Images
draw-private.h
Go to the documentation of this file.
1 /*
2  Copyright 1999-2021 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. You may
6  obtain a copy of the License at
7 
8  https://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 "magick/cache.h"
22 #include "magick/image.h"
23 #include "magick/memory_.h"
24 
25 #if defined(__cplusplus) || defined(c_plusplus)
26 extern "C" {
27 #endif
28 
29 static inline MagickBooleanType GetFillColor(const DrawInfo *draw_info,
30  const ssize_t x,const ssize_t y,PixelPacket *fill)
31 {
32  Image
33  *pattern;
34 
36  status;
37 
38  pattern=draw_info->fill_pattern;
39  if (pattern == (Image *) NULL)
40  {
41  *fill=draw_info->fill;
42  return(MagickTrue);
43  }
45  x+pattern->tile_offset.x,y+pattern->tile_offset.y,fill,&pattern->exception);
46  if (pattern->matte == MagickFalse)
47  fill->opacity=OpaqueOpacity;
48  if (fabs(draw_info->fill_opacity-TransparentOpacity) >= MagickEpsilon)
51  return(status);
52 }
53 
54 static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
55  const ssize_t x,const ssize_t y,PixelPacket *stroke)
56 {
57  Image
58  *pattern;
59 
61  status;
62 
63  pattern=draw_info->stroke_pattern;
64  if (pattern == (Image *) NULL)
65  {
66  *stroke=draw_info->stroke;
67  return(MagickTrue);
68  }
70  x+pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,
71  &pattern->exception);
72  if (pattern->matte == MagickFalse)
73  stroke->opacity=OpaqueOpacity;
74  if (fabs(draw_info->stroke_opacity-TransparentOpacity) >= MagickEpsilon)
75  stroke->opacity=(Quantum) (QuantumRange-(QuantumRange-stroke->opacity)*
77  return(status);
78 }
79 
80 #if defined(__cplusplus) || defined(c_plusplus)
81 }
82 #endif
83 
84 #endif
QuantumScale
#define QuantumScale
Definition: magick-type.h:124
_RectangleInfo::x
ssize_t x
Definition: geometry.h:130
TransparentOpacity
#define TransparentOpacity
Definition: image.h:28
_Image::matte
MagickBooleanType matte
Definition: image.h:171
OpaqueOpacity
#define OpaqueOpacity
Definition: image.h:27
GetStrokeColor
static MagickBooleanType GetStrokeColor(const DrawInfo *draw_info, const ssize_t x, const ssize_t y, PixelPacket *stroke)
Definition: draw-private.h:54
_DrawInfo::stroke_pattern
Image * stroke_pattern
Definition: draw.h:238
_DrawInfo::fill_opacity
double fill_opacity
Definition: draw.h:340
MagickTrue
@ MagickTrue
Definition: magick-type.h:205
_RectangleInfo::y
ssize_t y
Definition: geometry.h:131
_DrawInfo::stroke
PixelPacket stroke
Definition: draw.h:227
_Image
Definition: image.h:153
_DrawInfo::stroke_opacity
double stroke_opacity
Definition: draw.h:341
_Image::exception
ExceptionInfo exception
Definition: image.h:287
MagickFalse
@ MagickFalse
Definition: magick-type.h:204
image.h
_PixelPacket::opacity
Quantum opacity
Definition: pixel.h:146
QuantumRange
#define QuantumRange
Definition: magick-type.h:90
GetOneVirtualMethodPixel
MagickExport MagickBooleanType GetOneVirtualMethodPixel(const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, PixelPacket *pixel, ExceptionInfo *exception)
Definition: cache.c:2201
cache.h
MagickBooleanType
MagickBooleanType
Definition: magick-type.h:203
GetFillColor
static MagickBooleanType GetFillColor(const DrawInfo *draw_info, const ssize_t x, const ssize_t y, PixelPacket *fill)
Definition: draw-private.h:29
TileVirtualPixelMethod
@ TileVirtualPixelMethod
Definition: cache-view.h:36
memory_.h
_DrawInfo
Definition: draw.h:211
MagickEpsilon
#define MagickEpsilon
Definition: magick-type.h:119
_Image::tile_offset
RectangleInfo tile_offset
Definition: image.h:327
_DrawInfo::fill
PixelPacket fill
Definition: draw.h:226
_PixelPacket
Definition: pixel.h:132
Quantum
unsigned short Quantum
Definition: magick-type.h:89
_DrawInfo::fill_pattern
Image * fill_pattern
Definition: draw.h:236