Twinside / Rasterific

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

CubicBezier rasterization on the edge of the image. #18

Closed pioole closed 9 years ago

pioole commented 9 years ago

Hello. I've tried to rasterize a small triangle using three CubicBeziers. It happens that the coordinates of one of the control points don't fit inside the image. The effect which you can see below is quite surprising, as part of the triangle that exceeds the image on the right, suddenly appears on the left. What do you think about it? Regards, Peter

yourimage

code:

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

main :: IO ()
main = do
 let img = renderDrawing 512 512 (PixelRGBA8 0 0 0 0) $
          withTexture (uniformTexture (PixelRGBA8 255 0 0 255)) $ do
              fill $ fmap CubicBezierPrim [CubicBezier (V2 104.707344 88.55418) (V2 153.00671 140.66666) (V2 201.30609 192.77914) (V2 249.60547 244.89162),CubicBezier (V2 249.60547 244.89162) (V2 349.59445 206.46687) (V2 449.58347 168.04214) (V2 549.57245 129.6174),CubicBezier (V2 549.57245 129.6174) (V2 401.28406 115.92966) (V2 252.99573 102.24192) (V2 104.707344 88.55418)]
 writePng "yourimage.png" img
Twinside commented 9 years ago

Looks like a genuine bug, I'll look into it ASAP

Twinside commented 9 years ago

As I'm not ready for the next release of Rasterific, I'm gonna make a backport of the fix.

Twinside commented 9 years ago

And the fix is on Hackage

pioole commented 9 years ago

Works like a charm!