From d5c76a4f02527699331f4016d154fbf2cec418a1 Mon Sep 17 00:00:00 2001 From: Josh Kirklin Date: Thu, 7 Aug 2014 22:16:41 +0100 Subject: [PATCH] Add a 'minimalRender' function The ``minimalRender`` function is like ``render`` but does not do any setup for antialiasing. --- src/Graphics/DrawingCombinators.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Graphics/DrawingCombinators.hs b/src/Graphics/DrawingCombinators.hs index 312b10e..f4a0c9d 100644 --- a/src/Graphics/DrawingCombinators.hs +++ b/src/Graphics/DrawingCombinators.hs @@ -61,7 +61,7 @@ module Graphics.DrawingCombinators ( module Graphics.DrawingCombinators.Affine -- * Basic types - , Image, render, clearRender + , Image, render, minimalRender, clearRender -- * Selection , sample -- * Geometry @@ -135,8 +135,6 @@ instance (Monoid m) => Monoid (Image m) where -- lower left and (1,1) in the upper right). render :: Image a -> IO () render d = GL.preservingAttrib [GL.AllServerAttributes] $ do - GL.blend GL.$= GL.Enabled - GL.blendFunc GL.$= (GL.SrcAlpha, GL.OneMinusSrcAlpha) -- For now we assume the user wants antialiasing; the general solution is not clear - maybe let the -- user do the opengl setup stuff himself? otherwise need to wrap all of the possible things GL lets -- you set. @@ -145,6 +143,14 @@ render d = GL.preservingAttrib [GL.AllServerAttributes] $ do GL.lineWidth GL.$= 1.5 GL.hint GL.LineSmooth GL.$= GL.DontCare + minimalRender d + +-- |Like 'render', but does not do any setup for antialiasing. +minimalRender :: Image a -> IO () +minimalRender d = GL.preservingAttrib [GL.AllServerAttributes] $ do + GL.blend GL.$= GL.Enabled + GL.blendFunc GL.$= (GL.SrcAlpha, GL.OneMinusSrcAlpha) + dRender d identity white -- |Like 'render', but clears the screen first. This is so