never executed always true always false
    1 {-|
    2 Module: Flaw.Graphics.Blend
    3 Description: Abstract blend things.
    4 License: MIT
    5 -}
    6 
    7 module Flaw.Graphics.Blend
    8   ( ColorSource(..)
    9   , AlphaSource(..)
   10   , BlendOperation(..)
   11   , BlendStateInfo(..)
   12   ) where
   13 
   14 import Data.Default
   15 
   16 -- | Color source for blending.
   17 data ColorSource
   18   = ColorSourceZero
   19   | ColorSourceOne
   20   | ColorSourceSrc
   21   | ColorSourceInvSrc
   22   | ColorSourceSrcAlpha
   23   | ColorSourceInvSrcAlpha
   24   | ColorSourceDest
   25   | ColorSourceInvDest
   26   | ColorSourceDestAlpha
   27   | ColorSourceInvDestAlpha
   28   | ColorSourceSecondSrc
   29   | ColorSourceInvSecondSrc
   30   | ColorSourceSecondSrcAlpha
   31   | ColorSourceInvSecondSrcAlpha
   32   deriving (Eq, Show)
   33 
   34 -- | Alpha source for blending.
   35 data AlphaSource
   36   = AlphaSourceZero
   37   | AlphaSourceOne
   38   | AlphaSourceSrc
   39   | AlphaSourceInvSrc
   40   | AlphaSourceDest
   41   | AlphaSourceInvDest
   42   | AlphaSourceSecondSrc
   43   | AlphaSourceInvSecondSrc
   44   deriving (Eq, Show)
   45 
   46 -- | Blend operation.
   47 data BlendOperation
   48   = BlendOperationAdd
   49   | BlendOperationSubtractAB
   50   | BlendOperationSubtractBA
   51   | BlendOperationMin
   52   | BlendOperationMax
   53   deriving (Eq, Show)
   54 
   55 data BlendStateInfo = BlendStateInfo
   56   { blendSourceColor :: ColorSource
   57   , blendDestColor :: ColorSource
   58   , blendColorOperation :: BlendOperation
   59   , blendSourceAlpha :: AlphaSource
   60   , blendDestAlpha :: AlphaSource
   61   , blendAlphaOperation :: BlendOperation
   62   } deriving (Eq, Show)
   63 
   64 instance Default BlendStateInfo where
   65   def = BlendStateInfo
   66     { blendSourceColor = ColorSourceOne
   67     , blendDestColor = ColorSourceZero
   68     , blendColorOperation = BlendOperationAdd
   69     , blendSourceAlpha = AlphaSourceOne
   70     , blendDestAlpha = AlphaSourceZero
   71     , blendAlphaOperation = BlendOperationAdd
   72     }