-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Vips.Functions
    ( 

 -- * Methods


-- ** addOptionEntries #method:addOptionEntries#

    addOptionEntries                        ,


-- ** blockUntrustedSet #method:blockUntrustedSet#

    blockUntrustedSet                       ,


-- ** cacheDropAll #method:cacheDropAll#

    cacheDropAll                            ,


-- ** cacheGetMax #method:cacheGetMax#

    cacheGetMax                             ,


-- ** cacheGetMaxFiles #method:cacheGetMaxFiles#

    cacheGetMaxFiles                        ,


-- ** cacheGetMaxMem #method:cacheGetMaxMem#

    cacheGetMaxMem                          ,


-- ** cacheGetSize #method:cacheGetSize#

    cacheGetSize                            ,


-- ** cacheOperationAdd #method:cacheOperationAdd#

    cacheOperationAdd                       ,


-- ** cacheOperationBuild #method:cacheOperationBuild#

    cacheOperationBuild                     ,


-- ** cacheOperationLookup #method:cacheOperationLookup#

    cacheOperationLookup                    ,


-- ** cachePrint #method:cachePrint#

    cachePrint                              ,


-- ** cacheSetDump #method:cacheSetDump#

    cacheSetDump                            ,


-- ** cacheSetMax #method:cacheSetMax#

    cacheSetMax                             ,


-- ** cacheSetMaxFiles #method:cacheSetMaxFiles#

    cacheSetMaxFiles                        ,


-- ** cacheSetMaxMem #method:cacheSetMaxMem#

    cacheSetMaxMem                          ,


-- ** cacheSetTrace #method:cacheSetTrace#

    cacheSetTrace                           ,


-- ** callArgv #method:callArgv#

    callArgv                                ,


-- ** callOptions #method:callOptions#

    callOptions                             ,


-- ** check8or16 #method:check8or16#

    check8or16                              ,


-- ** checkBandno #method:checkBandno#

    checkBandno                             ,


-- ** checkBands #method:checkBands#

    checkBands                              ,


-- ** checkBands1or3 #method:checkBands1or3#

    checkBands1or3                          ,


-- ** checkBands1orn #method:checkBands1orn#

    checkBands1orn                          ,


-- ** checkBands1ornUnary #method:checkBands1ornUnary#

    checkBands1ornUnary                     ,


-- ** checkBandsAtleast #method:checkBandsAtleast#

    checkBandsAtleast                       ,


-- ** checkBandsSame #method:checkBandsSame#

    checkBandsSame                          ,


-- ** checkCoding #method:checkCoding#

    checkCoding                             ,


-- ** checkCodingKnown #method:checkCodingKnown#

    checkCodingKnown                        ,


-- ** checkCodingNoneorlabq #method:checkCodingNoneorlabq#

    checkCodingNoneorlabq                   ,


-- ** checkCodingSame #method:checkCodingSame#

    checkCodingSame                         ,


-- ** checkComplex #method:checkComplex#

    checkComplex                            ,


-- ** checkFormat #method:checkFormat#

    checkFormat                             ,


-- ** checkFormatSame #method:checkFormatSame#

    checkFormatSame                         ,


-- ** checkHist #method:checkHist#

    checkHist                               ,


-- ** checkInt #method:checkInt#

    checkInt                                ,


-- ** checkMatrix #method:checkMatrix#

    checkMatrix                             ,


-- ** checkMono #method:checkMono#

    checkMono                               ,


-- ** checkNoncomplex #method:checkNoncomplex#

    checkNoncomplex                         ,


-- ** checkOddsquare #method:checkOddsquare#

    checkOddsquare                          ,


-- ** checkPrecisionIntfloat #method:checkPrecisionIntfloat#

    checkPrecisionIntfloat                  ,


-- ** checkSeparable #method:checkSeparable#

    checkSeparable                          ,


-- ** checkSizeSame #method:checkSizeSame#

    checkSizeSame                           ,


-- ** checkTwocomponents #method:checkTwocomponents#

    checkTwocomponents                      ,


-- ** checkU8or16 #method:checkU8or16#

    checkU8or16                             ,


-- ** checkU8or16orf #method:checkU8or16orf#

    checkU8or16orf                          ,


-- ** checkUint #method:checkUint#

    checkUint                               ,


-- ** checkUintorf #method:checkUintorf#

    checkUintorf                            ,


-- ** checkUncoded #method:checkUncoded#

    checkUncoded                            ,


-- ** checkVector #method:checkVector#

    checkVector                             ,


-- ** checkVectorLength #method:checkVectorLength#

    checkVectorLength                       ,


-- ** classFind #method:classFind#

    classFind                               ,


-- ** colAb2Ch #method:colAb2Ch#

    colAb2Ch                                ,


-- ** colAb2h #method:colAb2h#

    colAb2h                                 ,


-- ** colC2Ccmc #method:colC2Ccmc#

    colC2Ccmc                               ,


-- ** colCcmc2C #method:colCcmc2C#

    colCcmc2C                               ,


-- ** colCh2ab #method:colCh2ab#

    colCh2ab                                ,


-- ** colCh2hcmc #method:colCh2hcmc#

    colCh2hcmc                              ,


-- ** colChcmc2h #method:colChcmc2h#

    colChcmc2h                              ,


-- ** colDE00 #method:colDE00#

    colDE00                                 ,


-- ** colL2Lcmc #method:colL2Lcmc#

    colL2Lcmc                               ,


-- ** colLab2XYZ #method:colLab2XYZ#

    colLab2XYZ                              ,


-- ** colLcmc2L #method:colLcmc2L#

    colLcmc2L                               ,


-- ** colMakeTablesCMC #method:colMakeTablesCMC#

    colMakeTablesCMC                        ,


-- ** colSRGB2scRGB16 #method:colSRGB2scRGB16#

    colSRGB2scRGB16                         ,


-- ** colSRGB2scRGB8 #method:colSRGB2scRGB8#

    colSRGB2scRGB8                          ,


-- ** colScRGB2BW16 #method:colScRGB2BW16#

    colScRGB2BW16                           ,


-- ** colScRGB2BW8 #method:colScRGB2BW8#

    colScRGB2BW8                            ,


-- ** colScRGB2XYZ #method:colScRGB2XYZ#

    colScRGB2XYZ                            ,


-- ** colScRGB2sRGB16 #method:colScRGB2sRGB16#

    colScRGB2sRGB16                         ,


-- ** colScRGB2sRGB8 #method:colScRGB2sRGB8#

    colScRGB2sRGB8                          ,


-- ** colXYZ2Lab #method:colXYZ2Lab#

    colXYZ2Lab                              ,


-- ** colXYZ2scRGB #method:colXYZ2scRGB#

    colXYZ2scRGB                            ,


-- ** concurrencyGet #method:concurrencyGet#

    concurrencyGet                          ,


-- ** concurrencySet #method:concurrencySet#

    concurrencySet                          ,


-- ** errorBuffer #method:errorBuffer#

    errorBuffer                             ,


-- ** errorBufferCopy #method:errorBufferCopy#

    errorBufferCopy                         ,


-- ** errorClear #method:errorClear#

    errorClear                              ,


-- ** errorFreeze #method:errorFreeze#

    errorFreeze                             ,


-- ** errorG #method:errorG#

    errorG                                  ,


-- ** errorThaw #method:errorThaw#

    errorThaw                               ,


-- ** filenameGetFilename #method:filenameGetFilename#

    filenameGetFilename                     ,


-- ** filenameGetOptions #method:filenameGetOptions#

    filenameGetOptions                      ,


-- ** foreignFlags #method:foreignFlags#

    foreignFlags                            ,


-- ** formatSizeof #method:formatSizeof#

    formatSizeof                            ,


-- ** gError #method:gError#

    gError                                  ,


-- ** getArgv0 #method:getArgv0#

    getArgv0                                ,


-- ** getDiscThreshold #method:getDiscThreshold#

    getDiscThreshold                        ,


-- ** getPrgname #method:getPrgname#

    getPrgname                              ,


-- ** guessLibdir #method:guessLibdir#

    guessLibdir                             ,


-- ** guessPrefix #method:guessPrefix#

    guessPrefix                             ,


-- ** iccIsCompatibleProfile #method:iccIsCompatibleProfile#

    iccIsCompatibleProfile                  ,


-- ** iccPresent #method:iccPresent#

    iccPresent                              ,


-- ** init #method:init#

    init                                    ,


-- ** leakSet #method:leakSet#

    leakSet                                 ,


-- ** malloc #method:malloc#

    malloc                                  ,


-- ** nicknameFind #method:nicknameFind#

    nicknameFind                            ,


-- ** objectSetMember_ #method:objectSetMember_#

    objectSetMember_                        ,


-- ** pathFilename7 #method:pathFilename7#

    pathFilename7                           ,


-- ** pathMode7 #method:pathMode7#

    pathMode7                               ,


-- ** pythagoras #method:pythagoras#

    pythagoras                              ,


-- ** shutdown #method:shutdown#

    shutdown                                ,


-- ** strdup #method:strdup#

    strdup                                  ,


-- ** threadShutdown #method:threadShutdown#

    threadShutdown                          ,


-- ** trackedClose #method:trackedClose#

    trackedClose                            ,


-- ** trackedFree #method:trackedFree#

    trackedFree                             ,


-- ** trackedGetAllocs #method:trackedGetAllocs#

    trackedGetAllocs                        ,


-- ** trackedGetFiles #method:trackedGetFiles#

    trackedGetFiles                         ,


-- ** trackedGetMem #method:trackedGetMem#

    trackedGetMem                           ,


-- ** trackedGetMemHighwater #method:trackedGetMemHighwater#

    trackedGetMemHighwater                  ,


-- ** trackedMalloc #method:trackedMalloc#

    trackedMalloc                           ,


-- ** trackedOpen #method:trackedOpen#

    trackedOpen                             ,


-- ** typeDepth #method:typeDepth#

    typeDepth                               ,


-- ** typeFind #method:typeFind#

    typeFind                                ,


-- ** valueGetArea #method:valueGetArea#

    valueGetArea                            ,


-- ** valueGetArray #method:valueGetArray#

    valueGetArray                           ,


-- ** valueGetArrayDouble #method:valueGetArrayDouble#

    valueGetArrayDouble                     ,


-- ** valueGetArrayImage #method:valueGetArrayImage#

    valueGetArrayImage                      ,


-- ** valueGetArrayInt #method:valueGetArrayInt#

    valueGetArrayInt                        ,


-- ** valueGetBlob #method:valueGetBlob#

    valueGetBlob                            ,


-- ** valueGetRefString #method:valueGetRefString#

    valueGetRefString                       ,


-- ** valueGetSaveString #method:valueGetSaveString#

    valueGetSaveString                      ,


-- ** valueIsNull #method:valueIsNull#

    valueIsNull                             ,


-- ** valueSetArea #method:valueSetArea#

    valueSetArea                            ,


-- ** valueSetArray #method:valueSetArray#

    valueSetArray                           ,


-- ** valueSetArrayDouble #method:valueSetArrayDouble#

    valueSetArrayDouble                     ,


-- ** valueSetArrayImage #method:valueSetArrayImage#

    valueSetArrayImage                      ,


-- ** valueSetArrayInt #method:valueSetArrayInt#

    valueSetArrayInt                        ,


-- ** valueSetArrayObject #method:valueSetArrayObject#

    valueSetArrayObject                     ,


-- ** valueSetBlob #method:valueSetBlob#

    valueSetBlob                            ,


-- ** valueSetBlobFree #method:valueSetBlobFree#

    valueSetBlobFree                        ,


-- ** valueSetRefString #method:valueSetRefString#

    valueSetRefString                       ,


-- ** valueSetSaveString #method:valueSetSaveString#

    valueSetSaveString                      ,


-- ** version #method:version#

    version                                 ,


-- ** versionString #method:versionString#

    versionString                           ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R

import qualified GI.GLib.Structs.OptionGroup as GLib.OptionGroup
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Vips.Callbacks as Vips.Callbacks
import {-# SOURCE #-} qualified GI.Vips.Enums as Vips.Enums
import {-# SOURCE #-} qualified GI.Vips.Flags as Vips.Flags
import {-# SOURCE #-} qualified GI.Vips.Objects.Image as Vips.Image
import {-# SOURCE #-} qualified GI.Vips.Objects.Object as Vips.Object
import {-# SOURCE #-} qualified GI.Vips.Objects.Operation as Vips.Operation
import {-# SOURCE #-} qualified GI.Vips.Structs.ObjectClass as Vips.ObjectClass

-- function version_string
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_version_string" vips_version_string :: 
    IO CString

-- | Get the VIPS version as a static string, including a build date and time.
-- Do not free.
versionString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a static version string
versionString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
versionString  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vips_version_string
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"versionString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function version
-- Args: [ Arg
--           { argCName = "flag"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "which field of the version to get"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_version" vips_version :: 
    Int32 ->                                -- flag : TBasicType TInt
    IO Int32

-- | Get the major, minor or micro library version, with /@flag@/ values 0, 1 and
-- 2.
-- 
-- Get the ABI current, revision and age (as used by libtool) with /@flag@/
-- values 3, 4, 5.
version ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@flag@/: which field of the version to get
    -> m Int32
    -- ^ __Returns:__ library version number
version :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m Int32
version Int32
flag = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- Int32 -> IO Int32
vips_version Int32
flag
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function value_set_save_string
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "C string to copy into the GValue"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_save_string" vips_value_set_save_string :: 
    Ptr GValue ->                           -- value : TGValue
    CString ->                              -- str : TBasicType TUTF8
    IO ()

-- | Copies the C string into /@value@/.
-- 
-- /@str@/ should be a valid utf-8 string.
valueSetSaveString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: C string to copy into the GValue
    -> m (GValue)
valueSetSaveString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m GValue
valueSetSaveString Text
str = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr GValue -> CString -> IO ()
vips_value_set_save_string Ptr GValue
value CString
str'
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'


-- function value_set_ref_string
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "C string to copy into the GValue"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_ref_string" vips_value_set_ref_string :: 
    Ptr GValue ->                           -- value : TGValue
    CString ->                              -- str : TBasicType TUTF8
    IO ()

-- | Copies the C string /@str@/ into /@value@/.
-- 
-- vips_ref_string are immutable C strings that are copied between images by
-- copying reference-counted pointers, making them much more efficient than
-- regular @/GValue/@ strings.
-- 
-- /@str@/ should be a valid utf-8 string.
valueSetRefString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: C string to copy into the GValue
    -> m (GValue)
valueSetRefString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m GValue
valueSetRefString Text
str = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr GValue -> CString -> IO ()
vips_value_set_ref_string Ptr GValue
value CString
str'
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'


-- function value_set_blob_free
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "pointer to area of memory"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of memory area"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_blob_free" vips_value_set_blob_free :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr () ->                               -- data : TBasicType TPtr
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

-- | Just like 'GI.Vips.Functions.valueSetBlob', but when
-- /@value@/ is freed, /@data@/ will be
-- freed with 'GI.GLib.Functions.free'.
-- 
-- This can be easier to call for language bindings.
-- 
-- See also: 'GI.Vips.Functions.valueSetBlob'
valueSetBlobFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: GValue to set
    -> Ptr ()
    -- ^ /@data@/: pointer to area of memory
    -> Word64
    -- ^ /@length@/: length of memory area
    -> m ()
valueSetBlobFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> Ptr () -> Word64 -> m ()
valueSetBlobFree GValue
value Ptr ()
data_ Word64
length_ = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr GValue -> Ptr () -> Word64 -> IO ()
vips_value_set_blob_free Ptr GValue
value' Ptr ()
data_ Word64
length_
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function value_set_blob
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "free_fn"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "CallbackFn" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "free function for @data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "pointer to area of memory"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of memory area"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_blob" vips_value_set_blob :: 
    Ptr GValue ->                           -- value : TGValue
    FunPtr Vips.Callbacks.C_CallbackFn ->   -- free_fn : TInterface (Name {namespace = "Vips", name = "CallbackFn"})
    Ptr () ->                               -- data : TBasicType TPtr
    Word64 ->                               -- length : TBasicType TUInt64
    IO ()

-- | Sets /@value@/ to hold a /@data@/. When /@value@/ is freed, /@data@/ will be
-- freed with /@freeFn@/. /@value@/ also holds a note of the size of the memory
-- area.
-- 
-- blobs are things like ICC profiles or EXIF data. They are relocatable, and
-- are saved to VIPS files for you coded as base64 inside the XML. They are
-- copied by copying reference-counted pointers.
-- 
-- See also: 'GI.Vips.Functions.valueGetBlob'
valueSetBlob ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Vips.Callbacks.CallbackFn
    -- ^ /@freeFn@/: free function for /@data@/
    -> Word64
    -- ^ /@length@/: length of memory area
    -> m (GValue)
valueSetBlob :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
CallbackFn -> Word64 -> m GValue
valueSetBlob CallbackFn
freeFn Word64
length_ = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    Ptr (FunPtr CallbackFn)
ptrfreeFn <- IO (Ptr (FunPtr CallbackFn))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Vips.Callbacks.C_CallbackFn))
    FunPtr CallbackFn
freeFn' <- CallbackFn -> IO (FunPtr CallbackFn)
Vips.Callbacks.mk_CallbackFn (Maybe (Ptr (FunPtr CallbackFn)) -> CallbackFn -> CallbackFn
Vips.Callbacks.wrap_CallbackFn (Ptr (FunPtr CallbackFn) -> Maybe (Ptr (FunPtr CallbackFn))
forall a. a -> Maybe a
Just Ptr (FunPtr CallbackFn)
ptrfreeFn) CallbackFn
freeFn)
    Ptr (FunPtr CallbackFn) -> FunPtr CallbackFn -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr CallbackFn)
ptrfreeFn FunPtr CallbackFn
freeFn'
    let data_ :: Ptr a
data_ = Ptr a
forall a. Ptr a
nullPtr
    Ptr GValue -> FunPtr CallbackFn -> Ptr () -> Word64 -> IO ()
vips_value_set_blob Ptr GValue
value FunPtr CallbackFn
freeFn' Ptr ()
forall a. Ptr a
data_ Word64
length_
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
    GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'


-- function value_set_array_object
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of elements"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_array_object" vips_value_set_array_object :: 
    Ptr GValue ->                           -- value : TGValue
    Int32 ->                                -- n : TBasicType TInt
    IO ()

-- | Set /@value@/ to hold an array of @/GObject/@. Pass in the array length in /@n@/.
-- 
-- See also: @/vips_value_get_array_object()/@.
valueSetArrayObject ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@n@/: the number of elements
    -> m (GValue)
valueSetArrayObject :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m GValue
valueSetArrayObject Int32
n = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    Ptr GValue -> Int32 -> IO ()
vips_value_set_array_object Ptr GValue
value Int32
n
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
    GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'


-- function value_set_array_int
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "array"
--           , argType = TCArray False (-1) 2 (TBasicType TInt)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "array of ints" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of elements"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of elements"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_array_int" vips_value_set_array_int :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Int32 ->                            -- array : TCArray False (-1) 2 (TBasicType TInt)
    Int32 ->                                -- n : TBasicType TInt
    IO ()

-- | Set /@value@/ to hold a copy of /@array@/. Pass in the array length in /@n@/.
-- 
-- See also: 'GI.Vips.Structs.ArrayInt.arrayIntGet'.
valueSetArrayInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> Maybe ([Int32])
    -- ^ /@array@/: array of ints
    -> m ()
valueSetArrayInt :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> Maybe [Int32] -> m ()
valueSetArrayInt GValue
value Maybe [Int32]
array = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let n :: Int32
n = case Maybe [Int32]
array of
            Maybe [Int32]
Nothing -> Int32
0
            Just [Int32]
jArray -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Int32] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Int32]
jArray
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Int32
maybeArray <- case Maybe [Int32]
array of
        Maybe [Int32]
Nothing -> Ptr Int32 -> IO (Ptr Int32)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Int32
forall a. Ptr a
nullPtr
        Just [Int32]
jArray -> do
            Ptr Int32
jArray' <- [Int32] -> IO (Ptr Int32)
forall a. Storable a => [a] -> IO (Ptr a)
packStorableArray [Int32]
jArray
            Ptr Int32 -> IO (Ptr Int32)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Int32
jArray'
    Ptr GValue -> Ptr Int32 -> Int32 -> IO ()
vips_value_set_array_int Ptr GValue
value' Ptr Int32
maybeArray Int32
n
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
maybeArray
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function value_set_array_image
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of elements"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_array_image" vips_value_set_array_image :: 
    Ptr GValue ->                           -- value : TGValue
    Int32 ->                                -- n : TBasicType TInt
    IO ()

-- | Set /@value@/ to hold an array of images. Pass in the array length in /@n@/.
-- 
-- See also: 'GI.Vips.Structs.ArrayImage.arrayImageGet'.
valueSetArrayImage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> Int32
    -- ^ /@n@/: the number of elements
    -> m ()
valueSetArrayImage :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> Int32 -> m ()
valueSetArrayImage GValue
value Int32
n = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr GValue -> Int32 -> IO ()
vips_value_set_array_image Ptr GValue
value' Int32
n
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function value_set_array_double
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "array"
--           , argType = TCArray False (-1) 2 (TBasicType TDouble)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "array of doubles" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of elements"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "the number of elements"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_array_double" vips_value_set_array_double :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr CDouble ->                          -- array : TCArray False (-1) 2 (TBasicType TDouble)
    Int32 ->                                -- n : TBasicType TInt
    IO ()

-- | Set /@value@/ to hold a copy of /@array@/. Pass in the array length in /@n@/.
-- 
-- See also: 'GI.Vips.Structs.ArrayDouble.arrayDoubleGet'.
valueSetArrayDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> Maybe ([Double])
    -- ^ /@array@/: array of doubles
    -> m ()
valueSetArrayDouble :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> Maybe [Double] -> m ()
valueSetArrayDouble GValue
value Maybe [Double]
array = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let n :: Int32
n = case Maybe [Double]
array of
            Maybe [Double]
Nothing -> Int32
0
            Just [Double]
jArray -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Double] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Double]
jArray
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr CDouble
maybeArray <- case Maybe [Double]
array of
        Maybe [Double]
Nothing -> Ptr CDouble -> IO (Ptr CDouble)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CDouble
forall a. Ptr a
nullPtr
        Just [Double]
jArray -> do
            Ptr CDouble
jArray' <- ((Double -> CDouble) -> [Double] -> IO (Ptr CDouble)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Double]
jArray
            Ptr CDouble -> IO (Ptr CDouble)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CDouble
jArray'
    Ptr GValue -> Ptr CDouble -> Int32 -> IO ()
vips_value_set_array_double Ptr GValue
value' Ptr CDouble
maybeArray Int32
n
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr CDouble -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CDouble
maybeArray
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function value_set_array
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of elements" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the type of each element"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sizeof_type"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the sizeof each element"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_array" vips_value_set_array :: 
    Ptr GValue ->                           -- value : TGValue
    Int32 ->                                -- n : TBasicType TInt
    CGType ->                               -- type : TBasicType TGType
    Word64 ->                               -- sizeof_type : TBasicType TUInt64
    IO ()

-- | Set /@value@/ to be an array of things.
-- 
-- This allocates memory but does not
-- initialise the contents: get the pointer and write instead.
valueSetArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@n@/: number of elements
    -> GType
    -- ^ /@type@/: the type of each element
    -> Word64
    -- ^ /@sizeofType@/: the sizeof each element
    -> m (GValue)
valueSetArray :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> GType -> Word64 -> m GValue
valueSetArray Int32
n GType
type_ Word64
sizeofType = IO GValue -> m GValue
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GValue -> m GValue) -> IO GValue -> m GValue
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value <- Int -> IO (Ptr GValue)
forall a. Int -> IO (Ptr a)
SP.callocBytes Int
24 :: IO (Ptr GValue)
    let type_' :: Word64
type_' = GType -> Word64
gtypeToCGType GType
type_
    Ptr GValue -> Int32 -> Word64 -> Word64 -> IO ()
vips_value_set_array Ptr GValue
value Int32
n Word64
type_' Word64
sizeofType
    GValue
value' <- Ptr GValue -> IO GValue
B.GValue.wrapGValuePtr Ptr GValue
value
    GValue -> IO GValue
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GValue
value'


-- function value_set_area
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "set this value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "free_fn"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "CallbackFn" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "data will be freed with this function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 2
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "set @value to track this pointer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_set_area" vips_value_set_area :: 
    Ptr GValue ->                           -- value : TGValue
    FunPtr Vips.Callbacks.C_CallbackFn ->   -- free_fn : TInterface (Name {namespace = "Vips", name = "CallbackFn"})
    Ptr () ->                               -- data : TBasicType TPtr
    IO ()

-- | Set value to be a ref-counted area of memory with a free function.
valueSetArea ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: set this value
    -> Vips.Callbacks.CallbackFn
    -- ^ /@freeFn@/: data will be freed with this function
    -> m ()
valueSetArea :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> CallbackFn -> m ()
valueSetArea GValue
value CallbackFn
freeFn = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr (FunPtr CallbackFn)
ptrfreeFn <- IO (Ptr (FunPtr CallbackFn))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr Vips.Callbacks.C_CallbackFn))
    FunPtr CallbackFn
freeFn' <- CallbackFn -> IO (FunPtr CallbackFn)
Vips.Callbacks.mk_CallbackFn (Maybe (Ptr (FunPtr CallbackFn)) -> CallbackFn -> CallbackFn
Vips.Callbacks.wrap_CallbackFn (Ptr (FunPtr CallbackFn) -> Maybe (Ptr (FunPtr CallbackFn))
forall a. a -> Maybe a
Just Ptr (FunPtr CallbackFn)
ptrfreeFn) CallbackFn
freeFn)
    Ptr (FunPtr CallbackFn) -> FunPtr CallbackFn -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr CallbackFn)
ptrfreeFn FunPtr CallbackFn
freeFn'
    let data_ :: Ptr a
data_ = Ptr a
forall a. Ptr a
nullPtr
    Ptr GValue -> FunPtr CallbackFn -> Ptr () -> IO ()
vips_value_set_area Ptr GValue
value' FunPtr CallbackFn
freeFn' Ptr ()
forall a. Ptr a
data_
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function value_is_null
-- Args: [ Arg
--           { argCName = "psoec"
--           , argType = TParamSpec
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_is_null" vips_value_is_null :: 
    Ptr GParamSpec ->                       -- psoec : TParamSpec
    Ptr GValue ->                           -- value : TGValue
    IO CInt

-- | /No description available in the introspection data./
valueIsNull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GParamSpec
    -> GValue
    -> m Bool
valueIsNull :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GParamSpec -> GValue -> m Bool
valueIsNull GParamSpec
psoec GValue
value = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr GParamSpec
psoec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
psoec
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    CInt
result <- Ptr GParamSpec -> Ptr GValue -> IO CInt
vips_value_is_null Ptr GParamSpec
psoec' Ptr GValue
value'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
psoec
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function value_get_save_string
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GValue to get from" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_save_string" vips_value_get_save_string :: 
    Ptr GValue ->                           -- value : TGValue
    IO CString

-- | Get the C string held internally by the GValue.
valueGetSaveString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: GValue to get from
    -> m T.Text
    -- ^ __Returns:__ The C string held by /@value@/.
valueGetSaveString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GValue -> m Text
valueGetSaveString GValue
value = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    CString
result <- Ptr GValue -> IO CString
vips_value_get_save_string Ptr GValue
value'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"valueGetSaveString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function value_get_ref_string
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return length here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_ref_string" vips_value_get_ref_string :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    IO CString

-- | Get the C string held internally by the @/GValue/@.
valueGetRefString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> m ((T.Text, Word64))
    -- ^ __Returns:__ The C string held by /@value@/.
valueGetRefString :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Text, Word64)
valueGetRefString GValue
value = IO (Text, Word64) -> m (Text, Word64)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Text, Word64) -> m (Text, Word64))
-> IO (Text, Word64) -> m (Text, Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    CString
result <- Ptr GValue -> Ptr Word64 -> IO CString
vips_value_get_ref_string Ptr GValue
value' Ptr Word64
length_
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"valueGetRefString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
    (Text, Word64) -> IO (Text, Word64)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Text
result', Word64
length_')


-- function value_get_blob
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "GValue to set" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optionally return length of memory area"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_blob" vips_value_get_blob :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    IO (Ptr ())

-- | Returns the data pointer from a blob. Optionally returns the length too.
-- 
-- blobs are things like ICC profiles or EXIF data. They are relocatable, and
-- are saved to VIPS files for you coded as base64 inside the XML. They are
-- copied by copying reference-counted pointers.
-- 
-- See also: 'GI.Vips.Functions.valueSetBlob'
valueGetBlob ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: GValue to set
    -> m ((Ptr (), Word64))
    -- ^ __Returns:__ The pointer held by /@value@/.
valueGetBlob :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Ptr (), Word64)
valueGetBlob GValue
value = IO (Ptr (), Word64) -> m (Ptr (), Word64)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr (), Word64) -> m (Ptr (), Word64))
-> IO (Ptr (), Word64) -> m (Ptr (), Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr ()
result <- Ptr GValue -> Ptr Word64 -> IO (Ptr ())
vips_value_get_blob Ptr GValue
value' Ptr Word64
length_
    Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
    (Ptr (), Word64) -> IO (Ptr (), Word64)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
result, Word64
length_')


-- function value_get_array_int
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the number of elements here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n"
--              , argType = TBasicType TInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "return the number of elements here, optionally"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TInt))
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_array_int" vips_value_get_array_int :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Int32 ->                            -- n : TBasicType TInt
    IO (Ptr Int32)

-- | Return the start of the array of ints held by /@value@/.
-- optionally return the number of elements in /@n@/.
-- 
-- See also: 'GI.Vips.Structs.ArrayInt.arrayIntNew'.
valueGetArrayInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> m [Int32]
    -- ^ __Returns:__ The array address.
valueGetArrayInt :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m [Int32]
valueGetArrayInt GValue
value = IO [Int32] -> m [Int32]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Int32] -> m [Int32]) -> IO [Int32] -> m [Int32]
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Int32
n <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Int32
result <- Ptr GValue -> Ptr Int32 -> IO (Ptr Int32)
vips_value_get_array_int Ptr GValue
value' Ptr Int32
n
    Int32
n' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
n
    Text -> Ptr Int32 -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"valueGetArrayInt" Ptr Int32
result
    [Int32]
result' <- (Int32 -> Ptr Int32 -> IO [Int32]
forall a b. (Integral a, Storable b) => a -> Ptr b -> IO [b]
unpackStorableArrayWithLength Int32
n') Ptr Int32
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
n
    [Int32] -> IO [Int32]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Int32]
result'


-- function value_get_array_image
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the number of elements here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n"
--              , argType = TBasicType TInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "return the number of elements here, optionally"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just
--               (TCArray
--                  False
--                  (-1)
--                  1
--                  (TInterface Name { namespace = "Vips" , name = "Image" }))
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_array_image" vips_value_get_array_image :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Int32 ->                            -- n : TBasicType TInt
    IO (Ptr (Ptr Vips.Image.Image))

-- | Return the start of the array of images held by /@value@/.
-- optionally return the number of elements in /@n@/.
-- 
-- See also: 'GI.Vips.Functions.valueSetArrayImage'.
valueGetArrayImage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> m [Vips.Image.Image]
    -- ^ __Returns:__ The array address.
valueGetArrayImage :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m [Image]
valueGetArrayImage GValue
value = IO [Image] -> m [Image]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Image] -> m [Image]) -> IO [Image] -> m [Image]
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Int32
n <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr (Ptr Image)
result <- Ptr GValue -> Ptr Int32 -> IO (Ptr (Ptr Image))
vips_value_get_array_image Ptr GValue
value' Ptr Int32
n
    Int32
n' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
n
    Text -> Ptr (Ptr Image) -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"valueGetArrayImage" Ptr (Ptr Image)
result
    [Ptr Image]
result' <- (Int32 -> Ptr (Ptr Image) -> IO [Ptr Image]
forall a b. Integral a => a -> Ptr (Ptr b) -> IO [Ptr b]
unpackPtrArrayWithLength Int32
n') Ptr (Ptr Image)
result
    [Image]
result'' <- (Ptr Image -> IO Image) -> [Ptr Image] -> IO [Image]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ManagedPtr Image -> Image) -> Ptr Image -> IO Image
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Image -> Image
Vips.Image.Image) [Ptr Image]
result'
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
n
    [Image] -> IO [Image]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Image]
result''


-- function value_get_array_double
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the number of elements here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n"
--              , argType = TBasicType TInt
--              , direction = DirectionOut
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "return the number of elements here, optionally"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferEverything
--              }
--          ]
-- returnType: Just (TCArray False (-1) 1 (TBasicType TDouble))
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_array_double" vips_value_get_array_double :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Int32 ->                            -- n : TBasicType TInt
    IO (Ptr CDouble)

-- | Return the start of the array of doubles held by /@value@/.
-- optionally return the number of elements in /@n@/.
-- 
-- See also: 'GI.Vips.Structs.ArrayDouble.arrayDoubleNew'.
valueGetArrayDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> m [Double]
    -- ^ __Returns:__ The array address.
valueGetArrayDouble :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m [Double]
valueGetArrayDouble GValue
value = IO [Double] -> m [Double]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Double] -> m [Double]) -> IO [Double] -> m [Double]
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Int32
n <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr CDouble
result <- Ptr GValue -> Ptr Int32 -> IO (Ptr CDouble)
vips_value_get_array_double Ptr GValue
value' Ptr Int32
n
    Int32
n' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
n
    Text -> Ptr CDouble -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"valueGetArrayDouble" Ptr CDouble
result
    [Double]
result' <- ((CDouble -> Double) -> Int32 -> Ptr CDouble -> IO [Double]
forall a b c.
(Integral a, Storable b) =>
(b -> c) -> a -> Ptr b -> IO [c]
unpackMapStorableArrayWithLength CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac Int32
n') Ptr CDouble
result
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
n
    [Double] -> IO [Double]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Double]
result'


-- function value_get_array
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%GValue to get from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the number of elements here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the type of each element here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "sizeof_type"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return the sizeof each element here, optionally"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_array" vips_value_get_array :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Int32 ->                            -- n : TBasicType TInt
    Ptr CGType ->                           -- type : TBasicType TGType
    Ptr Word64 ->                           -- sizeof_type : TBasicType TUInt64
    IO (Ptr ())

-- | Return the pointer to the array held by /@value@/.
-- Optionally return the other properties of the array in /@n@/, /@type@/,
-- /@sizeofType@/.
-- 
-- See also: 'GI.Vips.Functions.valueSetArray'.
valueGetArray ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: @/GValue/@ to get from
    -> m ((Ptr (), Int32, GType, Word64))
    -- ^ __Returns:__ The array address.
valueGetArray :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Ptr (), Int32, GType, Word64)
valueGetArray GValue
value = IO (Ptr (), Int32, GType, Word64)
-> m (Ptr (), Int32, GType, Word64)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr (), Int32, GType, Word64)
 -> m (Ptr (), Int32, GType, Word64))
-> IO (Ptr (), Int32, GType, Word64)
-> m (Ptr (), Int32, GType, Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Int32
n <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Word64
type_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CGType)
    Ptr Word64
sizeofType <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr ()
result <- Ptr GValue -> Ptr Int32 -> Ptr Word64 -> Ptr Word64 -> IO (Ptr ())
vips_value_get_array Ptr GValue
value' Ptr Int32
n Ptr Word64
type_ Ptr Word64
sizeofType
    Int32
n' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
n
    Word64
type_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
type_
    let type_'' :: GType
type_'' = Word64 -> GType
GType Word64
type_'
    Word64
sizeofType' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
sizeofType
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
n
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
type_
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
sizeofType
    (Ptr (), Int32, GType, Word64) -> IO (Ptr (), Int32, GType, Word64)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
result, Int32
n', GType
type_'', Word64
sizeofType')


-- function value_get_area
-- Args: [ Arg
--           { argCName = "value"
--           , argType = TGValue
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "get from this value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "optionally return length here"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "vips_value_get_area" vips_value_get_area :: 
    Ptr GValue ->                           -- value : TGValue
    Ptr Word64 ->                           -- length : TBasicType TUInt64
    IO (Ptr ())

-- | Get the pointer from an area. Don\'t touch count (area is static).
valueGetArea ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GValue
    -- ^ /@value@/: get from this value
    -> m ((Ptr (), Word64))
    -- ^ __Returns:__ The pointer held by /@value@/.
valueGetArea :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GValue -> m (Ptr (), Word64)
valueGetArea GValue
value = IO (Ptr (), Word64) -> m (Ptr (), Word64)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr (), Word64) -> m (Ptr (), Word64))
-> IO (Ptr (), Word64) -> m (Ptr (), Word64)
forall a b. (a -> b) -> a -> b
$ do
    Ptr GValue
value' <- GValue -> IO (Ptr GValue)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GValue
value
    Ptr Word64
length_ <- IO (Ptr Word64)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word64)
    Ptr ()
result <- Ptr GValue -> Ptr Word64 -> IO (Ptr ())
vips_value_get_area Ptr GValue
value' Ptr Word64
length_
    Word64
length_' <- Ptr Word64 -> IO Word64
forall a. Storable a => Ptr a -> IO a
peek Ptr Word64
length_
    GValue -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GValue
value
    Ptr Word64 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word64
length_
    (Ptr (), Word64) -> IO (Ptr (), Word64)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
result, Word64
length_')


