rasterific-svg 0.2.3.2 → 0.3
raw patch · 5 files changed
+50/−43 lines, 5 filesdep ~svg-treesetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: svg-tree
API changes (from Hackage documentation)
Files
- LICENSE +30/−30
- Setup.hs +2/−2
- changelog +4/−0
- rasterific-svg.cabal +3/−3
- src/Graphics/Rasterific/Svg/RasterificRender.hs +11/−8
LICENSE view
@@ -1,30 +1,30 @@-Copyright (c) 2013, Vincent Berthoux--All rights reserved.--Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:-- * Redistributions of source code must retain the above copyright- notice, this list of conditions and the following disclaimer.-- * Redistributions in binary form must reproduce the above- copyright notice, this list of conditions and the following- disclaimer in the documentation and/or other materials provided- with the distribution.-- * Neither the name of Vincent Berthoux nor the names of other- contributors may be used to endorse or promote products derived- from this software without specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+Copyright (c) 2013, Vincent Berthoux + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Vincent Berthoux nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple-main = defaultMain+import Distribution.Simple +main = defaultMain
changelog view
@@ -1,6 +1,10 @@ Change log ========== +v0.3 February 2015+------------------+ * Fix: Updating to handle svg-tree 0.4+ v0.2.3.2 October 2015 --------------------- * Fix: bumping optparse-applicative upper bound
rasterific-svg.cabal view
@@ -1,7 +1,7 @@ -- Initial svg.cabal generated by cabal init. For further documentation, -- see http://haskell.org/cabal/users-guide/ name: rasterific-svg-version: 0.2.3.2+version: 0.3 synopsis: SVG renderer based on Rasterific. description: SVG renderer that will let you render svg-tree parsed SVG file to a JuicyPixel image or Rasterific Drawing.@@ -22,7 +22,7 @@ Source-Repository this Type: git Location: git://github.com/Twinside/rasterific-svg.git- Tag: v0.2.3.2+ Tag: v0.3 library hs-source-dirs: src@@ -46,7 +46,7 @@ , containers >= 0.5 , Rasterific >= 0.6.1 && < 0.7 , FontyFruity >= 0.5 && < 0.6- , svg-tree >= 0.3.1 && < 0.4+ , svg-tree >= 0.4.1 && < 0.5 , lens >= 4.5 && < 5 , linear >= 1.16 , vector >= 0.10
src/Graphics/Rasterific/Svg/RasterificRender.hs view
@@ -96,12 +96,15 @@ uuWidth = toUserUnit dpi <$> _width doc uuHeight = toUserUnit dpi <$> _height doc (x1, y1, x2, y2) = case (_viewBox doc, uuWidth, uuHeight) of- (Just v, _, _) -> v- ( _, Just (Num w), Just (Num h)) -> (0, 0, floor w, floor h)+ (Just (xx1, yy1, xx2, yy2), _, _) ->+ (realToFrac xx1, realToFrac yy1, realToFrac xx2, realToFrac yy2)+ ( _, Just (Num w), Just (Num h)) ->+ (0, 0, integralClamp w, integralClamp h) _ -> (0, 0, 1, 1)+ + integralClamp = fromIntegral . (\a -> a :: Int) . floor - box = (V2 (fromIntegral x1) (fromIntegral y1),- V2 (fromIntegral x2) (fromIntegral y2))+ box = (V2 x1 y1, V2 x2 y2) emptyContext = RenderContext { _renderViewBox = box , _initialViewBox = box@@ -331,7 +334,7 @@ mergeContext :: RenderContext -> DrawAttributes -> RenderContext mergeContext ctxt _attr = ctxt -viewBoxOfTree :: Tree -> Maybe (Int, Int, Int, Int)+viewBoxOfTree :: Tree -> Maybe (Double, Double, Double, Double) viewBoxOfTree (SymbolTree (Symbol g)) = _groupViewBox g viewBoxOfTree _ = Nothing @@ -433,7 +436,7 @@ fitBox :: RenderContext -> DrawAttributes -> Point -> Maybe Number -> Maybe Number -> Point- -> Maybe (Int, Int, Int, Int)+ -> Maybe (Double, Double, Double, Double) -> R.Drawing px () -> R.Drawing px () fitBox ctxt attr basePoint mwidth mheight preTranslate viewbox =@@ -445,8 +448,8 @@ case viewbox of Nothing -> R.withTransformation (RT.translate origin) (Just (xs, ys, xe, ye)) ->- let boxOrigin = V2 (fromIntegral xs) (fromIntegral ys)- boxEnd = V2 (fromIntegral xe) (fromIntegral ye)+ let boxOrigin = V2 (realToFrac xs) (realToFrac ys)+ boxEnd = V2 (realToFrac xe) (realToFrac ye) V2 bw bh = abs $ boxEnd ^-^ boxOrigin xScaleFactor = case w of Just wpx -> wpx / bw