{-# LANGUAGE CPP #-}
module Data.Bitmap.Simple
(
module Data.Bitmap.Base
, emptyBitmap
, emptyCloneBitmap
, createSingleChannelBitmap
, withBitmap
, componentMap
, componentMap'
, copySubImage
, copySubImage'
, flipBitmap
, mirrorBitmap
, castBitmap
, combineChannels
, extractChannels
, extractSingleChannel
, bilinearResample
, bilinearResampleChannel
, blendBitmaps
, blendChannels
, powerlawGammaCorrection
, powerlawGammaCorrectionChannel
)
where
import Data.Word
import Foreign
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
import qualified Data.ByteString.Internal as B
import Data.Bitmap.Base
import Data.Bitmap.Internal
import qualified Data.Bitmap.Pure as P
emptyBitmap
:: PixelComponent t
=> Size
-> NChn
-> Bitmap t
emptyBitmap :: Size -> NChn -> Bitmap t
emptyBitmap Size
siz NChn
nchn = Size -> NChn -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Size -> NChn -> Maybe NChn -> Bitmap t
P.emptyBitmap Size
siz NChn
nchn Maybe NChn
forall a. Maybe a
Nothing
createSingleChannelBitmap
:: PixelComponent t
=> Size
-> (Int -> Int -> t)
-> Bitmap t
createSingleChannelBitmap :: Size -> (NChn -> NChn -> t) -> Bitmap t
createSingleChannelBitmap Size
siz NChn -> NChn -> t
fun = Size -> Maybe NChn -> (NChn -> NChn -> t) -> Bitmap t
forall t.
PixelComponent t =>
Size -> Maybe NChn -> (NChn -> NChn -> t) -> Bitmap t
P.createSingleChannelBitmap Size
siz Maybe NChn
forall a. Maybe a
Nothing NChn -> NChn -> t
fun
emptyCloneBitmap
:: PixelComponent t
=> Bitmap t
-> Bitmap t
emptyCloneBitmap :: Bitmap t -> Bitmap t
emptyCloneBitmap Bitmap t
bm = Bitmap t -> Maybe NChn -> Bitmap t
forall t. PixelComponent t => Bitmap t -> Maybe NChn -> Bitmap t
P.emptyCloneBitmap Bitmap t
bm Maybe NChn
forall a. Maybe a
Nothing
componentMap :: PixelComponent s => (s -> s) -> Bitmap s -> Bitmap s
componentMap :: (s -> s) -> Bitmap s -> Bitmap s
componentMap = (s -> s) -> Bitmap s -> Bitmap s
forall s. PixelComponent s => (s -> s) -> Bitmap s -> Bitmap s
P.componentMap
componentMap' :: (PixelComponent s, PixelComponent t) => (s -> t) -> Bitmap s -> Bitmap t
componentMap' :: (s -> t) -> Bitmap s -> Bitmap t
componentMap' s -> t
f Bitmap s
bm = (s -> t) -> Bitmap s -> Maybe NChn -> Bitmap t
forall s t.
(PixelComponent s, PixelComponent t) =>
(s -> t) -> Bitmap s -> Maybe NChn -> Bitmap t
P.componentMap' s -> t
f Bitmap s
bm Maybe NChn
forall a. Maybe a
Nothing
copySubImage
:: PixelComponent t
=> Bitmap t
-> Offset
-> Size
-> Bitmap t
copySubImage :: Bitmap t -> Size -> Size -> Bitmap t
copySubImage = Bitmap t -> Size -> Size -> Bitmap t
forall t. PixelComponent t => Bitmap t -> Size -> Size -> Bitmap t
P.copySubImage
copySubImage'
:: PixelComponent t
=> Bitmap t
-> Offset
-> Size
-> Size
-> Offset
-> Bitmap t
copySubImage' :: Bitmap t -> Size -> Size -> Size -> Size -> Bitmap t
copySubImage' = Bitmap t -> Size -> Size -> Size -> Size -> Bitmap t
forall t.
PixelComponent t =>
Bitmap t -> Size -> Size -> Size -> Size -> Bitmap t
P.copySubImage'
flipBitmap
:: PixelComponent t
=> Bitmap t
-> Bitmap t
flipBitmap :: Bitmap t -> Bitmap t
flipBitmap Bitmap t
bm = Bitmap t -> Maybe NChn -> Bitmap t
forall t. PixelComponent t => Bitmap t -> Maybe NChn -> Bitmap t
P.flipBitmap Bitmap t
bm Maybe NChn
forall a. Maybe a
Nothing
mirrorBitmap
:: PixelComponent t
=> Bitmap t
-> Bitmap t
mirrorBitmap :: Bitmap t -> Bitmap t
mirrorBitmap Bitmap t
bm = Bitmap t -> Maybe NChn -> Bitmap t
forall t. PixelComponent t => Bitmap t -> Maybe NChn -> Bitmap t
P.mirrorBitmap Bitmap t
bm Maybe NChn
forall a. Maybe a
Nothing
castBitmap
:: (PixelComponent s, PixelComponent t)
=> Bitmap s
-> Bitmap t
castBitmap :: Bitmap s -> Bitmap t
castBitmap Bitmap s
bm1 = Bitmap s -> Maybe NChn -> Bitmap t
forall s t.
(PixelComponent s, PixelComponent t) =>
Bitmap s -> Maybe NChn -> Bitmap t
P.castBitmap Bitmap s
bm1 Maybe NChn
forall a. Maybe a
Nothing
extractSingleChannel
:: PixelComponent t
=> Bitmap t
-> Int
-> Bitmap t
Bitmap t
bm1 NChn
j = Bitmap t -> Maybe NChn -> NChn -> Bitmap t
forall t.
PixelComponent t =>
Bitmap t -> Maybe NChn -> NChn -> Bitmap t
P.extractSingleChannel Bitmap t
bm1 Maybe NChn
forall a. Maybe a
Nothing NChn
j
extractChannels :: PixelComponent t => Bitmap t -> [Bitmap t]
Bitmap t
bm = Bitmap t -> Maybe NChn -> [Bitmap t]
forall t. PixelComponent t => Bitmap t -> Maybe NChn -> [Bitmap t]
P.extractChannels Bitmap t
bm Maybe NChn
forall a. Maybe a
Nothing
combineChannels :: PixelComponent t => [Bitmap t] -> Bitmap t
combineChannels :: [Bitmap t] -> Bitmap t
combineChannels [Bitmap t]
bms = [Bitmap t] -> Maybe NChn -> Bitmap t
forall t. PixelComponent t => [Bitmap t] -> Maybe NChn -> Bitmap t
P.combineChannels [Bitmap t]
bms Maybe NChn
forall a. Maybe a
Nothing
bilinearResample
:: PixelComponent t
=> Bitmap t
-> Size
-> Bitmap t
bilinearResample :: Bitmap t -> Size -> Bitmap t
bilinearResample Bitmap t
bm Size
siz = Bitmap t -> Size -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Bitmap t -> Size -> Maybe NChn -> Bitmap t
P.bilinearResample Bitmap t
bm Size
siz Maybe NChn
forall a. Maybe a
Nothing
bilinearResampleChannel
:: PixelComponent t
=> Bitmap t
-> Int
-> Size
-> Bitmap t
bilinearResampleChannel :: Bitmap t -> NChn -> Size -> Bitmap t
bilinearResampleChannel Bitmap t
bm NChn
j Size
siz = Bitmap t -> NChn -> Size -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Bitmap t -> NChn -> Size -> Maybe NChn -> Bitmap t
P.bilinearResampleChannel Bitmap t
bm NChn
j Size
siz Maybe NChn
forall a. Maybe a
Nothing
blendBitmaps
:: PixelComponent t
=> Float
-> Float
-> Bitmap t
-> Bitmap t
-> Bitmap t
blendBitmaps :: Float -> Float -> Bitmap t -> Bitmap t -> Bitmap t
blendBitmaps Float
w1 Float
w2 Bitmap t
bm1 Bitmap t
bm2 = Float -> Float -> Bitmap t -> Bitmap t -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Float -> Float -> Bitmap t -> Bitmap t -> Maybe NChn -> Bitmap t
P.blendBitmaps Float
w1 Float
w2 Bitmap t
bm1 Bitmap t
bm2 Maybe NChn
forall a. Maybe a
Nothing
blendChannels
:: PixelComponent t
=> Float
-> Float
-> Bitmap t
-> Int
-> Bitmap t
-> Int
-> Bitmap t
blendChannels :: Float -> Float -> Bitmap t -> NChn -> Bitmap t -> NChn -> Bitmap t
blendChannels Float
w1 Float
w2 Bitmap t
bm1 NChn
ofs1 Bitmap t
bm2 NChn
ofs2 = Float
-> Float
-> Bitmap t
-> NChn
-> Bitmap t
-> NChn
-> Maybe NChn
-> Bitmap t
forall t.
PixelComponent t =>
Float
-> Float
-> Bitmap t
-> NChn
-> Bitmap t
-> NChn
-> Maybe NChn
-> Bitmap t
P.blendChannels Float
w1 Float
w2 Bitmap t
bm1 NChn
ofs1 Bitmap t
bm2 NChn
ofs2 Maybe NChn
forall a. Maybe a
Nothing
powerlawGammaCorrection
:: PixelComponent t
=> Float
-> Bitmap t
-> Bitmap t
powerlawGammaCorrection :: Float -> Bitmap t -> Bitmap t
powerlawGammaCorrection Float
gamma Bitmap t
bm = Float -> Bitmap t -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Float -> Bitmap t -> Maybe NChn -> Bitmap t
P.powerlawGammaCorrection Float
gamma Bitmap t
bm Maybe NChn
forall a. Maybe a
Nothing
powerlawGammaCorrectionChannel
:: PixelComponent t
=> Float
-> Bitmap t
-> Int
-> Bitmap t
powerlawGammaCorrectionChannel :: Float -> Bitmap t -> NChn -> Bitmap t
powerlawGammaCorrectionChannel Float
gamma Bitmap t
bm NChn
j = Float -> Bitmap t -> NChn -> Maybe NChn -> Bitmap t
forall t.
PixelComponent t =>
Float -> Bitmap t -> NChn -> Maybe NChn -> Bitmap t
P.powerlawGammaCorrectionChannel Float
gamma Bitmap t
bm NChn
j Maybe NChn
forall a. Maybe a
Nothing