never executed always true always false
    1 {-# language CPP #-}
    2 
    3 #ifndef ENABLE_INTERNAL_DOCUMENTATION
    4 {-# OPTIONS_HADDOCK hide #-}
    5 #endif
    6 
    7 module OpenCV.Internal.ImgProc.Types where
    8 
    9 import "base" Data.Int ( Int32 )
   10 import "base" Foreign.C.Types ( CDouble )
   11 import "linear" Linear.V4 ( V4(..) )
   12 import "linear" Linear.Vector ( zero )
   13 import "this" OpenCV.Core.Types ( Scalar, toScalar )
   14 import "this" OpenCV.ImgProc.Types
   15 
   16 --------------------------------------------------------------------------------
   17 
   18 #include <bindings.dsl.h>
   19 #include "opencv2/core.hpp"
   20 #include "opencv2/imgproc.hpp"
   21 
   22 #include "namespace.hpp"
   23 
   24 #num INTER_NEAREST
   25 #num INTER_LINEAR
   26 #num INTER_CUBIC
   27 #num INTER_AREA
   28 #num INTER_LANCZOS4
   29 
   30 marshalInterpolationMethod :: InterpolationMethod -> Int32
   31 marshalInterpolationMethod = \case
   32    InterNearest  -> c'INTER_NEAREST
   33    InterLinear   -> c'INTER_LINEAR
   34    InterCubic    -> c'INTER_CUBIC
   35    InterArea     -> c'INTER_AREA
   36    InterLanczos4 -> c'INTER_LANCZOS4
   37 
   38 #num BORDER_CONSTANT
   39 #num BORDER_REPLICATE
   40 #num BORDER_REFLECT
   41 #num BORDER_WRAP
   42 #num BORDER_REFLECT_101
   43 #num BORDER_TRANSPARENT
   44 #num BORDER_ISOLATED 
   45 
   46 marshalBorderMode :: BorderMode -> (Int32, Scalar)
   47 marshalBorderMode = \case
   48     BorderConstant s  -> (c'BORDER_CONSTANT    , s         )
   49     BorderReplicate   -> (c'BORDER_REPLICATE   , zeroScalar)
   50     BorderReflect     -> (c'BORDER_REFLECT     , zeroScalar)
   51     BorderWrap        -> (c'BORDER_WRAP        , zeroScalar)
   52     BorderReflect101  -> (c'BORDER_REFLECT_101 , zeroScalar)
   53     BorderTransparent -> (c'BORDER_TRANSPARENT , zeroScalar)
   54     BorderIsolated    -> (c'BORDER_ISOLATED    , zeroScalar)
   55   where
   56     zeroScalar :: Scalar
   57     zeroScalar = toScalar (zero :: V4 CDouble)