module Graphics.UI.FLTK.LowLevel.Gl
(
glStart,
glFinish,
glHeight,
glDescent,
glColor,
glRect,
glRectf,
glFont,
glWidth,
glWidthChars,
glWidthChar,
glDraw,
glDrawChars,
glDrawAt,
glDrawCharsAt,
glDrawInBox,
glMeasure,
glDrawImage
)
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Foreign.C
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Utils
import qualified Data.Text as T
glStart :: IO ()
glStart =
glStart'_ >>
return ()
glFinish :: IO ()
glFinish =
glFinish'_ >>
return ()
glHeight :: IO ()
glHeight =
glHeight'_ >>
return ()
glDescent :: IO ()
glDescent =
glDescent'_ >>
return ()
glColor :: (Color) -> IO ()
glColor a1 =
let {a1' = cFromColor a1} in
glColor'_ a1' >>
return ()
flcGlRect' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ()
flcGlRect' a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
flcGlRect''_ a1' a2' a3' a4' >>
return ()
glRect :: Rectangle -> IO ()
glRect rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcGlRect' x_pos' y_pos' width' height'
flcGlRectf' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ()
flcGlRectf' a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
flcGlRectf''_ a1' a2' a3' a4' >>
return ()
glRectf :: Rectangle -> IO ()
glRectf rectangle = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcGlRectf' x_pos' y_pos' width' height'
flcGlFont' :: (Font) -> (Int) -> IO ()
flcGlFont' a1 a2 =
let {a1' = cFromFont a1} in
let {a2' = fromIntegral a2} in
flcGlFont''_ a1' a2' >>
return ()
glFont :: Font -> Int -> IO ()
glFont fontid size = flcGlFont' fontid size
flcGlWidth' :: (T.Text) -> IO ((Double))
flcGlWidth' a1 =
let {a1' = unsafeToCString a1} in
flcGlWidth''_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
glWidth :: T.Text -> IO (Double)
glWidth str = flcGlWidth' str
flcGlWidthWithN' :: (T.Text) -> (Int) -> IO ((Double))
flcGlWidthWithN' a1 a2 =
let {a1' = unsafeToCString a1} in
let {a2' = fromIntegral a2} in
flcGlWidthWithN''_ a1' a2' >>= \res ->
let {res' = realToFrac res} in
return (res')
glWidthChars :: T.Text -> Int -> IO (Double)
glWidthChars str n = flcGlWidthWithN' str n
flcGlWidthWithUcharStr' :: (Char) -> IO ((Double))
flcGlWidthWithUcharStr' a1 =
let {a1' = castCharToCUChar a1} in
flcGlWidthWithUcharStr''_ a1' >>= \res ->
let {res' = realToFrac res} in
return (res')
glWidthChar :: Char -> IO (Double)
glWidthChar str = flcGlWidthWithUcharStr' str
flcGlDraw' :: (T.Text) -> IO ()
flcGlDraw' a1 =
let {a1' = unsafeToCString a1} in
flcGlDraw''_ a1' >>
return ()
glDraw :: T.Text -> IO ()
glDraw str = flcGlDraw' str
flcGlDrawWithN' :: (T.Text) -> (Int) -> IO ()
flcGlDrawWithN' a1 a2 =
let {a1' = unsafeToCString a1} in
let {a2' = fromIntegral a2} in
flcGlDrawWithN''_ a1' a2' >>
return ()
glDrawChars :: T.Text -> Int -> IO ()
glDrawChars str n = flcGlDrawWithN' str n
flcGlDrawWithXy' :: (T.Text) -> (Float) -> (Float) -> IO ()
flcGlDrawWithXy' a1 a2 a3 =
let {a1' = unsafeToCString a1} in
let {a2' = realToFrac a2} in
let {a3' = realToFrac a3} in
flcGlDrawWithXy''_ a1' a2' a3' >>
return ()
glDrawAt :: T.Text -> Float -> Float -> IO ()
glDrawAt str x y = flcGlDrawWithXy' str x y
flcGlDrawWithNxy' :: (T.Text) -> (Int) -> (Float) -> (Float) -> IO ()
flcGlDrawWithNxy' a1 a2 a3 a4 =
let {a1' = unsafeToCString a1} in
let {a2' = fromIntegral a2} in
let {a3' = realToFrac a3} in
let {a4' = realToFrac a4} in
flcGlDrawWithNxy''_ a1' a2' a3' a4' >>
return ()
glDrawCharsAt :: T.Text -> Int -> Float -> Float -> IO ()
glDrawCharsAt str n x y = flcGlDrawWithNxy' str n x y
flcGlDrawWithXywhAlign' :: (T.Text) -> (Int) -> (Int) -> (Int) -> (Int) -> (AlignType) -> IO ()
flcGlDrawWithXywhAlign' a1 a2 a3 a4 a5 a6 =
let {a1' = unsafeToCString a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
let {a5' = fromIntegral a5} in
let {a6' = cFromEnum a6} in
flcGlDrawWithXywhAlign''_ a1' a2' a3' a4' a5' a6' >>
return ()
glDrawInBox :: T.Text -> Rectangle -> AlignType -> IO ()
glDrawInBox str rectangle align = let (x_pos', y_pos', width', height') = fromRectangle rectangle in flcGlDrawWithXywhAlign' str x_pos' y_pos' width' height' align
flcGlMeasure' :: (T.Text) -> (Int) -> (Int) -> IO ()
flcGlMeasure' a1 a2 a3 =
let {a1' = unsafeToCString a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
flcGlMeasure''_ a1' a2' a3' >>
return ()
glMeasure :: T.Text -> Position -> IO ()
glMeasure str (Position (X x_pos') (Y y_pos')) = flcGlMeasure' str x_pos' y_pos'
flcGlDrawImageWithDLd' :: (Ptr CUChar) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ()
flcGlDrawImageWithDLd' a1 a2 a3 a4 a5 a6 a7 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
let {a5' = fromIntegral a5} in
let {a6' = fromIntegral a6} in
let {a7' = fromIntegral a7} in
flcGlDrawImageWithDLd''_ a1' a2' a3' a4' a5' a6' a7' >>
return ()
glDrawImage :: BitmapHs -> Position -> Maybe Depth -> Maybe LineSize -> IO ()
glDrawImage bitmap' (Position (X x_pos') (Y y_pos')) depth' linesize' =
let d = maybe 0 (\(Depth d') -> d') depth'
l = maybe 0 (\(LineSize l') -> l') linesize'
in
withBitmap bitmap' $ \ptr width' height' -> flcGlDrawImageWithDLd' (castPtr ptr) x_pos' y_pos' width' height' d l
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_start"
glStart'_ :: (IO ())
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_finish"
glFinish'_ :: (IO ())
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_height"
glHeight'_ :: (IO C2HSImp.CInt)
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_descent"
glDescent'_ :: (IO C2HSImp.CInt)
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_color"
glColor'_ :: (C2HSImp.CUInt -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_rect"
flcGlRect''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_rectf"
flcGlRectf''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_font"
flcGlFont''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_width"
flcGlWidth''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (IO C2HSImp.CDouble))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_width_with_n"
flcGlWidthWithN''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (IO C2HSImp.CDouble)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_width_with_uchar_str"
flcGlWidthWithUcharStr''_ :: (C2HSImp.CUChar -> (IO C2HSImp.CDouble))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw"
flcGlDraw''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw_with_n"
flcGlDrawWithN''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw_with_xy"
flcGlDrawWithXy''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw_with_nxy"
flcGlDrawWithNxy''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw_with_xywh_align"
flcGlDrawWithXywhAlign''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CUInt -> (IO ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_measure"
flcGlMeasure''_ :: ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Gl.chs.h flc_gl_draw_image_with_d_ld"
flcGlDrawImageWithDLd''_ :: ((C2HSImp.Ptr C2HSImp.CUChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))))