Twinside / Rasterific

A drawing engine in Haskell
BSD 3-Clause "New" or "Revised" License
140 stars 11 forks source link

Omitted bezier path #44

Closed Vekkq closed 6 years ago

Vekkq commented 6 years ago

Hello, I tried to render a closed path, consisting of a single cubic bezier. But on some sizes, it renders nothing.

{-# LANGUAGE NoMonomorphismRestriction #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}

import Codec.Picture (PixelRGBA8(..), writePng)
import Graphics.Rasterific
import Graphics.Rasterific.Texture
import Graphics.Rasterific.Transformations

generateImage a = let
    (imgx, imgy) = (1280, 720)
    in renderDrawing imgx imgy (greyN 200) $
        withTransformation (translate (V2 (imgx/2) (imgy/2))) $
            withTexture (uniformTexture (greyN 100)) $ fill $ 
                Path (V2 0 0) True [PathCubicBezierCurveTo (V2 a a) (V2 a (-a)) (V2 0 0)]

greyN n = PixelRGBA8 n n n 255

main = do
    writePng "IssueSample.png" $ generateImage 400
    writePng "IssueSample2.png" $ generateImage 300

The code generates two images, which both should show a filled path. However, the second image is empty.

I experimented a bit with the sizes. The working path size seems to depend on the image size. On 1920x1080, it also won't show the filled path in the first image.