never executed always true always false
1 {-# language ConstraintKinds #-}
2 {-# language MultiParamTypeClasses #-}
3 {-# language TemplateHaskell #-}
4
5 {-# OPTIONS_GHC -fno-warn-orphans #-}
6
7 module OpenCV.Core.Types.Rect
8 ( Rect
9 , HRect(..)
10
11 , RectPoint
12 , RectSize
13 , IsRect(..)
14
15 , Rect2i
16 , Rect2f
17 , Rect2d
18
19 , fmapRect
20 ) where
21
22 import "base" Data.Int ( Int32 )
23 import "base" Foreign.C.Types
24 import qualified "inline-c" Language.C.Inline as C
25 import qualified "inline-c-cpp" Language.C.Inline.Cpp as C ( using )
26 import "this" OpenCV.Internal.C.Inline ( openCvCtx )
27 import "this" OpenCV.Internal.C.Types
28 import "this" OpenCV.Internal.Core.Types.Rect
29 import "this" OpenCV.Internal.Core.Types.Rect.TH
30
31 --------------------------------------------------------------------------------
32
33 C.context openCvCtx
34 C.include "opencv2/core.hpp"
35 C.using "namespace cv"
36
37 mkRectType "Rect2i" ''Int32 "int32_t" "Point2i" "Size2i"
38 mkRectType "Rect2f" ''CFloat "float" "Point2f" "Size2f"
39 mkRectType "Rect2d" ''CDouble "double" "Point2d" "Size2d"
40
41 fmapRect :: forall a b. (IsRect Rect a, IsRect HRect a, IsRect Rect b, IsRect HRect b)
42 => (a -> b) -> Rect a -> Rect b
43 fmapRect f r = toRect hrB
44 where
45 hrA :: HRect a
46 hrA = fromRect r
47
48 hrB :: HRect b
49 hrB = fmap f hrA