-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
TCanvas size is inconsistent in batch vs non-batch mode #11004
Comments
@ferdymercury : I do not think there is a lot we can do. The png file is not a screen copy and some rounding issues in completely different code might be possible (one or 2 pixels). I propose to close this issue. |
In my other computer, I get now a difference of 4 pixels using latest ROOT master. So it seems to me that this is not a small rounding error.
Could it be just an outdated calibration from many years ago? See this c3de92f Check out this code below. It seems there is always the same offset on my current computer. Whenever I run in batch mode, I get 4 pixels difference wrt batch mode. My hypothesis is that this could solved if those numbers are adapted, potentially depending on Windows / Mac with an if. It could be even added as a roottest. #include <TCanvas.h>
#include <TROOT.h>
#include <iostream>
void test_pixels() {
for(Int_t w=500;w<=900;w++) {
for(Int_t h=500;h<=600;h++) {
TCanvas *c = new TCanvas("c1","c1",w,h);
Int_t diffw = w-c->GetWw();
Int_t diffh = h-c->GetWh();
if(!gROOT->IsBatch()) {
if (diffw !=2 || diffh !=24)
std::cout << diffw << " " << diffh << " " << w << " " << h << std::endl;
}
else {
if (diffw !=4 || diffh !=28)
std::cout << diffw << " " << diffh << " " << w << " " << h << std::endl;
}
delete c;
}
}
} |
ok, I'll look again ... |
Sorry Olivier, I missed your reply. The loop was just to see if the offset of 4 pixels appeared always, or only if the canvas was big enough. Or also to see if the offset was proportional to canvas size or not. I am not creating PNGs in the snippet above, but rather looking at the graphics are size without borders, which is what the PNG should become later. I took the logic out of the ROOT documentation:
|
I am not sure we need to spend to much time on this issue as the new default grahics will be soon the one in the Web Browser. In the case the size of the canvas is completly different. There is a new PR on the way. In the master only for the time being. |
I cannot understand from the conversation: is the issue fixed now? |
No, it's not fixed, the script reproducing it is #11004 (comment) Though low priority ... |
Describe the bug
I see one small issue when saving a 600x600 TCanvas window as png.
I get:
Expected behavior
No pixel difference is found between running batch or not. Right now there is an offset of 1 up to 2 pixels.
To Reproduce
Setup
The text was updated successfully, but these errors were encountered: