-- | Image processing opcodes
module CsoundExpr.Opcodes.Imageopcodes.Top
    (imagecreate,
     imagesize,
     imagegetpixelA,
     imagegetpixelK,
     imagefree)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : imagecreate
--  
--  
-- * syntax : 
--  
--  >   iimagenum imagecreate iwidth, iheight
--  
--  
-- * description : 
--  
--  Create an empty image of a given size. Individual pixel values
-- can then be set with. imagegetpixel.
--  
--  
-- * url : <http://www.csounds.com/manual/html/imagecreate.html>
 
imagecreate :: Irate -> Irate -> Irate
imagecreate i0width i1height = opcode "imagecreate" args
  where args = [to i0width, to i1height]


-- | * opcode : imagesize
--  
--  
-- * syntax : 
--  
--  >   iwidth iheight imagesize iimagenum
--  
--  
-- * description : 
--  
--  Return the width and height of a previously opened or created
-- image. An image can be loaded with imageload. An empty image can
-- be created with imagecreate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/imagesize.html>
 
imagesize :: Irate -> MultiOut
imagesize i0imagenum = opcode "imagesize" args
  where args = [to i0imagenum]


-- | * opcode : imagegetpixel
--  
--  
-- * syntax : 
--  
--  >   ared agreen ablue imagegetpixel iimagenum, ax, ay
--  >   kred kgreen kblue imagegetpixel iimagenum, kx, ky
--  
--  
-- * description : 
--  
--  Return the RGB pixel values of a previously opened or created
-- image. An image can be loaded with imageload. An empty image can
-- be created with imagecreate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/imagegetpixel.html>
 
imagegetpixelA :: Irate -> Arate -> Arate -> MultiOut
imagegetpixelA i0imagenum a1x a2y = opcode "imagegetpixel" args
  where args = [to i0imagenum, to a1x, to a2y]


-- | * opcode : imagegetpixel
--  
--  
-- * syntax : 
--  
--  >   ared agreen ablue imagegetpixel iimagenum, ax, ay
--  >   kred kgreen kblue imagegetpixel iimagenum, kx, ky
--  
--  
-- * description : 
--  
--  Return the RGB pixel values of a previously opened or created
-- image. An image can be loaded with imageload. An empty image can
-- be created with imagecreate.
--  
--  
-- * url : <http://www.csounds.com/manual/html/imagegetpixel.html>
 
imagegetpixelK :: (K k0, K k1) => Irate -> k0 -> k1 -> MultiOut
imagegetpixelK i0imagenum k1x k2y = opcode "imagegetpixel" args
  where args = [to i0imagenum, to k1x, to k2y]


-- | * opcode : imagefree
--  
--  
-- * syntax : 
--  
--  >   imagefree iimagenum
--  
--  
-- * description : 
--  
--  Frees memory allocated for a previously loaded or created image.
--  
--  
-- * url : <http://www.csounds.com/manual/html/imagefree.html>
 
imagefree :: Irate -> SignalOut
imagefree i0imagenum = outOpcode "imagefree" args
  where args = [to i0imagenum]