ParentContentsIndex
Graphics.UI.Port.Canvas
Portability portable
Stability provisional
Maintainer ka2_mail@yahoo.com
Contents
Canvas
Draw
Fill
Transform
Pen
Font
Resolution
Description
Drawing on a canvas.
Synopsis
withCanvas :: Pen -> BufferMode -> CanvasHandle -> IO a -> IO a
changeCanvasPen :: Pen -> CanvasHandle -> IO ()
drawPoint :: Point -> CanvasHandle -> IO ()
drawLine :: Point -> Point -> CanvasHandle -> IO ()
drawChar :: Point -> Char -> CanvasHandle -> IO ()
drawString :: Point -> String -> CanvasHandle -> IO ()
drawRect :: Rect -> CanvasHandle -> IO ()
drawOval :: Rect -> CanvasHandle -> IO ()
drawCurve :: Rect -> Float -> Float -> CanvasHandle -> IO ()
drawPolygon :: [Point] -> CanvasHandle -> IO ()
drawPolyline :: [Point] -> CanvasHandle -> IO ()
drawBitmap :: Point -> Bitmap -> CanvasHandle -> IO ()
fillRect :: Rect -> CanvasHandle -> IO ()
fillOval :: Rect -> CanvasHandle -> IO ()
fillCurve :: Rect -> Float -> Float -> CanvasHandle -> IO ()
fillPolygon :: [Point] -> CanvasHandle -> IO ()
rotateCanvas :: Double -> CanvasHandle -> IO ()
scaleCanvas :: Double -> Double -> CanvasHandle -> IO ()
shearCanvas :: Double -> Double -> CanvasHandle -> IO ()
translateCanvas :: Double -> Double -> CanvasHandle -> IO ()
data Pen = Pen {
penSize :: !Int
penMode :: !DrawMode
penColor :: !Color
penBackColor :: !Color
penBkDrawMode :: !Bool
penFont :: !Font
penJoinStyle :: !JoinStyle
penCapStyle :: !CapStyle
penLineStyle :: !LineStyle
penHatchStyle :: !HatchStyle
}
windowPen :: Pen
dialogPen :: Pen
getPenFontMetrics :: CanvasHandle -> IO FontMetrics
getPenFontCharWidth :: Char -> CanvasHandle -> IO Int
getPenFontStringWidth :: String -> CanvasHandle -> IO Int
mmToVPixels :: Double -> IO Int
mmToHPixels :: Double -> IO Int
getResolution :: CanvasHandle -> IO Size
getScaleFactor :: CanvasHandle -> IO (Size, Size)
Canvas
withCanvas :: Pen -> BufferMode -> CanvasHandle -> IO a -> IO a
Initialize a canvas and it's initial drawing pencil. Should be called before using any of the drawing operations.
changeCanvasPen :: Pen -> CanvasHandle -> IO ()
Draw
drawPoint :: Point -> CanvasHandle -> IO ()
drawLine :: Point -> Point -> CanvasHandle -> IO ()
drawChar :: Point -> Char -> CanvasHandle -> IO ()
drawString :: Point -> String -> CanvasHandle -> IO ()
drawRect :: Rect -> CanvasHandle -> IO ()
drawOval :: Rect -> CanvasHandle -> IO ()
Draw an oval bounded by a rectangle.
drawCurve :: Rect -> Float -> Float -> CanvasHandle -> IO ()
The expression (drawCurve rect start end canvas) draws a curve on the oval bounded by by rect, starting at an angle start (in radians) continuing in clockwise direction to the ending angle end (in radians).
drawPolygon :: [Point] -> CanvasHandle -> IO ()
Draw a polygon. The polygon is automatically closed.
drawPolyline :: [Point] -> CanvasHandle -> IO ()
Draw a poly line.
drawBitmap :: Point -> Bitmap -> CanvasHandle -> IO ()
Fill
fillRect :: Rect -> CanvasHandle -> IO ()
fillOval :: Rect -> CanvasHandle -> IO ()
Fill an oval bounded by a rectangle.
fillCurve :: Rect -> Float -> Float -> CanvasHandle -> IO ()
The expression (fillCurve rect start end canvas) fills a pie bounded by the line from the center of the oval bounded by rect at an angle start (in radians), continuing over the oval in clockwise direction and back on the line to the center of the oval at an angle end (in radians).
fillPolygon :: [Point] -> CanvasHandle -> IO ()
Draw a filled polygon.
Transform
rotateCanvas :: Double -> CanvasHandle -> IO ()
Rotate the canvas clockwise with an angle in radians.
scaleCanvas :: Double -> Double -> CanvasHandle -> IO ()
Scale the canvas with a horizontal and vertical factor.
shearCanvas :: Double -> Double -> CanvasHandle -> IO ()
Shear the canvas in a horizontal and vertical direction.
translateCanvas :: Double -> Double -> CanvasHandle -> IO ()
Translate (or move) the canvas in a horizontal and vertical direction.
Pen
data Pen
The pencil embodies common drawing attributes.
Constructors
Pen
penSize :: !Int Thickness of the pencil
penMode :: !DrawMode
penColor :: !Color
penBackColor :: !Color
penBkDrawMode :: !Bool
penFont :: !Font
penJoinStyle :: !JoinStyle
penCapStyle :: !CapStyle
penLineStyle :: !LineStyle
penHatchStyle :: !HatchStyle
windowPen :: Pen

Create a pen with default drawing values for windows. That is:

Pen 1 DrawCopy textColor windowColor False windowColor JoinMiter CapFlat LineSolid HatchSolid

dialogPen :: Pen

Create a pen with default drawing values for dialogs. That is:

Pen 1 DrawCopy textColor dialogColor False dialogFont JoinMiter CapFlat LineSolid HatchSolid

Font
getPenFontMetrics :: CanvasHandle -> IO FontMetrics
The metrics for the current pen font. (See also getFontMetrics).
getPenFontCharWidth :: Char -> CanvasHandle -> IO Int
The the pixel width of a character in the current pen font. (See also getFontCharWidth).
getPenFontStringWidth :: String -> CanvasHandle -> IO Int
Get the pixel width of a string in the current pen font. (See also getFontStringWidth).
Resolution
mmToVPixels :: Double -> IO Int
Convert millimeters to on-screen vertical pixels.
mmToHPixels :: Double -> IO Int
Convert millimeters to on-screen horizontal pixels
getResolution :: CanvasHandle -> IO Size
Get the resolution of a canvas in pixels per logical inch.
getScaleFactor :: CanvasHandle -> IO (Size, Size)
Get scaling factors, which have to be applied to coordinates for clipping regions in case of emulating the screen resolution for printing. The function returns the pixel size of the window and the pixel size of the actual view port.
Produced by Haddock version 0.4