Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A 1x1 box is semi-transparent #298

Closed
flexagoon opened this issue Feb 19, 2024 · 4 comments
Closed

A 1x1 box is semi-transparent #298

flexagoon opened this issue Feb 19, 2024 · 4 comments

Comments

@flexagoon
Copy link

It seems like the easiest way to paint a single pixel with Luxor.jl is like this:

box(p, 1, 1, :fill)

However, for some reason, this makes the box semi-transparent.

Example:

@draw begin
	background("blue")
	sethue("white")
	for x in -150:150
		for y in -150:150
			p = Point(x, y)
			box(p, 1, 1, :fill)
		end
	end
end

Expected result:

image

Actual result:

image

@cormullion
Copy link
Member

Hi! I believe antiasliasing is on by default. So try:

setantialias(1)

which switches it off.

See here for more.

@flexagoon
Copy link
Author

@cormullion that does fix the issue, thank you!

By the way, is there a better way of painting individual pixels? The only two methods I managed to find is either drawing a 1x1 box or manually creating a pixel matrix before initializing the drawing. The first one is much easier, but as it turns out it requires disabling antialiasing.

@cormullion
Copy link
Member

If you're going to be addressing pixels a lot, then you should probably be using Images.jl rather than Luxor.jl ... The only benefit of Luxor's "imagematrix" feature is being able to combine both simple pixel-addressing (where an image is merely a Julia array) with vector graphics and text ... The conflicting coordinate systems are mildly irritating though 😀

@flexagoon
Copy link
Author

Unfortunately I need both per-pixel drawing and vector shapes, so I can't really use Images.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants