draw-private.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization
00003   dedicated to making software imaging solutions freely available.
00004   
00005   You may not use this file except in compliance with the License.  You may
00006   obtain a copy of the License at
00007   
00008     https://imagemagick.org/script/license.php
00009   
00010   Unless required by applicable law or agreed to in writing, software
00011   distributed under the License is distributed on an "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013   See the License for the specific language governing permissions and
00014   limitations under the License.
00015 
00016   MagickCore private image drawing methods.
00017 */
00018 #ifndef MAGICKCORE_DRAW_PRIVATE_H
00019 #define MAGICKCORE_DRAW_PRIVATE_H
00020 
00021 #include "magick/cache.h"
00022 #include "magick/image.h"
00023 #include "magick/memory_.h"
00024 
00025 #if defined(__cplusplus) || defined(c_plusplus)
00026 extern "C" {
00027 #endif
00028 
00029 static inline MagickBooleanType GetFillColor(const DrawInfo *draw_info,
00030   const ssize_t x,const ssize_t y,PixelPacket *fill)
00031 {
00032   Image
00033     *pattern;
00034 
00035   MagickBooleanType
00036     status;
00037 
00038   pattern=draw_info->fill_pattern;
00039   if (pattern == (Image *) NULL)
00040     {
00041       *fill=draw_info->fill;
00042       return(MagickTrue);
00043     }
00044   status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
00045     x+pattern->tile_offset.x,y+pattern->tile_offset.y,fill,&pattern->exception);
00046   if (pattern->matte == MagickFalse)
00047     fill->opacity=OpaqueOpacity;
00048   if (fabs(draw_info->fill_opacity-TransparentOpacity) >= MagickEpsilon)
00049     fill->opacity=(Quantum) (QuantumRange-(QuantumRange-fill->opacity)*
00050       QuantumScale*(QuantumRange-draw_info->fill_opacity));
00051   return(status);
00052 }
00053 
00054 static inline MagickBooleanType GetStrokeColor(const DrawInfo *draw_info,
00055   const ssize_t x,const ssize_t y,PixelPacket *stroke)
00056 {
00057   Image
00058     *pattern;
00059 
00060   MagickBooleanType
00061     status;
00062 
00063   pattern=draw_info->stroke_pattern;
00064   if (pattern == (Image *) NULL)
00065     {
00066       *stroke=draw_info->stroke;
00067       return(MagickTrue);
00068     }
00069   status=GetOneVirtualMethodPixel(pattern,TileVirtualPixelMethod,
00070     x+pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,
00071     &pattern->exception);
00072   if (pattern->matte == MagickFalse)
00073     stroke->opacity=OpaqueOpacity;
00074   if (fabs(draw_info->stroke_opacity-TransparentOpacity) >= MagickEpsilon)
00075     stroke->opacity=(Quantum) (QuantumRange-(QuantumRange-stroke->opacity)*
00076       QuantumScale*(QuantumRange-draw_info->stroke_opacity));
00077   return(status);
00078 }
00079 
00080 #if defined(__cplusplus) || defined(c_plusplus)
00081 }
00082 #endif
00083 
00084 #endif

Generated on 31 Dec 2019 for MagickCore by  doxygen 1.6.1