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

CairoSurface using Float64 for width and height #321

Open
Cruor opened this issue May 21, 2020 · 5 comments
Open

CairoSurface using Float64 for width and height #321

Cruor opened this issue May 21, 2020 · 5 comments

Comments

@Cruor
Copy link

Cruor commented May 21, 2020

Is there a specific reason why they are stored as Float64s?. The documentation for Cairo uses integers for these. For example cairo-image-surface-get-height.

@lobingera
Copy link
Contributor

I think it's because the surface type is used for all surfaces and the vector surfaces like SVG and PDF are created in Float64 dimensions (https://www.cairographics.org/manual/cairo-SVG-Surfaces.html#cairo-svg-surface-create)

@Vexatos
Copy link

Vexatos commented May 22, 2020

In that case it would probably be better to either have two separate types or to allow the type to accept either int or float values, not convert everything to float.

@lobingera
Copy link
Contributor

Does storing Float64 introduce problems in your code?

@Vexatos
Copy link

Vexatos commented May 22, 2020

Having to convert between integers and floats a lot can be a minor performance issue when done a lot of times. And that kind of thing has to be done when doing maths involving exact pixels.

@donm
Copy link

donm commented Jul 31, 2020

FWIW, I was about to ask the same thing before I saw this issue. The Real and Float64 annotations made it harder for me to guess the purpose of those values, both investigating stuff at the REPL and when reading the code.

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

4 participants