Git Product home page Git Product logo

Comments (6)

tariq1890 avatar tariq1890 commented on July 17, 2024

@fogleman Could you help us with this? Is there anything we must do to ensure less banding in the gradients generated.

This is a great library for generating gradients since its very simple and intuitive. It's unfortunate that we get such high banding.

from gg.

fogleman avatar fogleman commented on July 17, 2024

Can you post code and an image showing the effect? I don't see an issue in the gradient examples.

from gg.

tariq1890 avatar tariq1890 commented on July 17, 2024
grad := gg.NewLinearGradient(0, 0, 1920, 0)
	grad.AddColorStop(0, color.RGBA{0, 0, 0, 200})
	grad.AddColorStop(1, color.RGBA{0, 0, 0, 128})

	dc.SetFillStyle(grad)
	dc.MoveTo(0, 0)
	dc.LineTo(1920, 0)
	dc.LineTo(1920, 1080)
	dc.LineTo(0, 1080)
	dc.ClosePath()
	dc.Fill()
	gradientOverlay := dc.Image()
	imaging.Save(gradientOverlay, "out.png")

out

from gg.

fogleman avatar fogleman commented on July 17, 2024

Well the only way to improve that would be to go to a 16-bit image.

Currently gg only does 8-bit. It wouldn't be too hard to do 16-bit but might be API-breaking.

from gg.

tariq1890 avatar tariq1890 commented on July 17, 2024

Oh alright! Is it possible to create a v2 package? I am also happy to help through PRs if you can give me an overview of the places that require changing.

from gg.

fogleman avatar fogleman commented on July 17, 2024

It would start by changing RGBA -> NRGBA64 and Alpha -> Alpha16 throughout the code.

But it might not actually be so easy. The freetype/raster package which gg is built upon only seems to support RGBA and Alpha.

https://github.com/golang/freetype/blob/master/raster/paint.go

from gg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.