Portability | CPP, FFI |
---|---|
Stability | Stable |
Maintainer | Don Stewart <dons00@gmail.com> |
Safe Haskell | None |
Tested with: GHC 6.10, GHC 7.6
Bindings to xosd, the X on-screen display library xosd is a library for displaying an on-screen display (like the one on many TVs) on your X display.
An example using the lowest level C layer:
do x <- create 1 setFont x "-adobe-helvetica-bold-r-*-*-34-*-*-*-*-*-*-*" setColor x "LimeGreen" display x 0 (String "Screen 1")
runXOSD [Timeout 10, VAlign VAlignMiddle, HAlign HAlignCenter, Font -adobe-helvetica-bold-r-*-*-34-*-*-*-*-*-*-*, Color LimeGreen, Display (String TEST)] (x -> sequence_ [ display x 0 (String (show i)) >> Control.Concurrent.threadDelay (10^4) | i <- [1..] ])
- type XOSD = Ptr XOSD_
- data VAlign
- data HAlign
- data Format
- create :: Int -> IO XOSD
- destroy :: XOSD -> IO ()
- xosdEitherIf :: (a -> Bool) -> IO a -> IO (Either String a)
- xosdErrorIf :: (a -> Bool) -> IO a -> IO a
- xosdError :: IO a
- setBarLength :: XOSD -> Int -> IO ()
- setVAlign :: XOSD -> VAlign -> IO ()
- setHAlign :: XOSD -> HAlign -> IO ()
- setShadowOffset :: XOSD -> Int -> IO ()
- setShadowColor :: XOSD -> String -> IO ()
- setOutlineOffset :: XOSD -> Int -> IO ()
- setOutlineColor :: XOSD -> String -> IO ()
- setHorizontalOffset :: XOSD -> Int -> IO ()
- setVerticalOffset :: XOSD -> Int -> IO ()
- setTimeout :: XOSD -> Int -> IO ()
- setColor :: XOSD -> String -> IO ()
- setFont :: XOSD -> String -> IO ()
- display :: XOSD -> Int -> Format -> IO ()
- setHidden :: XOSD -> IO ()
- setVisible :: XOSD -> IO ()
- scroll :: XOSD -> Int -> IO ()
- isOnScreen :: XOSD -> IO Bool
- getNumberOfLines :: XOSD -> IO Int
- wait :: XOSD -> IO ()
- toXOSDVAlign :: VAlign -> XOSD_VAlign
- toXOSDHAlign :: HAlign -> XOSD_HAlign
- toXOSDFormat :: Format -> XOSD_Format
- xosd_create :: CInt -> IO XOSD
- xosd_error :: IO CString
- xosd_destroy :: XOSD -> IO CInt
- xosd_set_bar_length :: XOSD -> CInt -> IO CInt
- xosd_is_onscreen :: XOSD -> IO CInt
- xosd_wait_until_no_display :: XOSD -> IO CInt
- xosd_hide :: XOSD -> IO CInt
- xosd_show :: XOSD -> IO CInt
- xosd_set_pos :: XOSD -> CInt -> IO CInt
- xosd_set_align :: XOSD -> CInt -> IO CInt
- xosd_set_shadow_offset :: XOSD -> CInt -> IO CInt
- xosd_set_outline_offset :: XOSD -> CInt -> IO CInt
- xosd_set_outline_colour :: XOSD -> CString -> IO CInt
- xosd_set_shadow_colour :: XOSD -> CString -> IO CInt
- xosd_set_horizontal_offset :: XOSD -> CInt -> IO CInt
- xosd_set_vertical_offset :: XOSD -> CInt -> IO CInt
- xosd_set_timeout :: XOSD -> CInt -> IO CInt
- xosd_set_colour :: XOSD -> CString -> IO CInt
- xosd_set_font :: XOSD -> CString -> IO CInt
- xosd_get_colour :: XOSD -> Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CInt
- xosd_get_number_lines :: XOSD -> IO CInt
- xosd_scroll :: XOSD -> CInt -> IO CInt
- xosd_display_string :: XOSD -> CInt -> XOSD_Format -> CString -> IO CInt
- xosd_display_percent :: XOSD -> CInt -> XOSD_Format -> CInt -> IO CInt
- xosd_display_slider :: XOSD -> CInt -> XOSD_Format -> CInt -> IO CInt
The abstract XOSD type
An abstract X on-screen display object
An xosd window can be used to display textual or numerical data on a X11 display in a unmanaged, shaped window that appears to be transparent. It provides a similar effect to the on-screen display of many televisions and video recorders
Formatting types
Valid screen positions (vertical alignment)
Valid screen positions (vertical alignment)
The type of possible display formats
Introduction and elimination
create :: Int -> IO XOSDSource
Create a new xosd window. The argument is the maximum number of lines of text that the window can display. Throw an exception on failure.
destroy :: XOSD -> IO ()Source
xosd_uninit destroys an existing xosd window, freeing the memory. This is an unsafe function: as destroying an xosd object twice will likely cause bad things to happen, so don't do that.
Error handling
xosdEitherIf :: (a -> Bool) -> IO a -> IO (Either String a)Source
Throw an error (encapsulated in Either) with the current String in xosd_error
xosdErrorIf :: (a -> Bool) -> IO a -> IO aSource
Throw an error with the current String in xosd_error
if predicate is True
when applied to result of action.
Throw an error with the current String in xosd_error
unconditionally
Setting attributes in the xosd object
setBarLength :: XOSD -> Int -> IO ()Source
Set length of percentage and slider bar
setShadowOffset :: XOSD -> Int -> IO ()Source
Change the offset of the text shadow
setShadowColor :: XOSD -> String -> IO ()Source
Change the colour of the shadow
setOutlineOffset :: XOSD -> Int -> IO ()Source
Change the offset of the text outline- The outline is drawn over the shadow.
setOutlineColor :: XOSD -> String -> IO ()Source
Change the colour of the outline
setHorizontalOffset :: XOSD -> Int -> IO ()Source
Change the number of pixels the display is offset from the position
setVerticalOffset :: XOSD -> Int -> IO ()Source
Change the number of pixels the display is offset from the position
setTimeout :: XOSD -> Int -> IO ()Source
Change the time before display is hidden.
setVisible :: XOSD -> IO ()Source
Show the display after being hidden
Testing state of the xosd object
isOnScreen :: XOSD -> IO BoolSource
getNumberOfLines :: XOSD -> IO IntSource
Get the maximum number of lines allowed
Control structures
Wait until nothing is displayed. Blocks the process until no longer visible.
Helpers
toXOSDVAlign :: VAlign -> XOSD_VAlignSource
Translate abstract to concrete formatting types
toXOSDHAlign :: HAlign -> XOSD_HAlignSource
Translate abstract to concrete formatting types
toXOSDFormat :: Format -> XOSD_FormatSource
Translate abstract to concrete formatting types
Raw C API
xosd_create :: CInt -> IO XOSDSource
xosd_destroy :: XOSD -> IO CIntSource
xosd_is_onscreen :: XOSD -> IO CIntSource