WJf      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde None !"*234=K3Actions to create a path 2Draw a cubic bezier curve using 2 control points. cDraw a quadratic bezier curve from the current point through the control point to the end point. 4Draw a line from the current point to another point Describe a path in a way similar to many graphical packages, using a "pen" position in memory and reusing it for the next "move" For example the example from Primitive could be rewritten:  fill . pathToPrimitives $ Path (V2 50 20) True [ PathCubicBezierCurveTo (V2 90 60) (V2 5 100) (V2 50 140) , PathLineTo (V2 120 80) ]  docimages/path_example.png ?Origin of the point, equivalent to the first "move" command.  Tell if we must close the path. List of commands in the path This datatype gather all the renderable primitives, they are kept separated otherwise to allow specialization on some specific algorithms. You can mix the different primitives in a single call :  fill [ CubicBezierPrim $ CubicBezier (V2 50 20) (V2 90 60) (V2 5 100) (V2 50 140) , LinePrim $ Line (V2 50 140) (V2 120 80) , LinePrim $ Line (V2 120 80) (V2 50 20) ]  docimages/primitive_mixed.png &Primitive used for cubic bezier curve ,Primitive used for quadratic beziers curves Primitive used for lines <Describe a cubic bezier spline, described using 4 points.  stroke 4 JoinRound (CapRound, CapRound) $ [CubicBezierPrim $ CubicBezier (V2 0 10) (V2 205 250) (V2 (-10) 250) (V2 160 35)]  docimages/cubic_bezier.png /Origin point, the spline will pass through it. /First control point of the cubic bezier curve. 0Second control point of the cubic bezier curve. $End point of the cubic bezier curve @Describe a quadratic bezier spline, described using 3 points.  fill $ BezierPrim <$> [Bezier (V2 10 10) (V2 200 50) (V2 200 100) ,Bezier (V2 200 100) (V2 150 200) (V2 120 175) ,Bezier (V2 120 175) (V2 30 100) (V2 10 10)]  docimages/quadratic_bezier.png 0Origin points, the spline will pass through it. ,Control point, the spline won't pass on it. ,End point, the spline will pass through it. .Describe a simple 2D line between two points.  fill $ LinePrim <$> [ Line (V2 10 10) (V2 190 10) , Line (V2 190 10) (V2 95 170) , Line (V2 95 170) (V2 10 10)]  docimages/simple_line.png  Origin point  End point ATypeclass helper gathering all the points of a given geometry. :Fold an accumulator on all the points of the primitive. This typeclass is there to help transform the geometry, by applying a transformation on every point of a geometric element. !CApply a transformation function for every point in the element. fRepresent a raster line gHorizontal position hVertical position iAlpha jHeight "mDescribe the behaviour of samplers and texturers when they are out of the bounds of image and/or gradient. #Will loop inverting axises  docimages/sampler_reflect.png $&Will loop on it's definition domain  docimages/sampler_repeat.png %=Will clamp (ie. repeat the last pixel) when out of bound  docimages/sampler_pad.png &{Tell how to fill complex shapes when there is self intersections. If the filling mode is not specified, then it's the ( method which is used. >The examples used are produced with the following function: fillingSample :: FillMethod -> Drawing px () fillingSample fillMethod = fillWithMethod fillMethod geometry where geometry = transform (applyTransformation $ scale 0.35 0.4 <> translate (V2 (-80) (-180))) $ concatMap pathToPrimitives [ Path (V2 484 499) True [ PathCubicBezierCurveTo (V2 681 452) (V2 639 312) (V2 541 314) , PathCubicBezierCurveTo (V2 327 337) (V2 224 562) (V2 484 499) ] , Path (V2 136 377) True [ PathCubicBezierCurveTo (V2 244 253) (V2 424 420) (V2 357 489) , PathCubicBezierCurveTo (V2 302 582) (V2 47 481) (V2 136 377) ] , Path (V2 340 265) True [ PathCubicBezierCurveTo (V2 64 371) (V2 128 748) (V2 343 536) , PathCubicBezierCurveTo (V2 668 216) (V2 17 273) (V2 367 575) , PathCubicBezierCurveTo (V2 589 727) (V2 615 159) (V2 340 265) ] ] '#This rule determines the insideness of a point on the canvas by drawing a ray from that point to infinity in any direction and counting the number of path segments from the given shape that the ray crosses. If this number is odd, the point is inside; if even, the point is outside.  docimages/fill_evenodd.png (DAlso known as nonzero rule. To determine if a point falls inside the curve, you draw an imaginary line through that point. Next you will count how many times that line crosses the curve before it reaches that point. For every clockwise rotation, you subtract 1 and for every counter-clockwise rotation you add 1.  docimages/fill_winding.png )CDescribe how to display the join of broken lines while stroking. *XMake a mitter join. Value must be positive or null. Seems to make sense in [0;1] only Miter join with 0 :  docimages/join_miter.png Miter join with 5 :  docimages/join_miter_5.png +Make a curved join.  docimages/join_round.png ,>Describe how we will "finish" the stroking that don't loop. -)Create a rounded caping on the stroke.  docimages/cap_round.png .Create a straight caping on the stroke. Cap value should be positive and represent the distance from the end of curve to the actual cap cap straight with param 0 :  docimages/cap_straight.png cap straight with param 1 :  docimages/cap_straight_1.png /Dash pattern to use k9Type alias just to get more meaningful type signatures 0Represent a point 1Represent a vector 2ETransform a path description into a list of renderable primitives. L l  !fmghij"#$%&'()*+,-./k012nopqrstuvwxyz{|}~9 l  !fmghij"#$%&'()*+,-./k012& l   !fmghij"%$#&(')+*,.-/k012nopqrstuvwxyz{|}~None 33Represent a 3*3 matrix for homogenous coordinates.  | A C E | | B D F | | 0 0 1 | 7X translation :Y translation ;6Effectively transform a point given a transformation. <@Create a transformation representing a rotation on the plane.  Yfill . transform (applyTransformation $ rotate 0.2) $ rectangle (V2 40 40) 120 120  docimages/transform_rotate.png =jCreate a transformation representing a rotation on the plane. The rotation center is given in parameter  lfill . transform (applyTransformation $ rotateCenter 0.2 (V2 200 200)) $ rectangle (V2 40 40) 120 120  %docimages/transform_rotate_center.png >+Perform a scaling of the given primitives.  Vfill . transform (applyTransformation $ scale 2 2) $ rectangle (V2 40 40) 40 40  docimages/transform_scale.png ?/Perform a translation of the given primitives.  cfill . transform (applyTransformation $ translate (V2 100 100)) $ rectangle (V2 40 40) 40 40  !docimages/transform_translate.png @'Inverse a transformation (if possible) 3456789:;<Rotation angle in radian. =Rotation angle in radian Rotation center >?@3456789:;<=>?@3456789:;?><=@ 3456789:;<=>?@NonePairwise boolean and operator Pairwise boolean or operator %Pairwise vector/point equal operator 3Pairwise vector/point lower than or equal operator *Pairwise vector/point lower than operator &Component/scalar lower than operator. +Pairwise vector/point difference operator. NMin function between two vector/points. Work on every component separately. KMax function between to vector/point. Work on every component separatly. 6Abs function for every component of the vector/point. 8Floor function for every component of the vector/point. 7ceil function for every component of the vector/point. NGiven a point, clamp every coordinates between a given minimum and maximum. :Given two points, return a point in the middle of them. hGiven a boolean choice vector, return elements of the first one if true, of the second one otherwise. Calculate a normal vector 9Return the second operand if the vector is nearly null pTell if two points are nearly indistinguishable. If indistinguishable, we can treat them as the same point. simply `not (a  b)` NoneA,Transform a list a point to a list of lines ;lineFromPath [a, b, c, d] = [Line a b, Line b c, Line c d] @Clamp the bezier curve inside a rectangle given in parameter. A3Point representing the "minimal" point for cliping 3Point representing the "maximal" point for cliping  The line AANone24MB5Create a list of bezier patch from a list of points, bezierFromPath [a, b, c, d, e] == [Bezier a b c, Bezier c d e] bezierFromPath [a, b, c, d, e, f] == [Bezier a b c, Bezier c d e] bezierFromPath [a, b, c, d, e, f, g] == [Bezier a b c, Bezier c d e, Bezier e f g] 9Only work if the quadratic bezier curve is nearly flat @Create a quadratic bezier curve representing a straight line. @Clamp the bezier curve inside a rectangle given in parameter. 4Rewrite the bezier curve to avoid degenerate cases. 2Move the bezier to a new position with an offset. B3Point representing the "minimal" point for cliping 3Point representing the "maximal" point for cliping )The quadratic bezier curve to be clamped B BNone!"24C;Create a list of cubic bezier patch from a list of points. cubicBezierFromPath [a, b, c, d, e] = [CubicBezier a b c d] cubicBezierFromPath [a, b, c, d, e, f, g] = [CubicBezier a b c d, CubicBezier d e f g] HRepresent a circle of radius 1 centered on 0 of a cubic bezier curve. FClamp the cubic bezier curve inside a rectangle given in parameter. 9Will subdivide the bezier from 0 to coeff and coeff to 1 C Tolerance 3Point representing the "minimal" point for cliping 3Point representing the "maximal" point for cliping %The cubic bezier curve to be clamped C C NoneCreate a "rounded" join or cap OPut a cap at the end of a bezier curve, depending on the kind of cap wanted.  None  None3DITypeclass intented at pixel value modulation. May be throwed out soon. @Empty value representing total transparency for the given type. 8Full value representing total opacity for a given type. sGiven a Float in [0; 1], return the coverage in [emptyValue; fullValue] The second value is the inverse coverage EModulate two elements, staying in the [emptyValue; fullValue] range. +Implement a division between two elements. 4Like modulate but also return the inverse coverage. D coverage inverse coverage  background  foreground DDNone3M EA gradient definition is just a list of stop and pixel values. For instance for a simple gradient of black to white, the finition would be :  =[(0, PixelRGBA8 0 0 0 255), (1, PixelRGBA8 255 255 255 255)] 5the first stop value must be zero and the last, one. FA texture is just a function which given pixel coordinate give back a pixel. The float coordinate type allow for transformations to happen in the pixel space. G@Set the repeat pattern of the texture (if any). With padding:  VwithTexture (sampledImageTexture textureImage) $ fill $ rectangle (V2 0 0) 200 200  !docimages/sampled_texture_pad.png  With repeat:  withTexture (withSampler SamplerRepeat $ sampledImageTexture textureImage) $ fill $ rectangle (V2 0 0) 200 200  $docimages/sampled_texture_repeat.png With reflect:  withTexture (withSampler SamplerReflect $ sampledImageTexture textureImage) $ fill $ rectangle (V2 0 0) 200 200  %docimages/sampled_texture_reflect.png HdTransform the coordinates used for texture before applying it, allow interesting transformations.  withTexture (withSampler SamplerRepeat $ transformTexture (rotateCenter 1 (V2 0 0) <> scale 0.5 0.25) $ sampledImageTexture textureImage) $ fill $ rectangle (V2 0 0) 200 200  $docimages/sampled_texture_scaled.png IHThe uniform texture is the simplest texture of all: an uniform color. JLinear gradient texture.  (let gradDef = [(0, PixelRGBA8 0 0x86 0xc1 255) ,(0.5, PixelRGBA8 0xff 0xf4 0xc1 255) ,(1, PixelRGBA8 0xFF 0x53 0x73 255)] in withTexture (linearGradientTexture SamplerPad gradDef (V2 40 40) (V2 130 130)) $ fill $ circle (V2 100 100) 100  docimages/linear_gradient.png K>Use another image as a texture for the filling. Contrary to L?, this function perform a bilinear filtering on the texture. LwUse another image as a texture for the filling. This texture use the "nearest" filtering, AKA no filtering at all. MRadial gradient texture  let gradDef = [(0, PixelRGBA8 0 0x86 0xc1 255) ,(0.5, PixelRGBA8 0xff 0xf4 0xc1 255) ,(1, PixelRGBA8 0xFF 0x53 0x73 255)] in withTexture (radialGradientTexture SamplerPad gradDef (V2 100 100) 75) $ fill $ circle (V2 100 100) 100  docimages/radial_gradient.png N,Radial gradient texture with a focus point.  1let gradDef = [(0, PixelRGBA8 0 0x86 0xc1 255) ,(0.5, PixelRGBA8 0xff 0xf4 0xc1 255) ,(1, PixelRGBA8 0xFF 0x53 0x73 255)] in withTexture (radialGradientWithFocusTexture SamplerPad gradDef (V2 100 100) 75 (V2 70 70) ) $ fill $ circle (V2 100 100) 100  #docimages/radial_gradient_focus.png OzPerform a multiplication operation between a full color texture and a greyscale one, used for clip-path implementation. EFGHI$The color used for all the texture. JGradient description. Linear gradient start point. Linear gradient end point. KLMGradient description Radial gradient center Radial gradient radius NGradient description Radial gradient center Radial gradient radius Radial gradient focus point OThe full blown texture.  A greyscale modulation texture. The resulting texture. EFGHIJKLMNO FEGIJMNLKOHEFGHIJKLMNONone 234=HKMP*Monad used to record the drawing actions. ,Monad used to describe the drawing context. QFThis function will spit out drawing instructions to help debugging. ZThe outputted code looks like Haskell, but there is no guarantee that it is compilable. R=Define the texture applyied to all the children draw call.  withTexture (uniformTexture $ PixelRGBA8 0 0x86 0xc1 255) $ do fill $ circle (V2 50 50) 20 fill $ circle (V2 100 100) 20 withTexture (uniformTexture $ PixelRGBA8 0xFF 0x53 0x73 255) $ circle (V2 150 150) 20  docimages/with_texture.png S:Draw all the sub drawing commands using a transformation. TFill some geometry. The geometry should be "looping", ie. the last point of the last primitive should be equal to the first point of the first primitive. #The primitive should be connected.  fill $ circle (V2 100 100) 75  docimages/fill_circle.png U\This function let you choose how to fill the primitives in case of self intersection. See &' documentation for more information. V*Draw some geometry using a clipping path.  withClipping (fill $ circle (V2 100 100) 75) $ mapM_ (stroke 7 JoinRound (CapRound, CapRound)) [line (V2 0 yf) (V2 200 (yf + 10)) | y <- [5 :: Int, 17 .. 200] , let yf = fromIntegral y ]  docimages/with_clipping.png WSWill stroke geometry with a given stroke width. The elements should be connected  Astroke 5 JoinRound (CapRound, CapRound) $ circle (V2 100 100) 75  docimages/stroke_circle.png XDraw a string at a given position. Text printing imply loading a font, there is no default font (yet). Below an example of font rendering using a font installed on Microsoft Windows.  = import Graphics.Text.TrueType( loadFontFile ) import Codec.Picture( PixelRGBA8( .. ), writePng ) import Graphics.Rasterific import Graphics.Rasterific.Texture main :: IO () main = do fontErr <- loadFontFile "C:/Windows/Fonts/arial.ttf" case fontErr of Left err -> putStrLn err Right font -> writePng "text_example.png" . renderDrawing 300 70 (PixelRGBA8 255 255 255 255) . withTexture (uniformTexture $ PixelRGBA8 0 0 0 255) $ printTextAt font 12 (V2 20 40) "A simple text test!"  docimages/text_example.png ?You can use any texture, like a gradient while rendering text. YFunction to call in order to start the image creation. Tested pixels type are PixelRGBA8 and Pixel8, pixel types in other colorspace will probably produce weird results. ZHWith stroke geometry with a given stroke width, using a dash pattern.  edashedStroke [5, 10, 5] 3 JoinRound (CapRound, CapStraight 0) [line (V2 0 100) (V2 200 100)]  docimages/dashed_stroke.png [With stroke geometry with a given stroke width, using a dash pattern. The offset is there to specify the starting point into the pattern, the value can be negative.  qdashedStrokeWithOffset 3 [5, 10, 5] 3 JoinRound (CapRound, CapStraight 0) [line (V2 0 100) (V2 200 100)]  'docimages/dashed_stroke_with_offset.png \"Clip the geometry to a rectangle. Fill some geometry. The geometry should be "looping", ie. the last point of the last primitive should be equal to the first point of the first primitive. #The primitive should be connected. ]4Generate a list of primitive representing a circle.  fill $ circle (V2 100 100) 75  docimages/fill_circle.png ^6Generate a list of primitive representing an ellipse.  "fill $ ellipse (V2 100 100) 75 30  docimages/fill_ellipse.png _FGenerate a strokable line out of points list. Just an helper around A.  Ystroke 4 JoinRound (CapRound, CapRound) $ polyline [V2 10 10, V2 100 70, V2 190 190]  docimages/stroke_polyline.png `AGenerate a fillable polygon out of points list. Similar to the _! function, but close the path.  0fill $ polygon [V2 30 30, V2 100 70, V2 80 170]  docimages/fill_polygon.png a8Generate a list of primitive representing a rectangle  $fill $ rectangle (V2 30 30) 150 100  docimages/fill_rect.png bqSimply draw an image into the canvas. Take into account any previous transformation performed on the geometry.  $drawImage textureImage 0 (V2 30 30)  docimages/image_simple.png c$Draw an image with the desired size  2drawImageAtSize textureImage 2 (V2 30 30) 128 128  docimages/image_resize.png dMGenerate a list of primitive representing a rectangle with rounded corner.  1fill $ roundedRectangle (V2 10 10) 150 150 20 10  #docimages/fill_roundedRectangle.png e*Return a simple line ready to be stroked.  Mstroke 17 JoinRound (CapRound, CapRound) $ line (V2 10 10) (V2 180 170)  docimages/stroke_line.png *PQRSTUVThe clipping path The actual geometry to clip W Stroke width  Which kind of join will be used Start and end capping. List of elements to render X Drawing font font Point size Baseline begining position String to print YRendering width Rendering height Background color Rendering action Z$Dashing pattern to use for stroking  Stroke width  Which kind of join will be used Start and end capping. List of elements to render [Starting offset $Dashing pattern to use for stroking  Stroke width  Which kind of join will be used Start and end capping. List of elements to render \"Minimum point (corner upper left) $Maximum point (corner bottom right) Primitive to be clipped #Color/Texture used for the filling Primitives to fill #Color/Texture used for the filling Primitives to fill ]Circle center in pixels Circle radius in pixels ^_`aCorner upper left Width in pixel Height in pixel bImage to be drawn )Border size, drawn with current texture. 0Position of the corner upper left of the image. cImage to be drawn )Border size, drawn with current texture. 0Position of the corner upper left of the image. Width of the drawn image Height of the drawn image dCorner upper left Width in pixel Height in pixel. 9Radius along the x axis of the rounded corner. In pixel. 9Radius along the y axis of the rounded corner. In pixel. eN  !"#$%&'()*+,-./012ABCDFPQRSTUVWXYZ[\]^_`abcdeNTURVSWZ[XY2FPD01    !ead]^_`cb\BAC)+*,.-"%$#&('/QPQRSTUVWXYZ[\]^_`abcde    !"#$$%&'()*+,+-./0123456789:;;<=>?@ABCDEFGHIJ KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsmtuvwxyz{|}~    Rasterific-0.2.1Graphics.Rasterific#Graphics.Rasterific.TransformationsGraphics.Rasterific.TextureGraphics.Rasterific.TypesGraphics.Rasterific.OperatorsGraphics.Rasterific.Line#Graphics.Rasterific.QuadraticBezierGraphics.Rasterific.CubicBezierGraphics.Rasterific.StrokeGraphics.Rasterific.RasterizeGraphics.Rasterific.Compositor linear-1.8.1 Linear.V2V2 PathCommandPathCubicBezierCurveToPathQuadraticBezierCurveTo PathLineToPath_pathOriginPoint _pathClose _pathCommand PrimitiveCubicBezierPrim BezierPrimLinePrim CubicBezier _cBezierX0 _cBezierX1 _cBezierX2 _cBezierX3Bezier _bezierX0 _bezierX1 _bezierX2Line_lineX0_lineX1 PointFoldable foldPoints Transformable transform SamplerRepeatSamplerReflect SamplerPad FillMethod FillEvenOdd FillWindingJoin JoinMiter JoinRoundCapCapRound CapStraight DashPatternPointVectorpathToPrimitivesTransformation _transformA _transformC _transformE _transformB _transformD _transformFapplyTransformationrotate rotateCenterscale translateinverseTransformation lineFromPathbezierFromPathcubicBezierFromPath ModulableGradientTexture withSamplertransformTextureuniformTexturelinearGradientTexturesampledImageTexture imageTextureradialGradientTextureradialGradientWithFocusTexturemodulateTextureDrawing dumpDrawing withTexturewithTransformationfillfillWithMethod withClippingstroke printTextAt renderDrawing dashedStrokedashedStrokeWithOffsetclipcircleellipsepolylinepolygon rectangle drawImagedrawImageAtSizeroundedRectangleline EdgeSample_sampleX_sampleY _sampleAlpha_sampleH StrokeWidth Container$fPointFoldablePathCommand$fTransformablePathCommand$fPointFoldablePath$fTransformablePath$fPointFoldablef$fTransformablef$fPointFoldablePrimitive$fTransformablePrimitive$fPointFoldableCubicBezier$fTransformableCubicBezier$fShowCubicBezier$fPointFoldableBezier$fTransformableBezier $fShowBezier$fPointFoldableLine$fTransformableLine $fShowLine$fPointFoldableV2$fTransformableV2transformCombine$fMonoidTransformation^&&^^||^^==^^<=^^<^^<^/=^vminvmaxvabsvfloorvceil clampPointmidPoint vpartitionnormalifZeroisNearbyisDistingableFrom lerpPointclipLine lineLength sanitizeLine lineBreakAt flattenLinebezierLengthApproximation straightLine clipBeziersanitizeBezier offsetBezierdecomposeBeziers bezierBreakAt flattenBeziercubicBezierCircleclipCubicBeziercubicBezierBreakAtcubicBezierLengthApproximationisSufficientlyFlatflattenCubicBezieroffsetCubicBezierdecomposeCubicBezierssanitizeCubicBezier roundJoincap lastPointlastPointAndNormalfirstPointAndNormalreversePrimitive lineFromTo miterJoinjoinPrimitivesoffsetPrimitives offsetAndJoinapproximateLengthsanitizestrokizeflattenPrimitivebreakPrimitiveAtflattensplitPrimitiveUntil dropPatterndashizedashedStrokize CoverageSpan _coverageX _coverageY _coverageVal_coverageLengthcombineEdgeSamples decompose rasterize emptyValue fullValue clampCoveragemodulatemodivcoverageModulate alphaOver alphaCompose CompositortoWord8compositionDestinationcompositionAlpha$fModulableWord8$fModulableFloat GradientArrayrepeatGradientreflectGradientgradientColorAtgradientColorAtRepeat DrawContextfillWithTexture RenderContext currentClipcurrentTexturecurrentTransformation DrawCommand WithTransform WithCliping SetTextureTextFill DashedStrokeStrokeFillfillWithTextureAndMaskcomposeCoverageSpancomposeCoverageSpanWithMask $fMonoidFree$fFunctorDrawCommand