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

Rendering of single pixels icons no longer functions the same way #218

Open
Above-codes opened this issue May 4, 2021 · 2 comments
Open

Comments

@Above-codes
Copy link

Above-codes commented May 4, 2021

Between v0.9 and v1.1 of SharpMap the rendering function for a vactor layer has changed from the passing integers into the g.DrawImage function to passing doubles.
This means that icons aren't rendered exactly on single pixels so if you have a 1 pixel thick cross icon instead of it being rendered at X - 600, Y - 550 it gets renders at X - 600.1213, Y - 550.4871. Once these are drawn it looks like some kind of Anti-Aliasing is being applied but in reality the image is trying to be drawn as one pixel across two pixels. If that makes no sense at all there is an image that might make so more sense.
Image Example
The image is a little over exhaggerated and in reality the its not as light.

The 'quick fix' for this is to override the Render method and pass integers into the g.DrawImage method.

Not sure if this was an intented outcome of the change or if there should be an property in the vector layer or a vector style to not render across pixels and instead truncate or round the x, y value to the nearest integer?

@terribletim
Copy link
Contributor

The difference is probably related to Fix raster symbol not centred on point when scale != 1 and/or rotation is applied.
Rounding may work for an orthogonal cross similar to what you have shown, but I'm not sure it is a good solution for more complex and/or rotated raster symbols. You may want to look at the unit tests that were used to validate the current approach Rendering/Symbolizer/RasterPointSymbolizerTest.cs

@Above-codes
Copy link
Author

Above-codes commented May 5, 2021

So what about having a property in the style to allow for this? Or is it the case that overriding the rendering is the best practise here?

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy