Y:      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  Safe-InferredHM8Traversal type, matched to the one of the lens package."Try to match the Lens' type alias.8Does it look familiar? yes it's the official Lens type.    Safe-Inferred/Represent an equation `a * x^2 + b * x + c = 0`%Coefficient for the square part (x^2)Coefficient the linear part (x)Constant(Discriminant equation, if the result is:3Below 0, then the formula doesn't have any solution0Equal to 0, then the formula has an unique root.&Above 0, the formula has two solutionsOExtract all the roots of the formula ie. where the unknown gives a result of 0  Safe-Inferred,Free and sparse inner product/metric spaces.MCompute the inner product of two vectors or (equivalently) convert a vector f a into a covector f a -> a.V2 1 2 `dot` V2 3 411gCompute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.'Compute the quadrance of the difference:Compute the distance between two vectors in a metric space.Compute the norm of a vector in a metric space )Convert a non-zero vector to unit vector. DProvides a fairly subjective test to see if a quantity is near zero.nearZero (1e-11 :: Double)FalsenearZero (1e-17 :: Double)TruenearZero (1e-5 :: Float)FalsenearZero (1e-7 :: Float)True %Determine if a quantity is near zero. 8A vector is an additive group with additional structure. The zero vectorCompute the sum of two vectorsV2 1 2 ^+^ V2 3 4V2 4 6*Compute the difference between two vectorsV2 4 5 - V2 3 1V2 1 4)Linearly interpolate between two vectors.A 1-dimensional vectorA 2-dimensional vectorpure 1 :: V2 IntV2 1 1V2 1 2 + V2 3 4V2 4 6V2 1 2 * V2 3 4V2 3 8 sum (V2 1 2)3 Compute the right scalar product V2 3 4 ^* 2V2 6 8*Compute division by a scalar on the right. Normalize a  functor to have unit 4. This function does not change the functor if its  is 0 or 1.  a  1e-12  a  1e-6           Safe-InferredRepresent a pointPairwise boolean and operatorPairwise boolean or operator$Pairwise vector/point equal operator2Pairwise vector/point lower than or equal operator)Pairwise vector/point lower than operator%Component/scalar lower than operator.*Pairwise vector/point difference operator.LMin function between two vector/points. Work on every component separately.IMax function between to vector/point. Work on every component separatly.5Abs function for every component of the vector/point.7Floor function for every component of the vector/point.6ceil function for every component of the vector/point.LGiven a point, clamp every coordinates between a given minimum and maximum.8Given two points, return a point in the middle of them.fGiven a boolean choice vector, return elements of the first one if true, of the second one otherwise.Calculate a normal vector7Return the second operand if the vector is nearly nullmTell if two points are nearly indistinguishable. If indistinguishable, we can treat them as the same point.simply `not (a  b)` None !"234=KBActions to create a path1Draw a cubic bezier curve using 2 control points.aDraw a quadratic bezier curve from the current point through the control point to the end point.3Draw a line from the current point to another pointDescribe 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: xfill $ 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"All the rasterization works on lists of primitives, in order to ease the use of the library, the Geometry type class provides conversion facility, which help generalising the geometry definition and avoid applying Primitive constructor.$Also streamline the Path conversion.#;Convert an element to a list of primitives to be rendered.$LHelper method to avoid overlaping instances. You shouldn't use it directly.%!Generalizing constructors of the ' type to work generically.'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 [ toPrim $ CubicBezier (V2 50 20) (V2 90 60) (V2 5 100) (V2 50 140) , toPrim $ Line (V2 50 140) (V2 120 80) , toPrim $ 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. jstroke 4 JoinRound (CapRound, CapRound) $ 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.//Second control point of the cubic bezier curve.0#End point of the cubic bezier curve1>Describe a quadratic bezier spline, described using 3 points. fill [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.png3/Origin points, the spline will pass through it.4+Control point, the spline won't pass on it.5+End point, the spline will pass through it.6-Describe a simple 2D line between two points. jfill [ Line (V2 10 10) (V2 190 10) , Line (V2 190 10) (V2 95 170) , Line (V2 95 170) (V2 10 10)] docimages/simple_line.png8 Origin point9 End point:?Typeclass helper gathering all the points of a given geometry.;8Fold 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.=AApply a transformation function for every point in the element.Represent a raster lineHorizontal positionVertical positionAlphaHeight>kDescribe 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.pngA;Will clamp (ie. repeat the last pixel) when out of bound docimages/sampler_pad.pngByTell how to fill complex shapes when there is self intersections. If the filling mode is not specified, then it's the D method which is used.<The examples used are produced with the following function: vfillingSample :: FillMethod -> Drawing px () fillingSample fillMethod = fillWithMethod fillMethod geometry where geometry = transform (applyTransformation $ scale 0.35 0.4 <> translate (V2 (-80) (-180))) [ 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) ] ]CThis 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.pngD>Also 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.pngEADescribe how to display the join of broken lines while stroking.FVMake a mitter join. Value must be positive or null. Seems to make sense in [0;1] onlyMiter join with 0 : docimages/join_miter.pngMiter join with 5 : docimages/join_miter_5.pngGMake a curved join. docimages/join_round.pngH<Describe how we will "finish" the stroking that don't loop.I(Create a rounded caping on the stroke. docimages/cap_round.pngJCreate a straight caping on the stroke. Cap value should be positive and represent the distance from the end of curve to the actual capcap straight with param 0 : docimages/cap_straight.pngcap straight with param 1 : docimages/cap_straight_1.pngKDash pattern to useL7Type alias just to get more meaningful type signaturesMRepresent a vectorNCTransform a path description into a list of renderable primitives.O=Gives the orientation vector for the start of the primitive.P:Gives the orientation vector at the end of the primitive.Q)Extract the first point of the primitive.R+Return the last point of a given primitive.^Generalize the geometry to any foldable container, so you can throw any container to the the fill or stroke function. toPrim = CubicBezierPrim toPrim = BezierPrim toPrim = LinePrim  toPrim = id Just apply the functionJust apply the functionJust to get faster sortingf !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR !"#$%    &'()*+,-. I !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR< !"#$%&'*)(+,-./0123456789:;<=>A@?BDCEGFHJIKLMNOPQR !"#$%    &'()*+,-. None S2Represent a 3*3 matrix for homogenous coordinates. | A C E | | B D F | | 0 0 1 |W X translationZ Y translation[5Effectively transform a point given a transformation.\^Effectively transform a vector given a transformation. The translation part won't be applied.]>Create a transformation representing a rotation on the plane. Wfill . transform (applyTransformation $ rotate 0.2) $ rectangle (V2 40 40) 120 120 docimages/transform_rotate.png^hCreate a transformation representing a rotation on the plane. The rotation center is given in parameter jfill . 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. Tfill . transform (applyTransformation $ scale 2 2) $ rectangle (V2 40 40) 40 40 docimages/transform_scale.png`.Perform a translation of the given primitives. afill . transform (applyTransformation $ translate (V2 100 100)) $ rectangle (V2 40 40) 40 40 !docimages/transform_translate.pnga&Skew transformation along the X axis. Tfill . transform (applyTransformation $ skewX 0.3) $ rectangle (V2 50 50) 80 80 docimages/transform_skewx.pngb%Skew transformation along the Y axis. Tfill . transform (applyTransformation $ skewY 0.3) $ rectangle (V2 50 50) 80 80 docimages/transform_skewy.pngc~Given a new X-acis vector, create a rotation matrix to get into this new base, assuming an Y basis orthonormal to the X one.d&Inverse a transformation (if possible)STUVWXYZ/[\]Rotation angle in radian.^Rotation angle in radianRotation center_`abc0d1STUVWXYZ[\]^_`abcdSTUVWXYZ[\`_]^abcdSTUVWXYZ/[\]^_`abc0d1 None 234=HKMeReification of texture typefA 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)]4the first stop value must be zero and the last, one.g-Structure defining how to render a text rangeiFont used during the renderingjSize of the text (in pixels)k^Text to draw | Texture to use for drawing, if Nothing, the currently active texture is used.m)Monad used to record the drawing actions.nDThis function will spit out drawing instructions to help debugging.XThe outputted code looks like Haskell, but there is no guarantee that it is compilable.%23456789:;<e=>?@ABCDEFGfHIghijklmnJKL#23456789:;<e=>?@ABCDEFGfHIghijklmnJ 2 <;:9876543e GFEDCBA@?>=fHIghijklmnJKLNoneHMp8Traversal type, matched to the one of the lens package.q"Try to match the Lens' type alias.r8Does it look familiar? yes it's the official Lens type.M+Create a full lens out of setter and getters"Traverse all the points of a line.tLine origin point.uLine end point.v Quadratic bezier starting point.wbezier control point.xbezier end point.y%Traversal of all the bezier's points.zCubic bezier first point{!Cubic bezier first control point.|"Cubic bezier second control point.}Cubic bezier last point.~0Traversal of all the points of the cubic bezier.1Traverse all the points defined in the primitive.%Traversal of all the points of a path&Traversal of all the points in a path.opqrMstuvwxyz{|}~opqrstuvwxyz{|}~tusvwxyz{|}~rqpoopqrMstuvwxyz{|}~None+Transform a list a point to a list of lines :lineFromPath [a, b, c, d] = [Line a b, Line b c, Line c d]N>Clamp the bezier curve inside a rectangle given in parameter.O`Extend a line by two coefficient, giving a line that's a linear extension of the original line.law: extendLine 0 1 = id PQRSTUN2Point representing the "minimal" point for cliping2Point representing the "maximal" point for clipingThe lineVOBegin extension coefficientEnd extension coefficientLine to transform PQRSTUNVO PQRSTUNVONone24M4Create 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]W7Only work if the quadratic bezier curve is nearly flatX>Create a quadratic bezier curve representing a straight line.Y>Clamp the bezier curve inside a rectangle given in parameter.Z3Rewrite the bezier curve to avoid degenerate cases.[1Move the bezier to a new position with an offset. \W]XY2Point representing the "minimal" point for cliping2Point representing the "maximal" point for cliping(The quadratic bezier curve to be clampedZ^_`[ \W]XYZ^`[ \W]XYZ^_`[None!"24aMRepresent the cubic bezier curve as a vector ready for matrix multiplication: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]bFRepresent a circle of radius 1 centered on 0 of a cubic bezier curve.c+Find the coefficient of the extremum pointsdDClamp the cubic bezier curve inside a rectangle given in parameter.e8Will subdivide the bezier from 0 to coeff and coeff to 1afghijkblm Tolerancenopqrcstud2Point representing the "minimal" point for cliping2Point representing the "maximal" point for cliping$The cubic bezier curve to be clampedevwxy kbotudevwxyafghijkblmnopqrcstudevwxyNone!Clip the geometry to a rectangle. z{|}~!Minimum point (corner upper left)#Maximum point (corner bottom right)Primitive to be clippedz{|}~z{|}~None3Generate a list of primitive representing a circle. fill $ circle (V2 100 100) 75 docimages/fill_circle.png5Generate a list of primitive representing an ellipse. !fill $ ellipse (V2 100 100) 75 30 docimages/fill_ellipse.png6Generate a list of primitive representing a rectangle #fill $ rectangle (V2 30 30) 150 100 docimages/fill_rect.pngKGenerate a list of primitive representing a rectangle with rounded corner. 0fill $ roundedRectangle (V2 10 10) 150 150 20 10 #docimages/fill_roundedRectangle.pngCircle center in pixelsCircle radius in pixelsCorner upper leftWidth in pixelHeight in pixelCorner upper leftWidth in pixelHeight in pixel.8Radius along the x axis of the rounded corner. In pixel.8Radius along the y axis of the rounded corner. In pixel.None24Class used to calculate bounds of various geometrical primitives. The calculated is precise, the bounding should be minimal with respect with drawn curve.2Given a graphical elements, calculate it's bounds.Represent the minimal axis aligned rectangle in which some primitives can be drawn. Should fit to bezier curve and not use directly their control points.DCorner upper left of the bounding box of the considered primitives.ECorner lower right of the bounding box of the considered primitives.Extract the width of the boundsExtract the height of the bound=Extract the position of the lower left corner of the bounds.  NoneCreate a "rounded" join or capMPut a cap at the end of a bezier curve, depending on the kind of cap wanted.DDon't make them completly flat, but suficiently to assume they are.Return an approximation of the length of a given path. It's results is not precise but should be enough for rough calculations]Create a list of outlines corresponding to all the dashed elements. They can be then stroked mapM_ (stroke 3 (JoinMiter 0) (CapStraight 0, CapStraight 0)) $ dashedStrokize 0 [10, 5] 40 JoinRound (CapStraight 0, CapStraight 0) $ CubicBezier (V2 40 160) (V2 40 40) (V2 160 40) (V2 160 160) "docimages/strokize_dashed_path.pngStarting offset#Dashing pattern to use for stroking Stroke widthWhich kind of join will be usedStart and end capping.Elements to transformNonebThis function will create the outline of a given geometry given a path. You can then stroke it.  stroke 3 (JoinMiter 0) (CapStraight 0, CapStraight 0) $ strokize 40 JoinRound (CapRound, CapRound) $ CubicBezier (V2 40 160) (V2 40 40) (V2 160 40) (V2 160 160)  docimages/strokize_path.png  Stroke width  Which kind of join will be used Start and end capping. List of elements to strokize LLNone&3=K GTypeclass intented at pixel value modulation. May be throwed out soon.?Empty value representing total transparency for the given type.7Full value representing total opacity for a given type.qGiven a Float in [0; 1], return the coverage in [emptyValue; fullValue] The second value is the inverse coverageDModulate two elements, staying in the [emptyValue; fullValue] range.*Implement a division between two elements.3Like modulate but also return the inverse coverage.This constraint tells us that pixel component must also be pixel and be the "bottom" of component, we cannot go further than a PixelBaseComponent level.4All pixel instances of JuicyPixels should be usable.pThis constraint ensure that a type is a pixel and we're allowed to modulate it's color components generically.*Really need a "builder" function for pixelcoverageinverse coverage background foreground None &3=KMeRight now, we must stick to ST, due to the fact that we can't specialize with parameterized monad :(The intent of shader texture is to provide ease of implementation If possible providing a custom filler will be more efficient, like already done for the solid colors.hThis function will interpret the texture description, helping prepare and optimize the real calculation=Use another image as a texture for the filling. Contrary to  imageTexture=, this function perform a bilinear filtering on the texture.tUse another image as a texture for the filling. This texture use the "nearest" filtering, AKA no filtering at all.xPerform a multiplication operation between a full color texture and a greyscale one, used for clip-path implementation.Gradient description.Linear gradient start point.Linear gradient end point.Gradient descriptionRadial gradient centerRadial gradient radiusGradient descriptionRadial gradient centerRadial gradient radiusRadial gradient focus pointNone &3=HKM SReify a filling function call, to be able to manipulate them in a simpler fashion.Primitives to be filled."Texture for the filled primitives.How to fill the primitives. Optional mask used for clipping.+Monad used to describe the drawing context.FTransform back a low level drawing order to a more high level Drawing(Render the drawing orders on the canvas.Start an image rendering. See < for an usage example. This function can work with either  or ST.Fill some geometry. bimmediateDrawExample :: Image PixelRGBA8 immediateDrawExample = runST $ runDrawContext 200 200 (PixelRGBA8 0 0 0 0) $ fillWithTexture FillWinding texture geometry where circlePrimitives = circle (V2 100 100) 50 geometry = strokize 4 JoinRound (CapRound, CapRound) circlePrimitives texture = uniformTexture (PixelRGBA8 255 255 255 255) docimages/immediate_fill.png;Fill some geometry using a composition mask for visibility. QimmediateDrawMaskExample :: Image PixelRGBA8 immediateDrawMaskExample = runST $ runDrawContext 200 200 (PixelRGBA8 0 0 0 255) $ forM_ [1 .. 10] $ \ix -> fillWithTextureAndMask FillWinding texture mask $ rectangle (V2 10 (ix * 18 - 5)) 180 13 where texture = uniformTexture $ PixelRGBA8 0 0x86 0xc1 255 mask = sampledImageTexture $ runST $ runDrawContext 200 200 0 $ fillWithTexture FillWinding (uniformTexture 255) maskGeometry maskGeometry = strokize 15 JoinRound (CapRound, CapRound) $ circle (V2 100 100) 80 docimages/immediate_mask.png6Helper function transforming text range to draw order.Rendering widthRendering heightBackground colorActual drawing computation"Color/Texture used for the fillingPrimitives to fill2Color/Texture used for the filling of the geometryTexture used for the mask.Primitives to fill Current output device resolution4Texture to use if no texture is defined in the rangeBaseline positionText description. NoneB iCallback function in charge to transform the DrawOrder given the transformation to place it on the path.State of the path walker, just a bunch of primitives with continuity guarantee. The continuity is guaranteed by the Path used to derive this primitives.4Simpler alias if monad transformers are not needed.The walking transformer monad.&Create a path walker from a given path2Advance by the given amount of pixels on the path.QObtain the current position if we are still on the path, if not, return Nothing.XObtain the current tangeant of the path if we're still on it. Return Nothing otherwise.This function is the workhorse of the placement, it will walk the path and calculate the appropriate transformation for every order. -Function handling the placement of the order.Starting offset)Baseline vertical position in the orders."Path on which to place the orders.Orders to place on a path. None&234=EHKM      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVDFh      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVNone &234=HKM;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.pngWill render the whole subaction with a given group opacity, after each element has been rendered. That means that completly opaque overlapping shapes will be rendered transparently, not one after another. twithTexture (uniformTexture $ PixelRGBA8 0xFF 0x53 0x73 255) $ stroke 3 JoinRound (CapRound, CapRound) $ line (V2 0 100) (V2 200 100) withGroupOpacity 128 $ do withTexture (uniformTexture $ PixelRGBA8 0 0x86 0xc1 255) . fill $ circle (V2 70 100) 60 withTexture (uniformTexture $ PixelRGBA8 0xff 0xf4 0xc1 255) . fill $ circle (V2 120 100) 60 docimages/group_opacity.png"To be compared to the item opacity MwithTexture (uniformTexture $ PixelRGBA8 0xFF 0x53 0x73 255) $ stroke 3 JoinRound (CapRound, CapRound) $ line (V2 0 100) (V2 200 100) withTexture (uniformTexture $ PixelRGBA8 0 0x86 0xc1 128) . fill $ circle (V2 70 100) 60 withTexture (uniformTexture $ PixelRGBA8 0xff 0xf4 0xc1 128) . fill $ circle (V2 120 100) 60 docimages/item_opacity.png9Draw all the sub drawing commands using a transformation.hThis command allows you to draw primitives on a given curve, for example, you can draw text on a curve: :let path = Path (V2 100 180) False [PathCubicBezierCurveTo (V2 20 20) (V2 170 20) (V2 300 200)] in stroke 3 JoinRound (CapStraight 0, CapStraight 0) path withTexture (uniformTexture $ PixelRGBA8 0 0 0 255) $ withPathOrientation path 0 $ printTextAt font (PointSize 24) (V2 0 0) "Text on path" docimages/text_on_path.pngQYou can note that the position of the baseline match the size of the characters.~You are not limited to text drawing while using this function, you can draw arbitrary geometry like in the following example: let path = Path (V2 100 180) False [PathCubicBezierCurveTo (V2 20 20) (V2 170 20) (V2 300 200)] withTexture (uniformTexture $ PixelRGBA8 0 0 0 255) $ stroke 3 JoinRound (CapStraight 0, CapStraight 0) path withPathOrientation path 0 $ do printTextAt font (PointSize 24) (V2 0 0) "TX" fill $ rectangle (V2 (-10) (-10)) 30 20 fill $ rectangle (V2 45 0) 10 20 fill $ rectangle (V2 60 (-10)) 20 20 fill $ rectangle (V2 100 (-15)) 20 50 docimages/geometry_on_path.pngFill 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[This function let you choose how to fill the primitives in case of self intersection. See B% documentation for more information.)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.pngQWill stroke geometry with a given stroke width. The elements should be connected @stroke 5 JoinRound (CapRound, CapRound) $ circle (V2 100 100) 75 docimages/stroke_circle.pngDraw 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. Fimport Graphics.Text.TrueType( loadFontFile ) import Codec.Picture( PixelRGBA8( .. ), writePng ) import Graphics.Rasterific import Graphics.Rasterific.Texture main :: IO () main = do fontErr <- loadFontFile "test_fonts/DejaVuSans.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 (PointSize 12) (V2 20 40) "A simple text test!" docimages/text_example.png>You can use any texture, like a gradient while rendering text.aPrint complex text, using different texture font and point size for different parts of the text.  let blackTexture = Just . uniformTexture $ PixelRGBA8 0 0 0 255 redTexture = Just . uniformTexture $ PixelRGBA8 255 0 0 255 in printTextRanges (V2 20 40) [ TextRange font1 (PointSize 12) "A complex " blackTexture , TextRange font2 (PointSize 8) "text test" redTexture] "docimages/text_complex_example.pngFunction 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. Default DPI is 96Function 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.This function perform an optimisation, it will render a drawing to an image interanlly and create a new order to render this image instead of the geometry, effectively cuting the geometry generation part.IIt can save execution time when drawing complex elements multiple times.=Transform a drawing into a serie of low-level drawing orders.FWith stroke geometry with a given stroke width, using a dash pattern. `dashedStroke [5, 10, 5] 3 JoinRound (CapRound, CapStraight 0) $ line (V2 0 100) (V2 200 100) docimages/dashed_stroke.pngWith 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. ldashedStrokeWithOffset 3 [5, 10, 5] 3 JoinRound (CapRound, CapStraight 0) $ line (V2 0 100) (V2 200 100) 'docimages/dashed_stroke_with_offset.pngEGenerate a strokable line out of points list. Just an helper around . Wstroke 4 JoinRound (CapRound, CapRound) $ polyline [V2 10 10, V2 100 70, V2 190 190] docimages/stroke_polyline.png@Generate a fillable polygon out of points list. Similar to the  function, but close the path. /fill $ polygon [V2 30 30, V2 100 70, V2 80 170] docimages/fill_polygon.pngoSimply 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#Draw an image with the desired size 1drawImageAtSize textureImage 2 (V2 30 30) 128 128 docimages/image_resize.png)Return a simple line ready to be stroked. Kstroke 17 JoinRound (CapRound, CapRound) $ line (V2 10 10) (V2 180 170) docimages/stroke_line.pngWXYZ[Path directing the orientation.5Basline Y axis position, used to align text properly.The sub drawings.The clipping pathThe actual geometry to clip Stroke widthWhich kind of join will be usedStart and end capping.List of elements to render Drawing fontfont Point size"Drawing starting point (base line)String to printStarting point of the base line Ranges description to be printedRendering widthRendering heightBackground colorRendering actionRendering widthRendering height$Current DPI used for text rendering.Drawing OrdersRendering widthRendering height$Current DPI used for text rendering.Rendering actionRendering widthRendering height$Current DPI used for text rendering.Background colorRendering action\Max rendering widthMax rendering heightRendering widthRendering heightCurrent assumed DPIBackground colorRendering action#Dashing pattern to use for stroking Stroke widthWhich kind of join will be usedStart and end capping.List of elements to renderStarting offset#Dashing pattern to use for stroking Stroke widthWhich kind of join will be usedStart and end capping.List of elements to renderImage to be drawn(Border size, drawn with current texture./Position of the corner upper left of the image.Image to be drawn(Border size, drawn with current texture./Position of the corner upper left of the image.Width of the drawn imageHeight of the drawn images !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKMNOPQReghijklmnsghijklNemM+,-./0678912345'*)( !%&"#$<=:;OPQREGFHJI>A@?BDCKnWXYZ[\None&3=KM >Set the repeat pattern of the texture (if any). With padding: TwithTexture (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.pngbTransform 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.pngFThe uniform texture is the simplest texture of all: an uniform color.Linear 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=Use another image as a texture for the filling. Contrary to  imageTexture=, this function perform a bilinear filtering on the texture.Radial 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 gradDef (V2 100 100) 75) $ fill $ circle (V2 100 100) 100 docimages/radial_gradient.png+Radial gradient texture with a focus point.  let gradDef = [(0, PixelRGBA8 0 0x86 0xc1 255) ,(0.5, PixelRGBA8 0xff 0xf4 0xc1 255) ,(1, PixelRGBA8 0xFF 0x53 0x73 255)] in withTexture (radialGradientWithFocusTexture gradDef (V2 100 100) 75 (V2 70 70) ) $ fill $ circle (V2 100 100) 100 #docimages/radial_gradient_focus.pngxPerform a multiplication operation between a full color texture and a greyscale one, used for clip-path implementation.0Use a drawing as a repeating background pattern. let pattern = patternTexture 40 40 96 (PixelRGBA8 0xFF 0x53 0x73 255) . withTexture (uniformTexture $ PixelRGBA8 0 0x86 0xc1 255) $ fill $ circle (V2 20 20) 13 in withTexture pattern $ fill $ roundedRectangle (V2 20 20) 160 160 20 20 docimages/pattern_texture.png #The color used for all the texture.Gradient description.Linear gradient start point.Linear gradient end point.Gradient descriptionRadial gradient centerRadial gradient radiusGradient descriptionRadial gradient centerRadial gradient radiusRadial gradient focus pointThe full blown texture.A greyscale modulation texture.The resulting texture.WidthHeight!Dpi if text is present in patternPattern background colorDrawing defining the pattern ef ef ] !"#$%&'()**++,-. / 0 1 2 3 4 4 5 6 7 8 9 : ; < = > ? @ A A B C D E F F G H I J J K L M N O P Q R Q S T U V W X Y Z [ \ ] ^ _ ` a b c deefghijklmnopqrstu v w x x y z { | } ~                                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9:;< = > ? @ A B C D E F G H I J K L M N O P Q R S T U V WXYZ[\]^_`abcdefghijklmnoplqrstucvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVVWXYZ[Rasterific-0.6Graphics.RasterificGraphics.Rasterific.LinearGraphics.Rasterific.Outline#Graphics.Rasterific.TransformationsGraphics.Rasterific.TextureGraphics.Rasterific.LensesGraphics.Rasterific.ImmediateGraphics.Rasterific.PathWalkerGraphics.Rasterific.MiniLens$Graphics.Rasterific.QuadraticFormulaGraphics.Rasterific.OperatorsGraphics.Rasterific.TypesGraphics.Rasterific.CommandGraphics.Rasterific.Line#Graphics.Rasterific.QuadraticBezierGraphics.Rasterific.CubicBezierGraphics.Rasterific.Rasterize$Graphics.Rasterific.ComplexPrimitive"Graphics.Rasterific.PlaneBoundable"Graphics.Rasterific.StrokeInternalGraphics.Rasterific.CompositorGraphics.Rasterific.ShadingGraphics.Rasterific.MicroPdfFontyFruity-0.5.1.1Graphics.Text.TrueType getPointSize PointSizeMetricdot quadranceqddistancenormsignormEpsilonnearZeroAdditivezero^+^^-^lerpV1V2^*^/ normalizePoint PathCommandPathCubicBezierCurveToPathQuadraticBezierCurveTo PathLineToPath_pathOriginPoint _pathClose _pathCommandGeometry toPrimitives listToPrims PrimitivabletoPrim PrimitiveCubicBezierPrim BezierPrimLinePrim CubicBezier _cBezierX0 _cBezierX1 _cBezierX2 _cBezierX3Bezier _bezierX0 _bezierX1 _bezierX2Line_lineX0_lineX1 PointFoldable foldPoints Transformable transform SamplerRepeatSamplerReflect SamplerPad FillMethod FillEvenOdd FillWindingJoin JoinMiter JoinRoundCapCapRound CapStraight DashPattern StrokeWidthVectorpathToPrimitivesfirstTangeantOflastTangeantOf firstPointOf lastPointOfTransformation _transformA _transformC _transformE _transformB _transformD _transformFapplyTransformationapplyVectorTransformationrotate rotateCenterscale translateskewXskewY toNewXBaseinverseTransformationTextureGradient TextRange _textFont _textSize_text _textTextureDrawing dumpDrawing Traversal' TraversalLens'Lens linePointslineX0lineX1bezX0bezX1bezX2 bezierPointscbezX0cbezX1cbezX2cbezX3cubicBezierPointsprimitivePointspathCommandPoints pathPoints lineFromPathbezierFromPathcubicBezierFromPathclipcircleellipse rectangleroundedRectanglePlaneBoundable planeBounds PlaneBound_planeMinBound_planeMaxBound boundWidth boundHeightboundLowerLeftCornerapproximatePathLengthdashedStrokizestrokize ModulableRenderablePixelModulablePixel DrawOrder_orderPrimitives _orderTexture_orderFillMethod _orderMask DrawContexttransformOrderorderToDrawing fillOrderrunDrawContextfillWithTexturefillWithTextureAndMasktextToDrawOrders PathDrawer PathWalker PathWalkerTrunPathWalking advanceBycurrentPositioncurrentTangeantdrawOrdersOnPath withTexturewithGroupOpacitywithTransformationwithPathOrientationfillfillWithMethod withClippingstroke printTextAtprintTextRanges renderDrawingrenderOrdersAtDpiToPdfrenderDrawingAtDpiToPDFrenderDrawingAtDpi cacheDrawingdrawOrdersOfDrawing dashedStrokedashedStrokeWithOffsetpolylinepolygon drawImagedrawImageAtSizeline withSamplertransformTextureuniformTexturelinearGradientTexturesampledImageTextureradialGradientTextureradialGradientWithFocusTexturemodulateTexturepatternTexture.^.~.=%=+=useQuadraticFormula_coeffA_coeffB_coeffC discriminant formulaRoots$fApplicativeQuadraticFormula$fFunctorQuadraticFormula$fEpsilonDoublebaseGHC.Numabsghc-prim GHC.Classes<=$fEpsilonFloat $fMetricV2 $fAdditiveV1 $fAdditiveV2 $fEpsilonV2$fApplicativeV1$fApplicativeV2 $fFunctorV1$fNumV2 $fFunctorV2^&&^^||^^==^^<=^^<^^<^/=^vminvmaxvabsvfloorvceil clampPointmidPoint vpartitionnormalifZeroisNearbyisDistingableFrommiddle EdgeSample_sampleX_sampleY _sampleAlpha_sampleH $fGeometryf$fPrimitivableCubicBezier$fPrimitivableBezier$fPrimitivableLine$fPrimitivablePrimitive$fPointFoldableV2$fTransformableV2$fStorableEdgeSample ContainerProducerProxycontainerOfFunctioncontainerOfListlistOfContainerresplit$fPointFoldablePathCommand$fTransformablePathCommand$fPointFoldablePath$fTransformablePath$fPointFoldablef$fTransformablef$fPointFoldablePrimitive$fTransformablePrimitive$fGeometryCubicBezier$fGeometryBezier$fGeometryLine$fGeometryPrimitive$fGeometryPath$fPointFoldableCubicBezier$fTransformableCubicBezier$fShowCubicBezier$fPointFoldableBezier$fTransformableBezier $fShowBezier$fPointFoldableLine$fTransformableLine $fShowLinetransformCombinetransformationDeterminant$fMonoidTransformation DrawCommandWithPathOrientation WithTransform WithClipingWithImageEffectWithGlobalOpacity SetTextureTextFill DashedStrokeStrokeFillPatternTextureModulateTexture ShaderTexture RawTextureSampledTextureWithTextureTransform WithSamplerRadialGradientWithFocusTextureRadialGradientTextureLinearGradientTexture SolidTextureImageTransformerShaderFunction dumpTexture $fMonoidF$fFunctorDrawCommandlensclipLine extendLine isLinePoint lineLength sanitizeLine lineBreakAt flattenLine offsetLine decomposeLinebezierLengthApproximation straightLine clipBeziersanitizeBezier offsetBezier isBezierPointdecomposeBeziers bezierBreakAt splitBezier flattenBezier CachedBeziercubicBezierCircle extremumsclipCubicBeziercubicBezierBreakAt_cachedA_cachedB_cachedC_cachedDcubicBezierLengthApproximationisSufficientlyFlatsplitCubicBezierflattenCubicBezier cacheBeziercachedBezierAtcachedBezierDerivativeextremumPointscubicBezierBoundsoffsetCubicBezierdecomposeCubicBeziersisCubicBezierPointsanitizeCubicBeziercubicFromQuadraticBezier CoverageSpan _coverageX _coverageY _coverageVal_coverageLengthcombineEdgeSamples decompose xyComparesortEdgeSamples rasterize$fPlaneBoundablePrimitive$fPlaneBoundableCubicBezier$fPlaneBoundableBezier$fPlaneBoundableLine$fPlaneBoundableV2$fMonoidPlaneBound roundJoincaplinearizePrimitives lastPointlastPointAndNormalfirstPointAndNormalisPrimitivePointreversePrimitive lineFromTo miterJoinjoinPrimitivesoffsetPrimitives offsetAndJoinapproximateLengthsanitizeflattenPrimitivebreakPrimitiveAtflattensplitPrimitiveUntil dropPatternapproximatePrimitivesLengthdashize emptyValue fullValue clampCoveragemodulatemodivcoverageModulateemptyPx alphaOver alphaCompose Compositordiv255toWord8compositionDestinationcompositionAlpha$fModulableWord8$fModulableFloat solidColorshaderOfTexturetransformTextureToFillersampledImageShader imageShader GradientArrayFillerCoverageFillerTextureSpaceInfo_tsStart_tsDelta _tsCoverage _tsRepeat _tsBaseIndex shaderFillerprepareInfoNoTransform prepareInfocombineTransform withTransrepeatGradientreflectGradientgradientColorAtgradientColorAtRepeatlinearGradientShaderradialGradientShaderradialGradientWithFocusShader GHC.TypesIOmapExecisCoverageDrawable$fTransformableDrawOrder$fPlaneBoundableDrawOrder WalkerState _walkerPrimsPdfBaseColorableDomain PdfColorable pdfColorSpace colorToPdfMatrixToPdftoPdf PdfContext _pdfFreeIndex_generatedPdfObjects _pdfPatterns _pdfShadings_pdfGraphicStates _pdfXObjectsPdfResourceAssoc _resFreeIndex _resAssoc ResourcesPdfEnvPdfConfiguration _pdfConfDpi _pdfWidth _pdfHeight_pdfConfToOrder InnerRenderer PdfObject_pdfId _pdfRevision _pdfAnnot _pdfStreamPdfId PdfCommandglengthdomainOfCircledomainOfLinearGradient runPdfEnv resFreeIndexresAssoc pdfXObjects pdfPatterns pdfShadingspdfGraphicStatesisPixelTransparentisGradientTransparenttoAlphaGradienttoOpaqueGradientwithLocalSubcontext nameObjectnameStateObjectnameOpacityObject nameXObjectnamePatternObjectgenerateObject emptyContext buildToStricttp pdfSignaturerefOfarrayOflocalGraphicStatedicObjoutlinesObject pagesObject catalogObject pageObjectgradientPatternObjectlinearGradientObjectradialGradientObject contentObject pathToPdf maskObjectalphaMaskObjectopaState maskStatecolorInterpolationFunctionresourceObjectstitchingFunctionrepeatingFunctiontillingPatterngroupDic formObject gradientToPdfrepeatFunctioncreateGradientFunction fullPageFillgradientObjectGeneratoralphaLayerGeneratorsampledDomainOfcurrentViewBoxcreateLinearGradientcreateRadialGradient opacityToPdf textureToPdfreClose fillCommandOf clipCommandOf lineCapOf lineJoinOf orderToPdfbuildXRefTable buildTrailer toPdfSpacepdfFromProducerrenderDrawingToPdf pdfProducerrenderOrdersToPdfprepareObjects$fPdfColorablePixelRGBA8$fPdfColorableWord8$fToPdfPrimitive $fToPdfLine$fToPdfCubicBezier $fToPdfBezier $fToPdfV2$fToPdfPdfObject $fToPdf[] $fToPdfMatrix$fToPdfTransformation$fToPdfByteString $fToPdfFloat$fOrdPdfObject $fEqPdfObject RenderContext currentClipcurrentTexturecurrentTransformation cacheOrders