All Projects → srwiley → rasterx

srwiley / rasterx

Licence: BSD-3-Clause license
Rasterx is an SVG 2.0 path compliant rasterizer that can use either scany, the golang vector or a derivative of the freetype anti-aliaser.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to rasterx

OptimizeRasters
OptimizeRasters is a set of tools for converting raster data to optimized Tiled TIF or MRF files, moving data to cloud storage, and creating Raster Proxies.
Stars: ✭ 105 (-1.87%)
Mutual labels:  raster
FreehandRasterGeoreferencer
QGIS plugin for the interactive georeferencing of rasters
Stars: ✭ 38 (-64.49%)
Mutual labels:  raster
core
Create 2d primitive shapes, encapsulate and repeat them by handling each repetition and generate recursive shapes
Stars: ✭ 34 (-68.22%)
Mutual labels:  2d-graphics
tigr
TIGR - the TIny GRaphics library for Windows, macOS, Linux, iOS and Android.
Stars: ✭ 413 (+285.98%)
Mutual labels:  2d-graphics
wetlandmapR
Scripts, tools and example data for mapping wetland ecosystems using data driven R statistical methods like Random Forests and open source GIS
Stars: ✭ 16 (-85.05%)
Mutual labels:  raster
geoserver-rest
Python library for management for geospatial data in GeoServer. The geoserver-rest docs is available here,
Stars: ✭ 119 (+11.21%)
Mutual labels:  raster
30DayMapChallenge
My contributions to the #30DayMapChallenge 2019, a daily challenge focusing on spatial visualizations happening throughout November.
Stars: ✭ 170 (+58.88%)
Mutual labels:  raster
MushROMs
Super Nintendo game editing libraries and tools
Stars: ✭ 24 (-77.57%)
Mutual labels:  2d-graphics
localtileserver
🌐 dynamic tile server for visualizing rasters in Jupyter with ipyleaflet or folium
Stars: ✭ 190 (+77.57%)
Mutual labels:  raster
ModernUI
Modern desktop framework from low-level 3D graphics API to high-level view model, for development of 2D/3D rendering software or game engine, with internationalization support and many new technologies.
Stars: ✭ 168 (+57.01%)
Mutual labels:  2d-graphics
enmSdm
Faster, better, smarter ecological niche modeling and species distribution modeling
Stars: ✭ 39 (-63.55%)
Mutual labels:  raster
NetCDF.jl
NetCDF support for the julia programming language
Stars: ✭ 102 (-4.67%)
Mutual labels:  raster
eemont
A python package that extends Google Earth Engine.
Stars: ✭ 290 (+171.03%)
Mutual labels:  raster
awesome-geospatial-list
A curated list of geospatial tools, data, tutorials, information, and more
Stars: ✭ 32 (-70.09%)
Mutual labels:  raster
spritekit-water-node
🌊 Custom SpriteKit node that allows to simulate 2D water with respect to physics. The app demonstrates Flocking behaviour using GameplayKit, key-frame animation and custom fragment shader chaining (GLSL) 🤯
Stars: ✭ 82 (-23.36%)
Mutual labels:  2d-graphics
fasterRaster
Faster raster processing using GRASS GIS
Stars: ✭ 18 (-83.18%)
Mutual labels:  raster
FlexCanvasJS
RIA Web Application Framework for HTML5 Canvas inspired by Adobe Flex / Flash. Style-able, skin-able, customize-able Javascript UI component set, from shapes to color pickers to data grids. Relative and dynamic layouts, automatic redraw regions, composite effects, and much more. Great for everything 2D, complex web forms to games.
Stars: ✭ 18 (-83.18%)
Mutual labels:  2d-graphics
profiletool
Home to the QGis Profiletool plugin. Initial work on this fork was partially funded by the C.A. La Rioja
Stars: ✭ 23 (-78.5%)
Mutual labels:  raster
glsl-smaa
SMAA (Enhanced Subpixel Morphological Antialiasing) post-processing; WebGL (OpenGL ES 2.0) implementation with no fluff.
Stars: ✭ 54 (-49.53%)
Mutual labels:  antialiasing
RayTracedGGX
Ray tracing sample using GGX reflection model, 1spp with spatial-temporal denoiser. Acceleration structure build uses async compute.
Stars: ✭ 43 (-59.81%)
Mutual labels:  antialiasing

rasterx

Rasterx is a golang rasterizer that implements path stroking functions capable of SVG 2.0 compliant 'arc' joins and explicit loop closing.

  • Paths can be explicity closed or left open, resulting in a line join or end caps.
  • Arc joins are supported, which causes the extending edge from a Bezier curve to follow the radius of curvature at the end point rather than a straight line miter, resulting in a more fluid looking join.
  • Not specified in the SVG2.0 spec., but supported in rasterx is the arc-clip join, which is the arc join analog of a miter-clip join, both of which end the miter at a specified distance, rather than all or nothing.
  • Several cap and gap functions in addition to those specified by SVG2.0 are implemented, specifically quad and cubic caps and gaps.
  • Line start and end capping functions can be different.

rasterx example

The above image shows the effect of using different join modes for a stroked curving path. The top stroked path uses miter (green) or arc (red, yellow, orange) join functions with high miter limit. The middle and lower path shows the effect of using the miter-clip and arc-clip joins, repectively, with different miter-limit values. The black chevrons at the top show different cap and gap functions.

Scanner interface

Rasterx takes the path description of lines, bezier curves, and drawing parameters, and converts them into a set of straight line segments before rasterizing the lines to an image using some method of antialiasing. Rasterx abstracts this last step through the Scanner interface. There are two different structs that satisfy the Scanner interface; ScannerGV and ScannerFT. ScannerGV wraps the rasterizer found in the golang.org/x/image/vector package. ScannerFT contains a modified version of the antialiaser found in the golang freetype translation. These use different functions to connect an image to the antialiaser. ScannerFT uses a Painter to translate the raster onto the image, and ScannerGV uses the vector's Draw method with a source image and uses the path as an alpha mask. Please see the test files for examples. At this time, the ScannerFT is a bit faster as compared to ScannerGV for larger and less complicated images, while ScannerGV can be faster for smaller and more complex images. Also ScannerGV does not allow for using the even-odd winding rule, which is something the SVG specification uses. Since ScannerFT is subject to freetype style licensing rules, it lives here in a separate repository and must be imported into your project seperately. ScannerGV is included in the rasterx package, and has more go-friendly licensing.

Below are the results of some benchmarks performed on a sample shape (the letter Q ). The first test is the time it takes to scan the image after all the curves have been flattened. The second test is the time it takes to flatten, and scan a simple filled image. The last test is the time it takes to flatten a stroked and dashed outline of the shape and scan it. Results for three different image sizes are shown.

128x128 Image
Test                        Rep       Time
BenchmarkScanGV-16          5000      287180 ns/op
BenchmarkFillGV-16          5000      339831 ns/op
BenchmarkDashGV-16          2000      968265 ns/op

BenchmarkScanFT-16    	   20000       88118 ns/op
BenchmarkFillFT-16    	    5000      214370 ns/op
BenchmarkDashFT-16    	    1000     2063797 ns/op

256x256 Image
Test                        Rep       Time
BenchmarkScanGV-16          2000     1188452 ns/op
BenchmarkFillGV-16          1000     1277268 ns/op
BenchmarkDashGV-16          500      2238169 ns/op

BenchmarkScanFT-16    	    5000      290685 ns/op
BenchmarkFillFT-16    	    3000      446329 ns/op
BenchmarkDashFT-16    	     500     2923512 ns/op

512x512 Image
Test                        Rep       Time
BenchmarkScanGV-16           500     3341038 ns/op
BenchmarkFillGV-16           500     4032213 ns/op
BenchmarkDashGV-16           200     6003355 ns/op

BenchmarkScanFT-16    	    5000      292884 ns/op
BenchmarkFillFT-16    	    3000      449582 ns/op
BenchmarkDashFT-16    	     500     2800493 ns/op

The package uses an interface called Rasterx, which is satisfied by three structs, Filler, Stroker and Dasher. The Filler flattens Bezier curves into lines and uses an anonymously composed Scanner for the antialiasing step. The Stroker embeds a Filler and adds path stroking, and the Dasher embedds a Stroker and adds the ability to create dashed stroked curves.

rasterx Scheme

Each of the Filler, Dasher, and Stroker can function on their own and each implement the Rasterx interface, so if you need just the curve filling but no stroking capability, you only need a Filler. On the other hand if you have created a Dasher and want to use it to Fill, you can just do this:

filler := &dasher.Filler

Now filler is a filling rasterizer. Please see rasterx_test.go for examples.

Non-standard library dependencies

rasterx requires the following imports which are not included in the go standard library:

  • golang.org/x/image/math/fixed
  • golang.org/x/image/vector

These can be included in your gopath by the following 'get' commands:

  • "go get golang.org/x/image/vector"
  • "go get golang.org/x/image/math/fixed"

If you want to use the freetype style antialiaser, 'go get' or clone into your workspace the scanFT package:

  • github.com/srwiley/scanFT
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].