-- function type_find
-- Args: [ Arg
--           { argCName = "basename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of base class" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "nickname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "search for a class with this nickname"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "vips_type_find" vips_type_find :: 
    CString ->                              -- basename : TBasicType TUTF8
    CString ->                              -- nickname : TBasicType TUTF8
    IO CGType

-- | Search below /@basename@/, return the @/GType/@ of the class whose name or
-- /@nickname@/ matches, or 0 for not found.
-- If /@basename@/ is NULL, the whole of t'GI.Vips.Objects.Object.Object' is searched.
-- 
-- This function uses a cache, so it should be quick.
-- 
-- See also: 'GI.Vips.Functions.classFind'
typeFind ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@basename@/: name of base class
    -> T.Text
    -- ^ /@nickname@/: search for a class with this nickname
    -> m GType
    -- ^ __Returns:__ the @/GType/@ of the class, or 0 if the class is not found.
typeFind :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m GType
typeFind Text
basename Text
nickname = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    CString
basename' <- Text -> IO CString
textToCString Text
basename
    CString
nickname' <- Text -> IO CString
textToCString Text
nickname
    Word64
result <- CString -> CString -> IO Word64
vips_type_find CString
basename' CString
nickname'
    let result' :: GType
result' = Word64 -> GType
GType Word64
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
basename'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
nickname'
    GType -> IO GType
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return GType
result'


-- function type_depth
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_type_depth" vips_type_depth :: 
    CGType ->                               -- type : TBasicType TGType
    IO Int32

-- | /No description available in the introspection data./
typeDepth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -> m Int32
typeDepth :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GType -> m Int32
typeDepth GType
type_ = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let type_' :: Word64
type_' = GType -> Word64
gtypeToCGType GType
type_
    Int32
result <- Word64 -> IO Int32
vips_type_depth Word64
type_'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function tracked_open
-- Args: [ Arg
--           { argCName = "pathname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of file to open"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "flags for open()" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mode"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "open mode" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_open" vips_tracked_open :: 
    CString ->                              -- pathname : TBasicType TUTF8
    Int32 ->                                -- flags : TBasicType TInt
    Int32 ->                                -- mode : TBasicType TInt
    IO Int32

-- | Exactly as open(2), but the number of files currently open via
-- 'GI.Vips.Functions.trackedOpen' is available via 'GI.Vips.Functions.trackedGetFiles'. This is used
-- by the vips operation cache to drop cache when the number of files
-- available is low.
-- 
-- You must only close the file descriptor with 'GI.Vips.Functions.trackedClose'.
-- 
-- /@pathname@/ should be utf8.
-- 
-- See also: 'GI.Vips.Functions.trackedClose', 'GI.Vips.Functions.trackedGetFiles'.
trackedOpen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@pathname@/: name of file to open
    -> Int32
    -- ^ /@flags@/: flags for @/open()/@
    -> Int32
    -- ^ /@mode@/: open mode
    -> m Int32
    -- ^ __Returns:__ a file descriptor, or -1 on error.
trackedOpen :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int32 -> Int32 -> m Int32
trackedOpen Text
pathname Int32
flags Int32
mode = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
pathname' <- Text -> IO CString
textToCString Text
pathname
    Int32
result <- CString -> Int32 -> Int32 -> IO Int32
vips_tracked_open CString
pathname' Int32
flags Int32
mode
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
pathname'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function tracked_malloc
-- Args: [ Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of bytes to allocate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_malloc" vips_tracked_malloc :: 
    Word64 ->                               -- size : TBasicType TUInt64
    IO (Ptr ())

-- | Allocate an area of memory that will be tracked by 'GI.Vips.Functions.trackedGetMem'
-- and friends.
-- 
-- If allocation fails, 'GI.Vips.Functions.malloc' returns 'P.Nothing' and
-- sets an error message.
-- 
-- You must only free the memory returned with 'GI.Vips.Functions.trackedFree'.
-- 
-- See also: 'GI.Vips.Functions.trackedFree', 'GI.Vips.Functions.malloc'.
trackedMalloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    -- ^ /@size@/: number of bytes to allocate
    -> m (Ptr ())
    -- ^ __Returns:__ a pointer to the allocated memory, or 'P.Nothing' on error.
trackedMalloc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word64 -> m (Ptr ())
trackedMalloc Word64
size = IO (Ptr ()) -> m (Ptr ())
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr ()
result <- Word64 -> IO (Ptr ())
vips_tracked_malloc Word64
size
    Ptr () -> IO (Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result


-- function tracked_get_mem_highwater
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_get_mem_highwater" vips_tracked_get_mem_highwater :: 
    IO Word64

-- | Returns the largest number of bytes simultaneously allocated via
-- 'GI.Vips.Functions.trackedMalloc'. Handy for estimating max memory requirements for a
-- program.
trackedGetMemHighwater ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    -- ^ __Returns:__ the largest number of currently allocated bytes
trackedGetMemHighwater :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word64
trackedGetMemHighwater  = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Word64
result <- IO Word64
vips_tracked_get_mem_highwater
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function tracked_get_mem
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_get_mem" vips_tracked_get_mem :: 
    IO Word64

-- | Returns the number of bytes currently allocated via 'GI.Vips.Functions.malloc' and
-- friends. vips uses this figure to decide when to start dropping cache, see
-- t'GI.Vips.Objects.Operation.Operation'.
trackedGetMem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    -- ^ __Returns:__ the number of currently allocated bytes
trackedGetMem :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word64
trackedGetMem  = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Word64
result <- IO Word64
vips_tracked_get_mem
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function tracked_get_files
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_get_files" vips_tracked_get_files :: 
    IO Int32

-- | Returns the number of open files.
trackedGetFiles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ the number of open files
trackedGetFiles :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
trackedGetFiles  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_tracked_get_files
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function tracked_get_allocs
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_get_allocs" vips_tracked_get_allocs :: 
    IO Int32

-- | Returns the number of active allocations.
trackedGetAllocs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ the number of active allocations
trackedGetAllocs :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
trackedGetAllocs  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_tracked_get_allocs
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function tracked_free
-- Args: [ Arg
--           { argCName = "s"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "memory to free" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_free" vips_tracked_free :: 
    Ptr () ->                               -- s : TBasicType TPtr
    IO ()

-- | Only use it to free
-- memory that was previously allocated with 'GI.Vips.Functions.trackedMalloc' with a
-- 'P.Nothing' first argument.
-- 
-- See also: 'GI.Vips.Functions.trackedMalloc'.
trackedFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@s@/: memory to free
    -> m ()
trackedFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Ptr () -> m ()
trackedFree Ptr ()
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr () -> IO ()
vips_tracked_free Ptr ()
s
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function tracked_close
-- Args: [ Arg
--           { argCName = "fd"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "file to close()" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_tracked_close" vips_tracked_close :: 
    Int32 ->                                -- fd : TBasicType TInt
    IO Int32

-- | Exactly as close(2), but update the number of files currently open via
-- 'GI.Vips.Functions.trackedGetFiles'. This is used
-- by the vips operation cache to drop cache when the number of files
-- available is low.
-- 
-- You must only close file descriptors opened with 'GI.Vips.Functions.trackedOpen'.
-- 
-- See also: 'GI.Vips.Functions.trackedOpen', 'GI.Vips.Functions.trackedGetFiles'.
trackedClose ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@fd@/: file to @/close()/@
    -> m Int32
    -- ^ __Returns:__ a file descriptor, or -1 on error.
trackedClose :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m Int32
trackedClose Int32
fd = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- Int32 -> IO Int32
vips_tracked_close Int32
fd
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function thread_shutdown
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_thread_shutdown" vips_thread_shutdown :: 
    IO ()

-- | Free any thread-private data and flush any profiling information.
-- 
-- This function needs to be called when a thread that has been using vips
-- exits. It is called for you by 'GI.Vips.Functions.shutdown' and for any threads created
-- within the @/VipsThreadPool/@.
-- 
-- You will need to call it from threads created in
-- other ways or there will be memory leaks. If you do not call it, vips
-- will generate a warning message.
-- 
-- It may be called many times, and you can continue using vips after
-- calling it. Calling it too often will reduce performance.
threadShutdown ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
threadShutdown :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
threadShutdown  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_thread_shutdown
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function strdup
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "allocate memory local to this #VipsObject, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string to copy" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_strdup" vips_strdup :: 
    Ptr Vips.Object.Object ->               -- object : TInterface (Name {namespace = "Vips", name = "Object"})
    CString ->                              -- str : TBasicType TUTF8
    IO CString

-- | 'GI.GLib.Functions.strdup' a string. When /@object@/ is freed, the string will be freed for
-- you.  If /@object@/ is 'P.Nothing', you need to
-- free the memory yourself with 'GI.GLib.Functions.free'.
-- 
-- This function cannot fail.
-- 
-- See also: 'GI.Vips.Functions.malloc'.
strdup ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Object.IsObject a) =>
    Maybe (a)
    -- ^ /@object@/: allocate memory local to this t'GI.Vips.Objects.Object.Object', or 'P.Nothing'
    -> T.Text
    -- ^ /@str@/: string to copy
    -> m T.Text
    -- ^ __Returns:__ a pointer to the allocated memory
strdup :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> Text -> m Text
strdup Maybe a
object Text
str = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
maybeObject <- case Maybe a
object of
        Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just a
jObject -> do
            Ptr Object
jObject' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObject
            Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObject'
    CString
str' <- Text -> IO CString
textToCString Text
str
    CString
result <- Ptr Object -> CString -> IO CString
vips_strdup Ptr Object
maybeObject CString
str'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"strdup" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
object a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function shutdown
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_shutdown" vips_shutdown :: 
    IO ()

-- | Call this to drop caches, close plugins, terminate background threads, and
-- finalize any internal library testing.
-- 
-- 'GI.Vips.Functions.shutdown' is optional. If you don\'t call it, your platform will
-- clean up for you. The only negative consequences are that the leak checker
-- and the profiler will not work.
-- 
-- You may call @/VIPS_INIT()/@ many times and 'GI.Vips.Functions.shutdown' many times, but you
-- must not call @/VIPS_INIT()/@ after 'GI.Vips.Functions.shutdown'. In other words, you cannot
-- stop and restart libvips.
-- 
-- See also: @/vips_profile_set()/@, 'GI.Vips.Functions.leakSet'.
shutdown ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
shutdown :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
shutdown  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_shutdown
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function pythagoras
-- Args: [ Arg
--           { argCName = "L1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "L2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_pythagoras" vips_pythagoras :: 
    CFloat ->                               -- L1 : TBasicType TFloat
    CFloat ->                               -- a1 : TBasicType TFloat
    CFloat ->                               -- b1 : TBasicType TFloat
    CFloat ->                               -- L2 : TBasicType TFloat
    CFloat ->                               -- a2 : TBasicType TFloat
    CFloat ->                               -- b2 : TBasicType TFloat
    IO CFloat

-- | Pythagorean distance between two points in colour space. Lab\/XYZ\/CMC etc.
pythagoras ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@l1@/: Input coordinate 1
    -> Float
    -- ^ /@a1@/: Input coordinate 1
    -> Float
    -- ^ /@b1@/: Input coordinate 1
    -> Float
    -- ^ /@l2@/: Input coordinate 2
    -> Float
    -- ^ /@a2@/: Input coordinate 2
    -> Float
    -- ^ /@b2@/: Input coordinate 2
    -> m Float
pythagoras :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Float -> Float -> Float -> m Float
pythagoras Float
l1 Float
a1 Float
b1 Float
l2 Float
a2 Float
b2 = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let l1' :: CFloat
l1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l1
    let a1' :: CFloat
a1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a1
    let b1' :: CFloat
b1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b1
    let l2' :: CFloat
l2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l2
    let a2' :: CFloat
a2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a2
    let b2' :: CFloat
b2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b2
    CFloat
result <- CFloat
-> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO CFloat
vips_pythagoras CFloat
l1' CFloat
a1' CFloat
b1' CFloat
l2' CFloat
a2' CFloat
b2'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function path_mode7
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_path_mode7" vips_path_mode7 :: 
    CString ->                              -- path : TBasicType TUTF8
    IO CString

-- | /No description available in the introspection data./
pathMode7 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> m T.Text
pathMode7 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
pathMode7 Text
path = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    CString
result <- CString -> IO CString
vips_path_mode7 CString
path'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pathMode7" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function path_filename7
-- Args: [ Arg
--           { argCName = "path"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_path_filename7" vips_path_filename7 :: 
    CString ->                              -- path : TBasicType TUTF8
    IO CString

-- | /No description available in the introspection data./
pathFilename7 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> m T.Text
pathFilename7 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
pathFilename7 Text
path = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
path' <- Text -> IO CString
textToCString Text
path
    CString
result <- CString -> IO CString
vips_path_filename7 CString
path'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pathFilename7" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
path'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function nickname_find
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#GType to search for"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_nickname_find" vips_nickname_find :: 
    CGType ->                               -- type : TBasicType TGType
    IO CString

-- | Return the VIPS nickname for a @/GType/@. Handy for language bindings.
nicknameFind ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@type@/: t'GType' to search for
    -> m T.Text
    -- ^ __Returns:__ the class nickname.
nicknameFind :: forall (m :: * -> *). (HasCallStack, MonadIO m) => GType -> m Text
nicknameFind GType
type_ = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    let type_' :: Word64
type_' = GType -> Word64
gtypeToCGType GType
type_
    CString
result <- Word64 -> IO CString
vips_nickname_find Word64
type_'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"nicknameFind" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function malloc
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "allocate memory local to this #VipsObject, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "size"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of bytes to allocate"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "vips_malloc" vips_malloc :: 
    Ptr Vips.Object.Object ->               -- object : TInterface (Name {namespace = "Vips", name = "Object"})
    Word64 ->                               -- size : TBasicType TUInt64
    IO (Ptr ())

-- | 'GI.GLib.Functions.malloc' local to /@object@/, that is, the memory will be automatically
-- freed for you when the object is closed. If /@object@/ is 'P.Nothing', you need to
-- free the memory explicitly with 'GI.GLib.Functions.free'.
-- 
-- This function cannot fail. See 'GI.Vips.Functions.trackedMalloc' if you are
-- allocating large amounts of memory.
-- 
-- See also: 'GI.Vips.Functions.trackedMalloc'.
malloc ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Object.IsObject a) =>
    Maybe (a)
    -- ^ /@object@/: allocate memory local to this t'GI.Vips.Objects.Object.Object', or 'P.Nothing'
    -> Word64
    -- ^ /@size@/: number of bytes to allocate
    -> m (Ptr ())
    -- ^ __Returns:__ a pointer to the allocated memory.
malloc :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsObject a) =>
Maybe a -> Word64 -> m (Ptr ())
malloc Maybe a
object Word64
size = IO (Ptr ()) -> m (Ptr ())
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
maybeObject <- case Maybe a
object of
        Maybe a
Nothing -> Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
forall a. Ptr a
nullPtr
        Just a
jObject -> do
            Ptr Object
jObject' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jObject
            Ptr Object -> IO (Ptr Object)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Object
jObject'
    Ptr ()
result <- Ptr Object -> Word64 -> IO (Ptr ())
vips_malloc Ptr Object
maybeObject Word64
size
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
object a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Ptr () -> IO (Ptr ())
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
result


-- function leak_set
-- Args: [ Arg
--           { argCName = "leak"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "turn leak checking on or off"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_leak_set" vips_leak_set :: 
    CInt ->                                 -- leak : TBasicType TBoolean
    IO ()

-- | Turn on or off vips leak checking. See also --vips-leak,
-- 'GI.Vips.Functions.addOptionEntries' and the @VIPS_LEAK@ environment variable.
-- 
-- You should call this very early in your program.
leakSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@leak@/: turn leak checking on or off
    -> m ()
leakSet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Bool -> m ()
leakSet Bool
leak = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let leak' :: CInt
leak' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
leak
    CInt -> IO ()
vips_leak_set CInt
leak'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function init
-- Args: [ Arg
--           { argCName = "argv0"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of application"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_init" vips_init :: 
    CString ->                              -- argv0 : TBasicType TUTF8
    IO Int32

-- | This function starts up libvips, see @/VIPS_INIT()/@.
-- 
-- This function is for bindings which need to start up vips. C programs
-- should use the @/VIPS_INIT()/@ macro, which does some extra checks.
-- 
-- See also: @/VIPS_INIT()/@.
init ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@argv0@/: name of application
    -> m Int32
    -- ^ __Returns:__ 0 on success, -1 otherwise
init :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Int32
init Text
argv0 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
argv0' <- Text -> IO CString
textToCString Text
argv0
    Int32
result <- CString -> IO Int32
vips_init CString
argv0'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
argv0'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function icc_present
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_icc_present" vips_icc_present :: 
    IO Int32

-- | VIPS can optionally be built without the ICC library. Use this function to
-- test for its availability.
iccPresent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ non-zero if the ICC library is present.
iccPresent :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
iccPresent  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_icc_present
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function icc_is_compatible_profile
-- Args: [ Arg
--           { argCName = "image"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data_length"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "vips_icc_is_compatible_profile" vips_icc_is_compatible_profile :: 
    Ptr Vips.Image.Image ->                 -- image : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr () ->                               -- data : TBasicType TPtr
    Word64 ->                               -- data_length : TBasicType TUInt64
    IO CInt

-- | /No description available in the introspection data./
iccIsCompatibleProfile ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    a
    -> Ptr ()
    -> Word64
    -> m Bool
iccIsCompatibleProfile :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
a -> Ptr () -> Word64 -> m Bool
iccIsCompatibleProfile a
image Ptr ()
data_ Word64
dataLength = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr Image
image' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
image
    CInt
result <- Ptr Image -> Ptr () -> Word64 -> IO CInt
vips_icc_is_compatible_profile Ptr Image
image' Ptr ()
data_ Word64
dataLength
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
image
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function guess_prefix
-- Args: [ Arg
--           { argCName = "argv0"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "program name (typically argv[0])"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "env_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "save prefix in this environment variable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_guess_prefix" vips_guess_prefix :: 
    CString ->                              -- argv0 : TBasicType TUTF8
    CString ->                              -- env_name : TBasicType TUTF8
    IO CString

-- | 'GI.Vips.Functions.guessPrefix' tries to guess the install directory. You should pass
-- in the value of argv[0] (the name your program was run as) as a clue to
-- help it out, plus the name of the environment variable you let the user
-- override your package install area with (eg. \"VIPSHOME\").
-- 
-- On success, 'GI.Vips.Functions.guessPrefix' returns the prefix it discovered, and as a
-- side effect, sets the environment variable (if it\'s not set).
-- 
-- Don\'t free the return string!
-- 
-- See also: 'GI.Vips.Functions.guessLibdir'.
guessPrefix ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@argv0@/: program name (typically argv[0])
    -> T.Text
    -- ^ /@envName@/: save prefix in this environment variable
    -> m T.Text
    -- ^ __Returns:__ the install prefix as a static string, do not free.
guessPrefix :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Text
guessPrefix Text
argv0 Text
envName = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
argv0' <- Text -> IO CString
textToCString Text
argv0
    CString
envName' <- Text -> IO CString
textToCString Text
envName
    CString
result <- CString -> CString -> IO CString
vips_guess_prefix CString
argv0' CString
envName'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"guessPrefix" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
argv0'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
envName'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function guess_libdir
-- Args: [ Arg
--           { argCName = "argv0"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "program name (typically argv[0])"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "env_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "save prefix in this environment variable"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_guess_libdir" vips_guess_libdir :: 
    CString ->                              -- argv0 : TBasicType TUTF8
    CString ->                              -- env_name : TBasicType TUTF8
    IO CString

-- | 'GI.Vips.Functions.guessLibdir' tries to guess the install directory (usually the
-- configure libdir, or $prefix\/lib). You should pass
-- in the value of argv[0] (the name your program was run as) as a clue to
-- help it out, plus the name of the environment variable you let the user
-- override your package install area with (eg. \"VIPSHOME\").
-- 
-- On success, 'GI.Vips.Functions.guessLibdir' returns the libdir it discovered, and as a
-- side effect, sets the prefix environment variable (if it\'s not set).
-- 
-- Don\'t free the return string!
-- 
-- See also: 'GI.Vips.Functions.guessPrefix'.
guessLibdir ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@argv0@/: program name (typically argv[0])
    -> T.Text
    -- ^ /@envName@/: save prefix in this environment variable
    -> m T.Text
    -- ^ __Returns:__ the libdir as a static string, do not free.
guessLibdir :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m Text
guessLibdir Text
argv0 Text
envName = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
argv0' <- Text -> IO CString
textToCString Text
argv0
    CString
envName' <- Text -> IO CString
textToCString Text
envName
    CString
result <- CString -> CString -> IO CString
vips_guess_libdir CString
argv0' CString
envName'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"guessLibdir" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
argv0'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
envName'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function get_prgname
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_get_prgname" vips_get_prgname :: 
    IO CString

-- | Return the program name. This can be useful for the user tio see,.
-- 
-- See also: @/VIPS_INIT()/@.
getPrgname ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a pointer to an internal copy of the program
    -- name. Do not free this value
getPrgname :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
getPrgname  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vips_get_prgname
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getPrgname" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function get_disc_threshold
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "vips_get_disc_threshold" vips_get_disc_threshold :: 
    IO Word64

-- | Return the number of bytes at which we flip between open via memory and
-- open via disc. This defaults to 100mb, but can be changed with the
-- VIPS_DISC_THRESHOLD environment variable or the --vips-disc-threshold
-- command-line flag. See @/vips_image_new_from_file()/@.
getDiscThreshold ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    -- ^ __Returns:__ disc threshold in bytes.
getDiscThreshold :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word64
getDiscThreshold  = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Word64
result <- IO Word64
vips_get_disc_threshold
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function get_argv0
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_get_argv0" vips_get_argv0 :: 
    IO CString

-- | See also: @/VIPS_INIT()/@.
getArgv0 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a pointer to an internal copy of the
    -- argv0 string passed to
    -- @/VIPS_INIT()/@. Do not free this value
getArgv0 :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
getArgv0  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vips_get_argv0
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"getArgv0" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function g_error
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : True
-- Skip return : False

foreign import ccall "vips_g_error" vips_g_error :: 
    Ptr (Ptr GError) ->                     -- error
    IO ()

-- | This function adds the @/GError/@ to the vips error buffer and clears it. It\'s
-- the opposite of 'GI.Vips.Functions.errorG'.
-- 
-- See also: 'GI.Vips.Functions.errorG'.
gError ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
gError :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
gError  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        (Ptr (Ptr GError) -> IO ()) -> IO ()
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO ()) -> IO ())
-> (Ptr (Ptr GError) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr GError) -> IO ()
vips_g_error
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function format_sizeof
-- Args: [ Arg
--           { argCName = "format"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "BandFormat" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "format type" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "vips_format_sizeof" vips_format_sizeof :: 
    CInt ->                                 -- format : TInterface (Name {namespace = "Vips", name = "BandFormat"})
    IO Word64

-- | /No description available in the introspection data./
formatSizeof ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Vips.Enums.BandFormat
    -- ^ /@format@/: format type
    -> m Word64
    -- ^ __Returns:__ number of bytes for a band format.
formatSizeof :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
BandFormat -> m Word64
formatSizeof BandFormat
format = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    let format' :: CInt
format' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BandFormat -> Int) -> BandFormat -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BandFormat -> Int
forall a. Enum a => a -> Int
fromEnum) BandFormat
format
    Word64
result <- CInt -> IO Word64
vips_format_sizeof CInt
format'
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function foreign_flags
-- Args: [ Arg
--           { argCName = "loader"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of loader to use for test"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "file to test" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Vips" , name = "ForeignFlags" })
-- throws : False
-- Skip return : False

foreign import ccall "vips_foreign_flags" vips_foreign_flags :: 
    CString ->                              -- loader : TBasicType TUTF8
    CString ->                              -- filename : TBasicType TUTF8
    IO CUInt

-- | Return the flags for /@filename@/ using /@loader@/.
-- /@loader@/ is something like \"tiffload\" or \"VipsForeignLoadTiff\".
foreignFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@loader@/: name of loader to use for test
    -> T.Text
    -- ^ /@filename@/: file to test
    -> m [Vips.Flags.ForeignFlags]
    -- ^ __Returns:__ the flags for /@filename@/.
foreignFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m [ForeignFlags]
foreignFlags Text
loader Text
filename = IO [ForeignFlags] -> m [ForeignFlags]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ForeignFlags] -> m [ForeignFlags])
-> IO [ForeignFlags] -> m [ForeignFlags]
forall a b. (a -> b) -> a -> b
$ do
    CString
loader' <- Text -> IO CString
textToCString Text
loader
    CString
filename' <- Text -> IO CString
textToCString Text
filename
    CUInt
result <- CString -> CString -> IO CUInt
vips_foreign_flags CString
loader' CString
filename'
    let result' :: [ForeignFlags]
result' = CUInt -> [ForeignFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
loader'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
filename'
    [ForeignFlags] -> IO [ForeignFlags]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [ForeignFlags]
result'


-- function filename_get_options
-- Args: [ Arg
--           { argCName = "vips_filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a filename including a set of options"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_filename_get_options" vips_filename_get_options :: 
    CString ->                              -- vips_filename : TBasicType TUTF8
    IO CString

-- | Given a vips filename like \"fred.jpg[Q=90]\", return a new string of
-- just the options part, \"[Q=90]\" in this case.
-- 
-- Useful for language bindings.
-- 
-- See also: 'GI.Vips.Functions.filenameGetFilename'.
filenameGetOptions ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@vipsFilename@/: a filename including a set of options
    -> m T.Text
    -- ^ __Returns:__ transfer full: just the options component.
filenameGetOptions :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
filenameGetOptions Text
vipsFilename = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
vipsFilename' <- Text -> IO CString
textToCString Text
vipsFilename
    CString
result <- CString -> IO CString
vips_filename_get_options CString
vipsFilename'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"filenameGetOptions" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
vipsFilename'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function filename_get_filename
-- Args: [ Arg
--           { argCName = "vips_filename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a filename including a set of options"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_filename_get_filename" vips_filename_get_filename :: 
    CString ->                              -- vips_filename : TBasicType TUTF8
    IO CString

-- | Given a vips filename like \"fred.jpg[Q=90]\", return a new string of
-- just the filename part, \"fred.jpg\" in this case.
-- 
-- Useful for language bindings.
-- 
-- See also: 'GI.Vips.Functions.filenameGetOptions'.
filenameGetFilename ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@vipsFilename@/: a filename including a set of options
    -> m T.Text
    -- ^ __Returns:__ transfer full: just the filename component.
filenameGetFilename :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
filenameGetFilename Text
vipsFilename = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
vipsFilename' <- Text -> IO CString
textToCString Text
vipsFilename
    CString
result <- CString -> IO CString
vips_filename_get_filename CString
vipsFilename'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"filenameGetFilename" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
vipsFilename'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function error_thaw
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_error_thaw" vips_error_thaw :: 
    IO ()

-- | Reenable error logging.
errorThaw ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
errorThaw :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
errorThaw  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_error_thaw
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function error_g
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : True
-- Skip return : False

foreign import ccall "vips_error_g" vips_error_g :: 
    Ptr (Ptr GError) ->                     -- error
    IO ()

-- | This function sets the glib error pointer from the vips error buffer and
-- clears it. It\'s handy for returning errors to glib functions from vips.
-- 
-- See 'GI.Vips.Functions.gError' for the inverse operation.
-- 
-- See also: @/g_set_error()/@, 'GI.Vips.Functions.gError'.
errorG ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
errorG :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
errorG  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO a
onException (do
        (Ptr (Ptr GError) -> IO ()) -> IO ()
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO ()) -> IO ())
-> (Ptr (Ptr GError) -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ Ptr (Ptr GError) -> IO ()
vips_error_g
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     ) (do
        () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
     )


-- function error_freeze
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_error_freeze" vips_error_freeze :: 
    IO ()

-- | Stop errors being logged. Use 'GI.Vips.Functions.errorThaw' to unfreeze. You can
-- nest freeze\/thaw pairs.
errorFreeze ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
errorFreeze :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
errorFreeze  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_error_freeze
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function error_clear
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_error_clear" vips_error_clear :: 
    IO ()

-- | Clear and reset the error buffer. This is typically called after presenting
-- an error to the user.
-- 
-- See also: 'GI.Vips.Functions.errorBuffer'.
errorClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
errorClear :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
errorClear  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_error_clear
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function error_buffer_copy
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_error_buffer_copy" vips_error_buffer_copy :: 
    IO CString

-- | Return a copy of the vips error buffer, and clear it.
errorBufferCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a copy of the libvips error buffer
errorBufferCopy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
errorBufferCopy  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vips_error_buffer_copy
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"errorBufferCopy" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function error_buffer
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "vips_error_buffer" vips_error_buffer :: 
    IO CString

-- | Get a pointer to the start of the error buffer as a C string.
-- The string is owned by the error system and must not be freed.
-- 
-- See also: 'GI.Vips.Functions.errorClear'.
errorBuffer ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ the error buffer as a C string which must not be freed
errorBuffer :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
errorBuffer  = IO Text -> m Text
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
vips_error_buffer
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"errorBuffer" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function concurrency_set
-- Args: [ Arg
--           { argCName = "concurrency"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of threads to run"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_concurrency_set" vips_concurrency_set :: 
    Int32 ->                                -- concurrency : TBasicType TInt
    IO ()

-- | Sets the number of worker threads that vips should use when running a
-- @/VipsThreadPool/@.
-- 
-- The special value 0 means \"default\". In this case, the number of threads is
-- set by the environment variable VIPS_CONCURRENCY, or if that is not set, the
-- number of threads available on the host machine.
-- 
-- See also: 'GI.Vips.Functions.concurrencyGet'.
concurrencySet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@concurrency@/: number of threads to run
    -> m ()
concurrencySet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m ()
concurrencySet Int32
concurrency = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Int32 -> IO ()
vips_concurrency_set Int32
concurrency
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function concurrency_get
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_concurrency_get" vips_concurrency_get :: 
    IO Int32

-- | Returns the number of worker threads that vips should use when running a
-- @/VipsThreadPool/@.
-- 
-- vips gets this values from these sources in turn:
-- 
-- If 'GI.Vips.Functions.concurrencySet' has been called, this value is used. The special
-- value 0 means \"default\". You can also use the command-line argument
-- \"--vips-concurrency\" to set this value.
-- 
-- If 'GI.Vips.Functions.concurrencySet' has not been called and no command-line argument
-- was used, vips uses the value of the environment variable VIPS_CONCURRENCY,
-- 
-- If VIPS_CONCURRENCY has not been set, vips finds the number of hardware
-- threads that the host machine can run in parallel and uses that value.
-- 
-- The final value is clipped to the range 1 - 1024.
-- 
-- See also: 'GI.Vips.Functions.concurrencyGet'.
concurrencyGet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ number of worker threads to use.
concurrencyGet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
concurrencyGet  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_concurrency_get
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_scRGB2sRGB_8
-- Args: [ Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "r"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "og"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_scRGB2sRGB_8" vips_col_scRGB2sRGB_8 :: 
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    Int32 ->                                -- r : TBasicType TInt
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- b : TBasicType TInt
    Int32 ->                                -- og : TBasicType TInt
    IO Int32

-- | /No description available in the introspection data./
colScRGB2sRGB8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -> Float
    -> Float
    -> Int32
    -> Int32
    -> Int32
    -> Int32
    -> m Int32
colScRGB2sRGB8 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float
-> Float -> Float -> Int32 -> Int32 -> Int32 -> Int32 -> m Int32
colScRGB2sRGB8 Float
r_ Float
g_ Float
b_ Int32
r Int32
g Int32
b Int32
og = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- CFloat
-> CFloat -> CFloat -> Int32 -> Int32 -> Int32 -> Int32 -> IO Int32
vips_col_scRGB2sRGB_8 CFloat
r_' CFloat
g_' CFloat
b_' Int32
r Int32
g Int32
b Int32
og
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_scRGB2sRGB_16
-- Args: [ Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "r"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "og"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_scRGB2sRGB_16" vips_col_scRGB2sRGB_16 :: 
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    Int32 ->                                -- r : TBasicType TInt
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- b : TBasicType TInt
    Int32 ->                                -- og : TBasicType TInt
    IO Int32

-- | /No description available in the introspection data./
colScRGB2sRGB16 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -> Float
    -> Float
    -> Int32
    -> Int32
    -> Int32
    -> Int32
    -> m Int32
colScRGB2sRGB16 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float
-> Float -> Float -> Int32 -> Int32 -> Int32 -> Int32 -> m Int32
colScRGB2sRGB16 Float
r_ Float
g_ Float
b_ Int32
r Int32
g Int32
b Int32
og = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- CFloat
-> CFloat -> CFloat -> Int32 -> Int32 -> Int32 -> Int32 -> IO Int32
vips_col_scRGB2sRGB_16 CFloat
r_' CFloat
g_' CFloat
b_' Int32
r Int32
g Int32
b Int32
og
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_scRGB2XYZ
-- Args: [ Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input scRGB value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input scRGB value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input scRGB value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "X_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return XYZ colour" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "Y_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return XYZ colour" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "Z_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return XYZ colour" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_scRGB2XYZ" vips_col_scRGB2XYZ :: 
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    Ptr CFloat ->                           -- X_ : TBasicType TFloat
    Ptr CFloat ->                           -- Y_ : TBasicType TFloat
    Ptr CFloat ->                           -- Z_ : TBasicType TFloat
    IO Int32

-- | Turn scRGB into XYZ.
-- 
-- See also: @/vips_scRGB2XYZ()/@.
colScRGB2XYZ ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@r_@/: Input scRGB value
    -> Float
    -- ^ /@g_@/: Input scRGB value
    -> Float
    -- ^ /@b_@/: Input scRGB value
    -> m ((Int32, Float, Float, Float))
colScRGB2XYZ :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> m (Int32, Float, Float, Float)
colScRGB2XYZ Float
r_ Float
g_ Float
b_ = IO (Int32, Float, Float, Float) -> m (Int32, Float, Float, Float)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Float, Float, Float) -> m (Int32, Float, Float, Float))
-> IO (Int32, Float, Float, Float)
-> m (Int32, Float, Float, Float)
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Ptr CFloat
x_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
y_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
z_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Int32
result <- CFloat
-> CFloat
-> CFloat
-> Ptr CFloat
-> Ptr CFloat
-> Ptr CFloat
-> IO Int32
vips_col_scRGB2XYZ CFloat
r_' CFloat
g_' CFloat
b_' Ptr CFloat
x_ Ptr CFloat
y_ Ptr CFloat
z_
    CFloat
x_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
x_
    let x_'' :: Float
x_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x_'
    CFloat
y_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
y_
    let y_'' :: Float
y_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y_'
    CFloat
z_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
z_
    let z_'' :: Float
z_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z_'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
x_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
y_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
z_
    (Int32, Float, Float, Float) -> IO (Int32, Float, Float, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
result, Float
x_'', Float
y_'', Float
z_'')


-- function col_scRGB2BW_8
-- Args: [ Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "og"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_scRGB2BW_8" vips_col_scRGB2BW_8 :: 
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- og : TBasicType TInt
    IO Int32

-- | /No description available in the introspection data./
colScRGB2BW8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -> Float
    -> Float
    -> Int32
    -> Int32
    -> m Int32
colScRGB2BW8 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Int32 -> Int32 -> m Int32
colScRGB2BW8 Float
r_ Float
g_ Float
b_ Int32
g Int32
og = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- CFloat -> CFloat -> CFloat -> Int32 -> Int32 -> IO Int32
vips_col_scRGB2BW_8 CFloat
r_' CFloat
g_' CFloat
b_' Int32
g Int32
og
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_scRGB2BW_16
-- Args: [ Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "og"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_scRGB2BW_16" vips_col_scRGB2BW_16 :: 
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- og : TBasicType TInt
    IO Int32

-- | /No description available in the introspection data./
colScRGB2BW16 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -> Float
    -> Float
    -> Int32
    -> Int32
    -> m Int32
colScRGB2BW16 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Int32 -> Int32 -> m Int32
colScRGB2BW16 Float
r_ Float
g_ Float
b_ Int32
g Int32
og = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- CFloat -> CFloat -> CFloat -> Int32 -> Int32 -> IO Int32
vips_col_scRGB2BW_16 CFloat
r_' CFloat
g_' CFloat
b_' Int32
g Int32
og
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_sRGB2scRGB_8_noclip
-- XXX Could not generate function col_sRGB2scRGB_8_noclip

-- Bad introspection data: Could not resolve the symbol “vips_col_sRGB2scRGB_8_noclip” in the “Vips” namespace, ignoring.

-- function col_sRGB2scRGB_8
-- Args: [ Arg
--           { argCName = "r"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_sRGB2scRGB_8" vips_col_sRGB2scRGB_8 :: 
    Int32 ->                                -- r : TBasicType TInt
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- b : TBasicType TInt
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    IO Int32

-- | /No description available in the introspection data./
colSRGB2scRGB8 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -> Int32
    -> Int32
    -> Float
    -> Float
    -> Float
    -> m Int32
colSRGB2scRGB8 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> Int32 -> Int32 -> Float -> Float -> Float -> m Int32
colSRGB2scRGB8 Int32
r Int32
g Int32
b Float
r_ Float
g_ Float
b_ = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- Int32 -> Int32 -> Int32 -> CFloat -> CFloat -> CFloat -> IO Int32
vips_col_sRGB2scRGB_8 Int32
r Int32
g Int32
b CFloat
r_' CFloat
g_' CFloat
b_'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_sRGB2scRGB_16_noclip
-- XXX Could not generate function col_sRGB2scRGB_16_noclip

-- Bad introspection data: Could not resolve the symbol “vips_col_sRGB2scRGB_16_noclip” in the “Vips” namespace, ignoring.

-- function col_sRGB2scRGB_16
-- Args: [ Arg
--           { argCName = "r"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "g"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_sRGB2scRGB_16" vips_col_sRGB2scRGB_16 :: 
    Int32 ->                                -- r : TBasicType TInt
    Int32 ->                                -- g : TBasicType TInt
    Int32 ->                                -- b : TBasicType TInt
    CFloat ->                               -- R_ : TBasicType TFloat
    CFloat ->                               -- G_ : TBasicType TFloat
    CFloat ->                               -- B_ : TBasicType TFloat
    IO Int32

-- | /No description available in the introspection data./
colSRGB2scRGB16 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -> Int32
    -> Int32
    -> Float
    -> Float
    -> Float
    -> m Int32
colSRGB2scRGB16 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> Int32 -> Int32 -> Float -> Float -> Float -> m Int32
colSRGB2scRGB16 Int32
r Int32
g Int32
b Float
r_ Float
g_ Float
b_ = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let r_' :: CFloat
r_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
r_
    let g_' :: CFloat
g_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
g_
    let b_' :: CFloat
b_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b_
    Int32
result <- Int32 -> Int32 -> Int32 -> CFloat -> CFloat -> CFloat -> IO Int32
vips_col_sRGB2scRGB_16 Int32
r Int32
g Int32
b CFloat
r_' CFloat
g_' CFloat
b_'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function col_make_tables_CMC
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_make_tables_CMC" vips_col_make_tables_CMC :: 
    IO ()

-- | Make the lookup tables for cmc.
colMakeTablesCMC ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
colMakeTablesCMC :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
colMakeTablesCMC  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_col_make_tables_CMC
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function col_dE00
-- Args: [ Arg
--           { argCName = "L1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b1"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 1" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "L2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b2"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input coordinate 2" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_dE00" vips_col_dE00 :: 
    CFloat ->                               -- L1 : TBasicType TFloat
    CFloat ->                               -- a1 : TBasicType TFloat
    CFloat ->                               -- b1 : TBasicType TFloat
    CFloat ->                               -- L2 : TBasicType TFloat
    CFloat ->                               -- a2 : TBasicType TFloat
    CFloat ->                               -- b2 : TBasicType TFloat
    IO CFloat

-- | CIEDE2000, from:
-- 
-- Luo, Cui, Rigg, \"The Development of the CIE 2000 Colour-Difference
-- Formula: CIEDE2000\", COLOR research and application, pp 340
colDE00 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@l1@/: Input coordinate 1
    -> Float
    -- ^ /@a1@/: Input coordinate 1
    -> Float
    -- ^ /@b1@/: Input coordinate 1
    -> Float
    -- ^ /@l2@/: Input coordinate 2
    -> Float
    -- ^ /@a2@/: Input coordinate 2
    -> Float
    -- ^ /@b2@/: Input coordinate 2
    -> m Float
    -- ^ __Returns:__ CIE dE2000 colour difference.
colDE00 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Float -> Float -> Float -> m Float
colDE00 Float
l1 Float
a1 Float
b1 Float
l2 Float
a2 Float
b2 = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let l1' :: CFloat
l1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l1
    let a1' :: CFloat
a1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a1
    let b1' :: CFloat
b1' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b1
    let l2' :: CFloat
l2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l2
    let a2' :: CFloat
a2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a2
    let b2' :: CFloat
b2' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b2
    CFloat
result <- CFloat
-> CFloat -> CFloat -> CFloat -> CFloat -> CFloat -> IO CFloat
vips_col_dE00 CFloat
l1' CFloat
a1' CFloat
b1' CFloat
l2' CFloat
a2' CFloat
b2'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_ab2h
-- Args: [ Arg
--           { argCName = "a"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "CIE a" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "CIE b" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_ab2h" vips_col_ab2h :: 
    CDouble ->                              -- a : TBasicType TDouble
    CDouble ->                              -- b : TBasicType TDouble
    IO CDouble

-- | /No description available in the introspection data./
colAb2h ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -- ^ /@a@/: CIE a
    -> Double
    -- ^ /@b@/: CIE b
    -> m Double
    -- ^ __Returns:__ Hue (degrees)
colAb2h :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Double -> Double -> m Double
colAb2h Double
a Double
b = IO Double -> m Double
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
    let a' :: CDouble
a' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
a
    let b' :: CDouble
b' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
b
    CDouble
result <- CDouble -> CDouble -> IO CDouble
vips_col_ab2h CDouble
a' CDouble
b'
    let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'


-- function col_ab2Ch
-- Args: [ Arg
--           { argCName = "a"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "C_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "h"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_ab2Ch" vips_col_ab2Ch :: 
    CFloat ->                               -- a : TBasicType TFloat
    CFloat ->                               -- b : TBasicType TFloat
    CFloat ->                               -- C_ : TBasicType TFloat
    CFloat ->                               -- h : TBasicType TFloat
    IO ()

-- | /No description available in the introspection data./
colAb2Ch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -> Float
    -> Float
    -> Float
    -> m ()
colAb2Ch :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Float -> m ()
colAb2Ch Float
a Float
b Float
c_ Float
h = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let a' :: CFloat
a' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a
    let b' :: CFloat
b' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b
    let c_' :: CFloat
c_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
c_
    let h' :: CFloat
h' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
h
    CFloat -> CFloat -> CFloat -> CFloat -> IO ()
vips_col_ab2Ch CFloat
a' CFloat
b' CFloat
c_' CFloat
h'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function col_XYZ2scRGB
-- Args: [ Arg
--           { argCName = "X_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input XYZ value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "Y_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input XYZ value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "Z_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input XYZ value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "R_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return scRGB colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "G_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return scRGB colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "B_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return scRGB colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_XYZ2scRGB" vips_col_XYZ2scRGB :: 
    CFloat ->                               -- X_ : TBasicType TFloat
    CFloat ->                               -- Y_ : TBasicType TFloat
    CFloat ->                               -- Z_ : TBasicType TFloat
    Ptr CFloat ->                           -- R_ : TBasicType TFloat
    Ptr CFloat ->                           -- G_ : TBasicType TFloat
    Ptr CFloat ->                           -- B_ : TBasicType TFloat
    IO Int32

-- | Turn XYZ into scRGB.
-- 
-- See also: @/vips_XYZ2scRGB()/@.
colXYZ2scRGB ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@x_@/: Input XYZ value
    -> Float
    -- ^ /@y_@/: Input XYZ value
    -> Float
    -- ^ /@z_@/: Input XYZ value
    -> m ((Int32, Float, Float, Float))
colXYZ2scRGB :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> m (Int32, Float, Float, Float)
colXYZ2scRGB Float
x_ Float
y_ Float
z_ = IO (Int32, Float, Float, Float) -> m (Int32, Float, Float, Float)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Float, Float, Float) -> m (Int32, Float, Float, Float))
-> IO (Int32, Float, Float, Float)
-> m (Int32, Float, Float, Float)
forall a b. (a -> b) -> a -> b
$ do
    let x_' :: CFloat
x_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x_
    let y_' :: CFloat
y_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y_
    let z_' :: CFloat
z_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z_
    Ptr CFloat
r_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
g_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
b_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Int32
result <- CFloat
-> CFloat
-> CFloat
-> Ptr CFloat
-> Ptr CFloat
-> Ptr CFloat
-> IO Int32
vips_col_XYZ2scRGB CFloat
x_' CFloat
y_' CFloat
z_' Ptr CFloat
r_ Ptr CFloat
g_ Ptr CFloat
b_
    CFloat
r_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
r_
    let r_'' :: Float
r_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
r_'
    CFloat
g_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
g_
    let g_'' :: Float
g_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
g_'
    CFloat
b_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
b_
    let b_'' :: Float
b_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
b_'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
r_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
g_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
b_
    (Int32, Float, Float, Float) -> IO (Int32, Float, Float, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
result, Float
r_'', Float
g_'', Float
b_'')


-- function col_XYZ2Lab
-- Args: [ Arg
--           { argCName = "X_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "Y_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "Z_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "L_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_XYZ2Lab" vips_col_XYZ2Lab :: 
    CFloat ->                               -- X_ : TBasicType TFloat
    CFloat ->                               -- Y_ : TBasicType TFloat
    CFloat ->                               -- Z_ : TBasicType TFloat
    Ptr CFloat ->                           -- L_ : TBasicType TFloat
    Ptr CFloat ->                           -- a : TBasicType TFloat
    Ptr CFloat ->                           -- b : TBasicType TFloat
    IO ()

-- | Calculate XYZ from Lab, D65.
-- 
-- See also: @/vips_XYZ2Lab()/@.
colXYZ2Lab ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@x_@/: Input CIE XYZ colour
    -> Float
    -- ^ /@y_@/: Input CIE XYZ colour
    -> Float
    -- ^ /@z_@/: Input CIE XYZ colour
    -> m ((Float, Float, Float))
colXYZ2Lab :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> m (Float, Float, Float)
colXYZ2Lab Float
x_ Float
y_ Float
z_ = IO (Float, Float, Float) -> m (Float, Float, Float)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Float, Float, Float) -> m (Float, Float, Float))
-> IO (Float, Float, Float) -> m (Float, Float, Float)
forall a b. (a -> b) -> a -> b
$ do
    let x_' :: CFloat
x_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
x_
    let y_' :: CFloat
y_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
y_
    let z_' :: CFloat
z_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
z_
    Ptr CFloat
l_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
a <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
b <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    CFloat
-> CFloat
-> CFloat
-> Ptr CFloat
-> Ptr CFloat
-> Ptr CFloat
-> IO ()
vips_col_XYZ2Lab CFloat
x_' CFloat
y_' CFloat
z_' Ptr CFloat
l_ Ptr CFloat
a Ptr CFloat
b
    CFloat
l_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
l_
    let l_'' :: Float
l_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
l_'
    CFloat
a' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
a
    let a'' :: Float
a'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
a'
    CFloat
b' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
b
    let b'' :: Float
b'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
b'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
l_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
a
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
b
    (Float, Float, Float) -> IO (Float, Float, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Float
l_'', Float
a'', Float
b'')


-- function col_Lcmc2L
-- Args: [ Arg
--           { argCName = "Lcmc"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "L cmc" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Lcmc2L" vips_col_Lcmc2L :: 
    CFloat ->                               -- Lcmc : TBasicType TFloat
    IO CFloat

-- | Calculate L from Lcmc using a table. Call 'GI.Vips.Functions.colMakeTablesCMC' at
-- least once before using this function.
colLcmc2L ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@lcmc@/: L cmc
    -> m Float
    -- ^ __Returns:__ L*
colLcmc2L :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Float -> m Float
colLcmc2L Float
lcmc = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let lcmc' :: CFloat
lcmc' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
lcmc
    CFloat
result <- CFloat -> IO CFloat
vips_col_Lcmc2L CFloat
lcmc'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_Lab2XYZ
-- Args: [ Arg
--           { argCName = "L_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Input CIE Lab value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "X_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "Y_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "Z_"
--           , argType = TBasicType TFloat
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Return CIE XYZ colour"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Lab2XYZ" vips_col_Lab2XYZ :: 
    CFloat ->                               -- L_ : TBasicType TFloat
    CFloat ->                               -- a : TBasicType TFloat
    CFloat ->                               -- b : TBasicType TFloat
    Ptr CFloat ->                           -- X_ : TBasicType TFloat
    Ptr CFloat ->                           -- Y_ : TBasicType TFloat
    Ptr CFloat ->                           -- Z_ : TBasicType TFloat
    IO ()

-- | Calculate XYZ from Lab, D65.
-- 
-- See also: @/vips_Lab2XYZ()/@.
colLab2XYZ ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@l_@/: Input CIE Lab value
    -> Float
    -- ^ /@a@/: Input CIE Lab value
    -> Float
    -- ^ /@b@/: Input CIE Lab value
    -> m ((Float, Float, Float))
colLab2XYZ :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> m (Float, Float, Float)
colLab2XYZ Float
l_ Float
a Float
b = IO (Float, Float, Float) -> m (Float, Float, Float)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Float, Float, Float) -> m (Float, Float, Float))
-> IO (Float, Float, Float) -> m (Float, Float, Float)
forall a b. (a -> b) -> a -> b
$ do
    let l_' :: CFloat
l_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l_
    let a' :: CFloat
a' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a
    let b' :: CFloat
b' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b
    Ptr CFloat
x_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
y_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    Ptr CFloat
z_ <- IO (Ptr CFloat)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CFloat)
    CFloat
-> CFloat
-> CFloat
-> Ptr CFloat
-> Ptr CFloat
-> Ptr CFloat
-> IO ()
vips_col_Lab2XYZ CFloat
l_' CFloat
a' CFloat
b' Ptr CFloat
x_ Ptr CFloat
y_ Ptr CFloat
z_
    CFloat
x_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
x_
    let x_'' :: Float
x_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
x_'
    CFloat
y_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
y_
    let y_'' :: Float
y_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
y_'
    CFloat
z_' <- Ptr CFloat -> IO CFloat
forall a. Storable a => Ptr a -> IO a
peek Ptr CFloat
z_
    let z_'' :: Float
z_'' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
z_'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
x_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
y_
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
z_
    (Float, Float, Float) -> IO (Float, Float, Float)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Float
x_'', Float
y_'', Float
z_'')


-- function col_L2Lcmc
-- Args: [ Arg
--           { argCName = "L_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "CIE L*" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_L2Lcmc" vips_col_L2Lcmc :: 
    CFloat ->                               -- L_ : TBasicType TFloat
    IO CFloat

-- | Calculate Lcmc from L.
colL2Lcmc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@l_@/: CIE L*
    -> m Float
    -- ^ __Returns:__ Lcmc
colL2Lcmc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Float -> m Float
colL2Lcmc Float
l_ = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let l_' :: CFloat
l_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
l_
    CFloat
result <- CFloat -> IO CFloat
vips_col_L2Lcmc CFloat
l_'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_Chcmc2h
-- Args: [ Arg
--           { argCName = "C_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Chroma" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "hcmc"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Hue cmc (degrees)" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Chcmc2h" vips_col_Chcmc2h :: 
    CFloat ->                               -- C_ : TBasicType TFloat
    CFloat ->                               -- hcmc : TBasicType TFloat
    IO CFloat

-- | Calculate h from C and hcmc, using a table.
-- Call 'GI.Vips.Functions.colMakeTablesCMC' at
-- least once before using this function.
colChcmc2h ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@c_@/: Chroma
    -> Float
    -- ^ /@hcmc@/: Hue cmc (degrees)
    -> m Float
    -- ^ __Returns:__ h.
colChcmc2h :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> m Float
colChcmc2h Float
c_ Float
hcmc = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let c_' :: CFloat
c_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
c_
    let hcmc' :: CFloat
hcmc' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
hcmc
    CFloat
result <- CFloat -> CFloat -> IO CFloat
vips_col_Chcmc2h CFloat
c_' CFloat
hcmc'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_Ch2hcmc
-- Args: [ Arg
--           { argCName = "C_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Chroma" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "h"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Hue (degrees)" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Ch2hcmc" vips_col_Ch2hcmc :: 
    CFloat ->                               -- C_ : TBasicType TFloat
    CFloat ->                               -- h : TBasicType TFloat
    IO CFloat

-- | Calculate hcmc from C and h.
colCh2hcmc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@c_@/: Chroma
    -> Float
    -- ^ /@h@/: Hue (degrees)
    -> m Float
    -- ^ __Returns:__ hcmc.
colCh2hcmc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> m Float
colCh2hcmc Float
c_ Float
h = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let c_' :: CFloat
c_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
c_
    let h' :: CFloat
h' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
h
    CFloat
result <- CFloat -> CFloat -> IO CFloat
vips_col_Ch2hcmc CFloat
c_' CFloat
h'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_Ch2ab
-- Args: [ Arg
--           { argCName = "C_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Chroma" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "h"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Hue angle (degrees)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return CIE a* value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return CIE b* value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Ch2ab" vips_col_Ch2ab :: 
    CFloat ->                               -- C_ : TBasicType TFloat
    CFloat ->                               -- h : TBasicType TFloat
    CFloat ->                               -- a : TBasicType TFloat
    CFloat ->                               -- b : TBasicType TFloat
    IO ()

-- | Calculate ab from Ch, h in degrees.
colCh2ab ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@c_@/: Chroma
    -> Float
    -- ^ /@h@/: Hue angle (degrees)
    -> Float
    -- ^ /@a@/: return CIE a* value
    -> Float
    -- ^ /@b@/: return CIE b* value
    -> m ()
colCh2ab :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Float -> Float -> Float -> Float -> m ()
colCh2ab Float
c_ Float
h Float
a Float
b = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let c_' :: CFloat
c_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
c_
    let h' :: CFloat
h' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
h
    let a' :: CFloat
a' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
a
    let b' :: CFloat
b' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
b
    CFloat -> CFloat -> CFloat -> CFloat -> IO ()
vips_col_Ch2ab CFloat
c_' CFloat
h' CFloat
a' CFloat
b'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function col_Ccmc2C
-- Args: [ Arg
--           { argCName = "Ccmc"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Just "Ccmc" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_Ccmc2C" vips_col_Ccmc2C :: 
    CFloat ->                               -- Ccmc : TBasicType TFloat
    IO CFloat

-- | Calculate C from Ccmc using a table.
-- Call 'GI.Vips.Functions.colMakeTablesCMC' at
-- least once before using this function.
colCcmc2C ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@ccmc@/: Ccmc
    -> m Float
    -- ^ __Returns:__ C.
colCcmc2C :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Float -> m Float
colCcmc2C Float
ccmc = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let ccmc' :: CFloat
ccmc' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
ccmc
    CFloat
result <- CFloat -> IO CFloat
vips_col_Ccmc2C CFloat
ccmc'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function col_C2Ccmc
-- Args: [ Arg
--           { argCName = "C_"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Chroma" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "vips_col_C2Ccmc" vips_col_C2Ccmc :: 
    CFloat ->                               -- C_ : TBasicType TFloat
    IO CFloat

-- | Calculate Ccmc from C.
colC2Ccmc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Float
    -- ^ /@c_@/: Chroma
    -> m Float
    -- ^ __Returns:__ Ccmc.
colC2Ccmc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Float -> m Float
colC2Ccmc Float
c_ = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    let c_' :: CFloat
c_' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
c_
    CFloat
result <- CFloat -> IO CFloat
vips_col_C2Ccmc CFloat
c_'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Float -> IO Float
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'


-- function class_find
-- Args: [ Arg
--           { argCName = "basename"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "name of base class" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "nickname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "search for a class with this nickname"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Vips" , name = "ObjectClass" })
-- throws : False
-- Skip return : False

foreign import ccall "vips_class_find" vips_class_find :: 
    CString ->                              -- basename : TBasicType TUTF8
    CString ->                              -- nickname : TBasicType TUTF8
    IO (Ptr Vips.ObjectClass.ObjectClass)

-- | Search below /@basename@/, return the first class whose name or /@nickname@/
-- matches.
-- 
-- See also: 'GI.Vips.Functions.typeFind'
classFind ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@basename@/: name of base class
    -> T.Text
    -- ^ /@nickname@/: search for a class with this nickname
    -> m Vips.ObjectClass.ObjectClass
    -- ^ __Returns:__ the found class.
classFind :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Text -> m ObjectClass
classFind Text
basename Text
nickname = IO ObjectClass -> m ObjectClass
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ObjectClass -> m ObjectClass)
-> IO ObjectClass -> m ObjectClass
forall a b. (a -> b) -> a -> b
$ do
    CString
basename' <- Text -> IO CString
textToCString Text
basename
    CString
nickname' <- Text -> IO CString
textToCString Text
nickname
    Ptr ObjectClass
result <- CString -> CString -> IO (Ptr ObjectClass)
vips_class_find CString
basename' CString
nickname'
    Text -> Ptr ObjectClass -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"classFind" Ptr ObjectClass
result
    ObjectClass
result' <- ((ManagedPtr ObjectClass -> ObjectClass)
-> Ptr ObjectClass -> IO ObjectClass
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr ObjectClass -> ObjectClass
Vips.ObjectClass.ObjectClass) Ptr ObjectClass
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
basename'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
nickname'
    ObjectClass -> IO ObjectClass
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ObjectClass
result'


-- function check_vector_length
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of elements in vector"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of elements vector should have"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_vector_length" vips_check_vector_length :: 
    CString ->                              -- domain : TBasicType TUTF8
    Int32 ->                                -- n : TBasicType TInt
    Int32 ->                                -- len : TBasicType TInt
    IO Int32

-- | Check that /@n@/ == /@len@/.
-- 
-- See also: @/vips_error()/@.
checkVectorLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> Int32
    -- ^ /@n@/: number of elements in vector
    -> Int32
    -- ^ /@len@/: number of elements vector should have
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkVectorLength :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Int32 -> Int32 -> m Int32
checkVectorLength Text
domain Int32
n Int32
len = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Int32
result <- CString -> Int32 -> Int32 -> IO Int32
vips_check_vector_length CString
domain' Int32
n Int32
len
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_vector
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of elements in vector"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check against"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_vector" vips_check_vector :: 
    CString ->                              -- domain : TBasicType TUTF8
    Int32 ->                                -- n : TBasicType TInt
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Operations with a vector constant need a 1-element vector, or a vector with
-- the same number of elements as there are bands in the image, or a 1-band
-- image and a many-element vector.
-- 
-- See also: @/vips_error()/@.
checkVector ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> Int32
    -- ^ /@n@/: number of elements in vector
    -> a
    -- ^ /@im@/: image to check against
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkVector :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> Int32 -> a -> m Int32
checkVector Text
domain Int32
n a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Int32 -> Ptr Image -> IO Int32
vips_check_vector CString
domain' Int32
n Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_uncoded
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_uncoded" vips_check_uncoded :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is not coded.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkUncoded ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkUncoded :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkUncoded Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_uncoded CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_uintorf
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_uintorf" vips_check_uintorf :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is unsigned int or float.
-- Otherwise set an error message and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkUintorf ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkUintorf :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkUintorf Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_uintorf CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_uint
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_uint" vips_check_uint :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is in one of the unsigned integer formats.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkUint ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkUint :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkUint Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_uint CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_u8or16orf
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_u8or16orf" vips_check_u8or16orf :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is 8 or 16-bit unsigned integer, or float.
-- Otherwise set an error message and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkU8or16orf ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkU8or16orf :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkU8or16orf Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_u8or16orf CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_u8or16
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_u8or16" vips_check_u8or16 :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is 8 or 16-bit unsigned integer.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkU8or16 ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkU8or16 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkU8or16 Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_u8or16 CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_twocomponents
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_twocomponents" vips_check_twocomponents :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is has two \"components\", ie. is a one-band complex or
-- a two-band non-complex.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkTwocomponents ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkTwocomponents :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkTwocomponents Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_twocomponents CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_size_same
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im1"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im2"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_size_same" vips_check_size_same :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im1 : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr Vips.Image.Image ->                 -- im2 : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the images have the same size.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkSizeSame ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a, Vips.Image.IsImage b) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im1@/: first image to check
    -> b
    -- ^ /@im2@/: second image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkSizeSame :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsImage a, IsImage b) =>
Text -> a -> b -> m Int32
checkSizeSame Text
domain a
im1 b
im2 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im1' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im1
    Ptr Image
im2' <- b -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
im2
    Int32
result <- CString -> Ptr Image -> Ptr Image -> IO Int32
vips_check_size_same CString
domain' Ptr Image
im1' Ptr Image
im2'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im1
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
im2
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_separable
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_separable" vips_check_separable :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Separable matrix images must have width or height 1.
-- Return 0 if the image will pass, or -1 and
-- set an error message otherwise.
-- 
-- See also: @/vips_error()/@.
checkSeparable ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkSeparable :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkSeparable Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_separable CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_precision_intfloat
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "precision"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Precision" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "precision to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_precision_intfloat" vips_check_precision_intfloat :: 
    CString ->                              -- domain : TBasicType TUTF8
    CUInt ->                                -- precision : TInterface (Name {namespace = "Vips", name = "Precision"})
    IO Int32

-- | Check that /@prec@/ image is either float or int.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkPrecisionIntfloat ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> Vips.Enums.Precision
    -- ^ /@precision@/: precision to check
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkPrecisionIntfloat :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Text -> Precision -> m Int32
checkPrecisionIntfloat Text
domain Precision
precision = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    let precision' :: CUInt
precision' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Precision -> Int) -> Precision -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Precision -> Int
forall a. Enum a => a -> Int
fromEnum) Precision
precision
    Int32
result <- CString -> CUInt -> IO Int32
vips_check_precision_intfloat CString
domain' CUInt
precision'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_oddsquare
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_oddsquare" vips_check_oddsquare :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is square and that the sides are odd.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkOddsquare ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkOddsquare :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkOddsquare Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_oddsquare CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_noncomplex
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_noncomplex" vips_check_noncomplex :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is not complex.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkNoncomplex ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkNoncomplex :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkNoncomplex Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_noncomplex CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_mono
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_mono" vips_check_mono :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image has exactly one band.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkMono ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkMono :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkMono Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_mono CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_matrix
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "out"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "put image as in-memory doubles here"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_matrix" vips_check_matrix :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr (Ptr Vips.Image.Image) ->           -- out : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Matrix images must have width and height less than 100000 and have 1 band.
-- 
-- Return 0 if the image will pass as a matrix, or -1 and set an error
-- message otherwise.
-- 
-- /@out@/ is set to be /@im@/ cast to double and stored in memory. Use
-- @/VIPS_MATRIX()/@ to address values in /@out@/.
-- 
-- You must unref /@out@/ when you are done with it.
-- 
-- See also: @/VIPS_MATRIX()/@, @/vips_object_local()/@
checkMatrix ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m ((Int32, Vips.Image.Image))
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkMatrix :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m (Int32, Image)
checkMatrix Text
domain a
im = IO (Int32, Image) -> m (Int32, Image)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Image) -> m (Int32, Image))
-> IO (Int32, Image) -> m (Int32, Image)
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Ptr (Ptr Image)
out <- IO (Ptr (Ptr Image))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Vips.Image.Image))
    Int32
result <- CString -> Ptr Image -> Ptr (Ptr Image) -> IO Int32
vips_check_matrix CString
domain' Ptr Image
im' Ptr (Ptr Image)
out
    Ptr Image
out' <- Ptr (Ptr Image) -> IO (Ptr Image)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Image)
out
    Image
out'' <- ((ManagedPtr Image -> Image) -> Ptr Image -> IO Image
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Image -> Image
Vips.Image.Image) Ptr Image
out'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Ptr (Ptr Image) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Image)
out
    (Int32, Image) -> IO (Int32, Image)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
result, Image
out'')


-- function check_int
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_int" vips_check_int :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is in one of the integer formats.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkInt ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkInt :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkInt Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_int CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_hist
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_hist" vips_check_hist :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Histogram images must have width or height 1, and must not have more than
-- 65536 elements. Return 0 if the image will pass as a histogram, or -1 and
-- set an error message otherwise.
-- 
-- See also: @/vips_error()/@.
checkHist ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkHist :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkHist Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_hist CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_format_same
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im1"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im2"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_format_same" vips_check_format_same :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im1 : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr Vips.Image.Image ->                 -- im2 : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the images have the same format.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkFormatSame ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a, Vips.Image.IsImage b) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im1@/: first image to check
    -> b
    -- ^ /@im2@/: second image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkFormatSame :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsImage a, IsImage b) =>
Text -> a -> b -> m Int32
checkFormatSame Text
domain a
im1 b
im2 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im1' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im1
    Ptr Image
im2' <- b -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
im2
    Int32
result <- CString -> Ptr Image -> Ptr Image -> IO Int32
vips_check_format_same CString
domain' Ptr Image
im1' Ptr Image
im2'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im1
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
im2
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_format
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "fmt"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "BandFormat" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "format to test for" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_format" vips_check_format :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    CInt ->                                 -- fmt : TInterface (Name {namespace = "Vips", name = "BandFormat"})
    IO Int32

-- | Check that the image has the specified format.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkFormat ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Vips.Enums.BandFormat
    -- ^ /@fmt@/: format to test for
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkFormat :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> BandFormat -> m Int32
checkFormat Text
domain a
im BandFormat
fmt = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    let fmt' :: CInt
fmt' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (BandFormat -> Int) -> BandFormat -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BandFormat -> Int
forall a. Enum a => a -> Int
fromEnum) BandFormat
fmt
    Int32
result <- CString -> Ptr Image -> CInt -> IO Int32
vips_check_format CString
domain' Ptr Image
im' CInt
fmt'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_complex
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_complex" vips_check_complex :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is complex.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkComplex ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkComplex :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkComplex Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_complex CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_coding_same
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im1"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im2"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_coding_same" vips_check_coding_same :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im1 : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr Vips.Image.Image ->                 -- im2 : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the images have the same coding.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkCodingSame ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a, Vips.Image.IsImage b) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im1@/: first image to check
    -> b
    -- ^ /@im2@/: second image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkCodingSame :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsImage a, IsImage b) =>
Text -> a -> b -> m Int32
checkCodingSame Text
domain a
im1 b
im2 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im1' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im1
    Ptr Image
im2' <- b -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
im2
    Int32
result <- CString -> Ptr Image -> Ptr Image -> IO Int32
vips_check_coding_same CString
domain' Ptr Image
im1' Ptr Image
im2'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im1
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
im2
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_coding_noneorlabq
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_coding_noneorlabq" vips_check_coding_noneorlabq :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is uncoded or LABQ coded.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkCodingNoneorlabq ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkCodingNoneorlabq :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkCodingNoneorlabq Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_coding_noneorlabq CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_coding_known
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_coding_known" vips_check_coding_known :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is uncoded, LABQ coded or RAD coded.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkCodingKnown ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkCodingKnown :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkCodingKnown Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_coding_known CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_coding
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coding"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Coding" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "required coding" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_coding" vips_check_coding :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    CInt ->                                 -- coding : TInterface (Name {namespace = "Vips", name = "Coding"})
    IO Int32

-- | Check that the image has the required /@coding@/.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkCoding ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Vips.Enums.Coding
    -- ^ /@coding@/: required coding
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkCoding :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> Coding -> m Int32
checkCoding Text
domain a
im Coding
coding = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    let coding' :: CInt
coding' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Coding -> Int) -> Coding -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Coding -> Int
forall a. Enum a => a -> Int
fromEnum) Coding
coding
    Int32
result <- CString -> Ptr Image -> CInt -> IO Int32
vips_check_coding CString
domain' Ptr Image
im' CInt
coding'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands_same
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im1"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im2"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands_same" vips_check_bands_same :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im1 : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr Vips.Image.Image ->                 -- im2 : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the images have the same number of bands.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBandsSame ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a, Vips.Image.IsImage b) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im1@/: first image to check
    -> b
    -- ^ /@im2@/: second image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkBandsSame :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsImage a, IsImage b) =>
Text -> a -> b -> m Int32
checkBandsSame Text
domain a
im1 b
im2 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im1' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im1
    Ptr Image
im2' <- b -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
im2
    Int32
result <- CString -> Ptr Image -> Ptr Image -> IO Int32
vips_check_bands_same CString
domain' Ptr Image
im1' Ptr Image
im2'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im1
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
im2
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands_atleast
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bands"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "at least this many bands"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands_atleast" vips_check_bands_atleast :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    Int32 ->                                -- bands : TBasicType TInt
    IO Int32

-- | Check that the image has at least /@bands@/ bands.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBandsAtleast ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Int32
    -- ^ /@bands@/: at least this many bands
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkBandsAtleast :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> Int32 -> m Int32
checkBandsAtleast Text
domain a
im Int32
bands = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> Int32 -> IO Int32
vips_check_bands_atleast CString
domain' Ptr Image
im' Int32
bands
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands_1orn_unary
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "number of bands, or 1"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands_1orn_unary" vips_check_bands_1orn_unary :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    Int32 ->                                -- n : TBasicType TInt
    IO Int32

-- | Check that an image has 1 or /@n@/ bands. Handy for unary operations, cf.
-- 'GI.Vips.Functions.checkBands1orn'.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: 'GI.Vips.Functions.checkBands1orn'.
checkBands1ornUnary ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Int32
    -- ^ /@n@/: number of bands, or 1
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkBands1ornUnary :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> Int32 -> m Int32
checkBands1ornUnary Text
domain a
im Int32
n = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> Int32 -> IO Int32
vips_check_bands_1orn_unary CString
domain' Ptr Image
im' Int32
n
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands_1orn
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im1"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im2"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "second image to check"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands_1orn" vips_check_bands_1orn :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im1 : TInterface (Name {namespace = "Vips", name = "Image"})
    Ptr Vips.Image.Image ->                 -- im2 : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the images have the same number of bands, or that one of the
-- images has just 1 band.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBands1orn ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a, Vips.Image.IsImage b) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im1@/: first image to check
    -> b
    -- ^ /@im2@/: second image to check
    -> m Int32
    -- ^ __Returns:__ 0 on OK, or -1 on error.
checkBands1orn :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsImage a, IsImage b) =>
Text -> a -> b -> m Int32
checkBands1orn Text
domain a
im1 b
im2 = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im1' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im1
    Ptr Image
im2' <- b -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
im2
    Int32
result <- CString -> Ptr Image -> Ptr Image -> IO Int32
vips_check_bands_1orn CString
domain' Ptr Image
im1' Ptr Image
im2'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im1
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
im2
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands_1or3
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands_1or3" vips_check_bands_1or3 :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image has either one or three bands.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBands1or3 ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkBands1or3 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
checkBands1or3 Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_bands_1or3 CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bands
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bands"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "must have this many bands"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bands" vips_check_bands :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    Int32 ->                                -- bands : TBasicType TInt
    IO Int32

-- | Check that the image has /@bands@/ bands.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBands ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Int32
    -- ^ /@bands@/: must have this many bands
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkBands :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> Int32 -> m Int32
checkBands Text
domain a
im Int32
bands = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> Int32 -> IO Int32
vips_check_bands CString
domain' Ptr Image
im' Int32
bands
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_bandno
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "bandno"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "band number" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_bandno" vips_check_bandno :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    Int32 ->                                -- bandno : TBasicType TInt
    IO Int32

-- | /@bandno@/ should be a valid band number (ie. 0 to im->Bands - 1), or can be
-- -1, meaning all bands.
-- If not, set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
checkBandno ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> Int32
    -- ^ /@bandno@/: band number
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
checkBandno :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> Int32 -> m Int32
checkBandno Text
domain a
im Int32
bandno = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> Int32 -> IO Int32
vips_check_bandno CString
domain' Ptr Image
im' Int32
bandno
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function check_8or16
-- Args: [ Arg
--           { argCName = "domain"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the originating domain for the error message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "im"
--           , argType = TInterface Name { namespace = "Vips" , name = "Image" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "image to check" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_check_8or16" vips_check_8or16 :: 
    CString ->                              -- domain : TBasicType TUTF8
    Ptr Vips.Image.Image ->                 -- im : TInterface (Name {namespace = "Vips", name = "Image"})
    IO Int32

-- | Check that the image is 8 or 16-bit integer, signed or unsigned.
-- Otherwise set an error message
-- and return non-zero.
-- 
-- See also: @/vips_error()/@.
check8or16 ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Image.IsImage a) =>
    T.Text
    -- ^ /@domain@/: the originating domain for the error message
    -> a
    -- ^ /@im@/: image to check
    -> m Int32
    -- ^ __Returns:__ 0 if OK, -1 otherwise.
check8or16 :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsImage a) =>
Text -> a -> m Int32
check8or16 Text
domain a
im = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    CString
domain' <- Text -> IO CString
textToCString Text
domain
    Ptr Image
im' <- a -> IO (Ptr Image)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
im
    Int32
result <- CString -> Ptr Image -> IO Int32
vips_check_8or16 CString
domain' Ptr Image
im'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
im
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
domain'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function call_options
-- Args: [ Arg
--           { argCName = "group"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "OptionGroup" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "operation"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Operation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_call_options" vips_call_options :: 
    Ptr GLib.OptionGroup.OptionGroup ->     -- group : TInterface (Name {namespace = "GLib", name = "OptionGroup"})
    Ptr Vips.Operation.Operation ->         -- operation : TInterface (Name {namespace = "Vips", name = "Operation"})
    IO ()

-- | /No description available in the introspection data./
callOptions ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Operation.IsOperation a) =>
    GLib.OptionGroup.OptionGroup
    -> a
    -> m ()
callOptions :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsOperation a) =>
OptionGroup -> a -> m ()
callOptions OptionGroup
group a
operation = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr OptionGroup
group' <- OptionGroup -> IO (Ptr OptionGroup)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OptionGroup
group
    Ptr Operation
operation' <- a -> IO (Ptr Operation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
operation
    Ptr OptionGroup -> Ptr Operation -> IO ()
vips_call_options Ptr OptionGroup
group' Ptr Operation
operation'
    OptionGroup -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OptionGroup
group
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
operation
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function call_argv
-- Args: [ Arg
--           { argCName = "operation"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Operation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "argc"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "argv"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_call_argv" vips_call_argv :: 
    Ptr Vips.Operation.Operation ->         -- operation : TInterface (Name {namespace = "Vips", name = "Operation"})
    Int32 ->                                -- argc : TBasicType TInt
    CString ->                              -- argv : TBasicType TUTF8
    IO Int32

-- | /No description available in the introspection data./
callArgv ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Operation.IsOperation a) =>
    a
    -> Int32
    -> T.Text
    -> m Int32
callArgv :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsOperation a) =>
a -> Int32 -> Text -> m Int32
callArgv a
operation Int32
argc Text
argv = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr Operation
operation' <- a -> IO (Ptr Operation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
operation
    CString
argv' <- Text -> IO CString
textToCString Text
argv
    Int32
result <- Ptr Operation -> Int32 -> CString -> IO Int32
vips_call_argv Ptr Operation
operation' Int32
argc CString
argv'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
operation
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
argv'
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function cache_set_trace
-- Args: [ Arg
--           { argCName = "trace"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, trace the operation cache"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_set_trace" vips_cache_set_trace :: 
    CInt ->                                 -- trace : TBasicType TBoolean
    IO ()

-- | Handy for debugging. Print operation cache actions to stdout as we run.
-- 
-- You can set the environment variable @VIPS_TRACE@ to turn this option on, or
-- use the command-line flag @--vips-cache-trace@.
-- 
-- See also: 'GI.Vips.Functions.cacheSetDump'.
cacheSetTrace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@trace@/: if 'P.True', trace the operation cache
    -> m ()
cacheSetTrace :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Bool -> m ()
cacheSetTrace Bool
trace = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let trace' :: CInt
trace' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
trace
    CInt -> IO ()
vips_cache_set_trace CInt
trace'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_set_max_mem
-- Args: [ Arg
--           { argCName = "max_mem"
--           , argType = TBasicType TUInt64
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "maximum amount of tracked memory we use"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_set_max_mem" vips_cache_set_max_mem :: 
    Word64 ->                               -- max_mem : TBasicType TUInt64
    IO ()

-- | Set the maximum amount of tracked memory we allow before we start dropping
-- cached operations. See 'GI.Vips.Functions.trackedGetMem'.
-- 
-- libvips only tracks memory it allocates, it can\'t track memory allocated by
-- external libraries. If you use an operation like @/vips_magickload()/@, most of
-- the memory it uses won\'t be included.
-- 
-- See also: 'GI.Vips.Functions.trackedGetMem'.
cacheSetMaxMem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word64
    -- ^ /@maxMem@/: maximum amount of tracked memory we use
    -> m ()
cacheSetMaxMem :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Word64 -> m ()
cacheSetMaxMem Word64
maxMem = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Word64 -> IO ()
vips_cache_set_max_mem Word64
maxMem
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_set_max_files
-- Args: [ Arg
--           { argCName = "max_files"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "max open files we allow"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_set_max_files" vips_cache_set_max_files :: 
    Int32 ->                                -- max_files : TBasicType TInt
    IO ()

-- | Set the maximum number of tracked files we allow before we start dropping
-- cached operations. See 'GI.Vips.Functions.trackedGetFiles'.
-- 
-- See also: 'GI.Vips.Functions.trackedGetFiles'.
cacheSetMaxFiles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@maxFiles@/: max open files we allow
    -> m ()
cacheSetMaxFiles :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m ()
cacheSetMaxFiles Int32
maxFiles = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Int32 -> IO ()
vips_cache_set_max_files Int32
maxFiles
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_set_max
-- Args: [ Arg
--           { argCName = "max"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "maximum number of operation to cache"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_set_max" vips_cache_set_max :: 
    Int32 ->                                -- max : TBasicType TInt
    IO ()

-- | Set the maximum number of operations we keep in cache.
cacheSetMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@max@/: maximum number of operation to cache
    -> m ()
cacheSetMax :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m ()
cacheSetMax Int32
max = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Int32 -> IO ()
vips_cache_set_max Int32
max
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_set_dump
-- Args: [ Arg
--           { argCName = "dump"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, dump the operation cache on exit"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_set_dump" vips_cache_set_dump :: 
    CInt ->                                 -- dump : TBasicType TBoolean
    IO ()

-- | Handy for debugging. Print the operation cache to stdout just before exit.
-- 
-- See also: 'GI.Vips.Functions.cacheSetTrace'.
cacheSetDump ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@dump@/: if 'P.True', dump the operation cache on exit
    -> m ()
cacheSetDump :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Bool -> m ()
cacheSetDump Bool
dump = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let dump' :: CInt
dump' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
dump
    CInt -> IO ()
vips_cache_set_dump CInt
dump'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_print
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_print" vips_cache_print :: 
    IO ()

-- | Print the whole operation cache to stdout. Handy for debugging.
cachePrint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
cachePrint :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
cachePrint  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_cache_print
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_operation_lookup
-- Args: [ Arg
--           { argCName = "operation"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Operation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "pointer to operation to lookup"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Vips" , name = "Operation" })
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_operation_lookup" vips_cache_operation_lookup :: 
    Ptr Vips.Operation.Operation ->         -- operation : TInterface (Name {namespace = "Vips", name = "Operation"})
    IO (Ptr Vips.Operation.Operation)

-- | Look up an unbuilt /@operation@/ in the cache. If we get a hit, ref and
-- return the old operation. If there\'s no hit, return NULL.
cacheOperationLookup ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Operation.IsOperation a) =>
    a
    -- ^ /@operation@/: pointer to operation to lookup
    -> m Vips.Operation.Operation
    -- ^ __Returns:__ the cache hit, if any.
cacheOperationLookup :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsOperation a) =>
a -> m Operation
cacheOperationLookup a
operation = IO Operation -> m Operation
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Operation -> m Operation) -> IO Operation -> m Operation
forall a b. (a -> b) -> a -> b
$ do
    Ptr Operation
operation' <- a -> IO (Ptr Operation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
operation
    Ptr Operation
result <- Ptr Operation -> IO (Ptr Operation)
vips_cache_operation_lookup Ptr Operation
operation'
    Text -> Ptr Operation -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"cacheOperationLookup" Ptr Operation
result
    Operation
result' <- ((ManagedPtr Operation -> Operation)
-> Ptr Operation -> IO Operation
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Operation -> Operation
Vips.Operation.Operation) Ptr Operation
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
operation
    Operation -> IO Operation
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Operation
result'


-- function cache_operation_build
-- Args: [ Arg
--           { argCName = "operation"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Operation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "operation to lookup"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Vips" , name = "Operation" })
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_operation_build" vips_cache_operation_build :: 
    Ptr Vips.Operation.Operation ->         -- operation : TInterface (Name {namespace = "Vips", name = "Operation"})
    IO (Ptr Vips.Operation.Operation)

-- | A binding-friendly version of @/vips_cache_operation_buildp()/@.
-- 
-- After calling this, /@operation@/ has the same ref count as when it went in,
-- and the result must be freed with 'GI.Vips.Objects.Object.objectUnrefOutputs' and
-- 'GI.GObject.Objects.Object.objectUnref'.
cacheOperationBuild ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Operation.IsOperation a) =>
    a
    -- ^ /@operation@/: operation to lookup
    -> m Vips.Operation.Operation
    -- ^ __Returns:__ The built operation.
cacheOperationBuild :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsOperation a) =>
a -> m Operation
cacheOperationBuild a
operation = IO Operation -> m Operation
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Operation -> m Operation) -> IO Operation -> m Operation
forall a b. (a -> b) -> a -> b
$ do
    Ptr Operation
operation' <- a -> IO (Ptr Operation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
operation
    Ptr Operation
result <- Ptr Operation -> IO (Ptr Operation)
vips_cache_operation_build Ptr Operation
operation'
    Text -> Ptr Operation -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"cacheOperationBuild" Ptr Operation
result
    Operation
result' <- ((ManagedPtr Operation -> Operation)
-> Ptr Operation -> IO Operation
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Operation -> Operation
Vips.Operation.Operation) Ptr Operation
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
operation
    Operation -> IO Operation
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Operation
result'


-- function cache_operation_add
-- Args: [ Arg
--           { argCName = "operation"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Operation" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "pointer to operation to add"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_operation_add" vips_cache_operation_add :: 
    Ptr Vips.Operation.Operation ->         -- operation : TInterface (Name {namespace = "Vips", name = "Operation"})
    IO ()

-- | Add a built operation to the cache. The cache will ref the operation.
cacheOperationAdd ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Operation.IsOperation a) =>
    a
    -- ^ /@operation@/: pointer to operation to add
    -> m ()
cacheOperationAdd :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsOperation a) =>
a -> m ()
cacheOperationAdd a
operation = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Operation
operation' <- a -> IO (Ptr Operation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
operation
    Ptr Operation -> IO ()
vips_cache_operation_add Ptr Operation
operation'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
operation
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function cache_get_size
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_get_size" vips_cache_get_size :: 
    IO Int32

-- | Get the current number of operations in cache.
cacheGetSize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ get the current number of operations in cache.
cacheGetSize :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
cacheGetSize  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_cache_get_size
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function cache_get_max_mem
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_get_max_mem" vips_cache_get_max_mem :: 
    IO Word64

-- | Get the maximum amount of tracked memory we allow before we start dropping
-- cached operations. See 'GI.Vips.Functions.trackedGetMem'.
-- 
-- See also: 'GI.Vips.Functions.trackedGetMem'.
cacheGetMaxMem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Word64
    -- ^ __Returns:__ the maximum amount of tracked memory we allow
cacheGetMaxMem :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Word64
cacheGetMaxMem  = IO Word64 -> m Word64
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64
forall a b. (a -> b) -> a -> b
$ do
    Word64
result <- IO Word64
vips_cache_get_max_mem
    Word64 -> IO Word64
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word64
result


-- function cache_get_max_files
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_get_max_files" vips_cache_get_max_files :: 
    IO Int32

-- | Get the maximum number of tracked files we allow before we start dropping
-- cached operations. See 'GI.Vips.Functions.trackedGetFiles'.
-- 
-- libvips only tracks file descriptors it allocates, it can\'t track ones
-- allocated by external libraries. If you use an operation like
-- @/vips_magickload()/@, most of the descriptors it uses won\'t be included.
-- 
-- See also: 'GI.Vips.Functions.trackedGetFiles'.
cacheGetMaxFiles ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ the maximum number of tracked files we allow
cacheGetMaxFiles :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
cacheGetMaxFiles  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_cache_get_max_files
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function cache_get_max
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_get_max" vips_cache_get_max :: 
    IO Int32

-- | Get the maximum number of operations we keep in cache.
cacheGetMax ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ the maximum number of operations we keep in cache
cacheGetMax :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Int32
cacheGetMax  = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
vips_cache_get_max
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function cache_drop_all
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_cache_drop_all" vips_cache_drop_all :: 
    IO ()

-- | Drop the whole operation cache, handy for leak tracking. Also called
-- automatically on 'GI.Vips.Functions.shutdown'.
cacheDropAll ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
cacheDropAll :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
cacheDropAll  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
vips_cache_drop_all
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function block_untrusted_set
-- Args: [ Arg
--           { argCName = "state"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the block state to set"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_block_untrusted_set" vips_block_untrusted_set :: 
    CInt ->                                 -- state : TBasicType TBoolean
    IO ()

-- | Set the block state on all untrusted operations.
-- 
-- >
-- >vips_block_untrusted_set( TRUE );
-- 
-- 
-- Will block all untrusted operations from running.
-- 
-- Use @vips -l@ at the command-line to see the class hierarchy and which
-- operations are marked as untrusted.
-- 
-- Set the environment variable @VIPS_BLOCK_UNTRUSTED@ to block all untrusted
-- operations on 'GI.Vips.Functions.init'.
blockUntrustedSet ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@state@/: the block state to set
    -> m ()
blockUntrustedSet :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Bool -> m ()
blockUntrustedSet Bool
state = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let state' :: CInt
state' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
state
    CInt -> IO ()
vips_block_untrusted_set CInt
state'
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function add_option_entries
-- Args: [ Arg
--           { argCName = "option_group"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "OptionGroup" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "group to add to" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips_add_option_entries" vips_add_option_entries :: 
    Ptr GLib.OptionGroup.OptionGroup ->     -- option_group : TInterface (Name {namespace = "GLib", name = "OptionGroup"})
    IO ()

-- | Add the standard vips @/GOptionEntry/@ to a @/GOptionGroup/@.
-- 
-- See also: 'GI.GLib.Structs.OptionGroup.optionGroupNew'.
addOptionEntries ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.OptionGroup.OptionGroup
    -- ^ /@optionGroup@/: group to add to
    -> m ()
addOptionEntries :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
OptionGroup -> m ()
addOptionEntries OptionGroup
optionGroup = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr OptionGroup
optionGroup' <- OptionGroup -> IO (Ptr OptionGroup)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr OptionGroup
optionGroup
    Ptr OptionGroup -> IO ()
vips_add_option_entries Ptr OptionGroup
optionGroup'
    OptionGroup -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr OptionGroup
optionGroup
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function _object_set_member
-- Args: [ Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Vips" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pspec"
--           , argType = TParamSpec
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "member"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "argument"
--           , argType =
--               TInterface Name { namespace = "GObject" , name = "Object" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "vips__object_set_member" vips__object_set_member :: 
    Ptr Vips.Object.Object ->               -- object : TInterface (Name {namespace = "Vips", name = "Object"})
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GObject.Object.Object ->            -- member : TInterface (Name {namespace = "GObject", name = "Object"})
    Ptr GObject.Object.Object ->            -- argument : TInterface (Name {namespace = "GObject", name = "Object"})
    IO ()

-- | /No description available in the introspection data./
objectSetMember_ ::
    (B.CallStack.HasCallStack, MonadIO m, Vips.Object.IsObject a, GObject.Object.IsObject b, GObject.Object.IsObject c) =>
    a
    -> GParamSpec
    -> b
    -> c
    -> m ()
objectSetMember_ :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsObject a, IsObject b, IsObject c) =>
a -> GParamSpec -> b -> c -> m ()
objectSetMember_ a
object GParamSpec
pspec b
member c
argument = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Object
object' <- a -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
object
    Ptr GParamSpec
pspec' <- GParamSpec -> IO (Ptr GParamSpec)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GParamSpec
pspec
    Ptr Object
member' <- b -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
member
    Ptr Object
argument' <- c -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
argument
    Ptr Object -> Ptr GParamSpec -> Ptr Object -> Ptr Object -> IO ()
vips__object_set_member Ptr Object
object' Ptr GParamSpec
pspec' Ptr Object
member' Ptr Object
argument'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
object
    GParamSpec -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GParamSpec
pspec
    b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
member
    c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr c
argument
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()