32bool Screenshot::CopyImage(TASImage*
dst, TASImage*
src, Int_t x_dst, Int_t y_dst, Int_t x_src, Int_t y_src,
87 Screenshot::ScaleImage(TASImage*
image, UInt_t desiredWidth, UInt_t desiredHeight,
const std::string& backgroundColor)
123 int firstTFOrbit,
const std::string& collisionTime)
125 auto start = std::chrono::high_resolution_clock::now();
129 std::string backgroundColorHex =
"#000000";
130 TColor*
col = gROOT->GetColor(backgroundColor);
132 backgroundColorHex =
col->AsHexString();
150 CopyImage(
image, (TASImage*)view3dImage,
width * 0.015,
height * 0.025, 0, 0, view3dImage->GetWidth(),
151 view3dImage->GetHeight());
158 pixel_object_scale_rphi);
159 CopyImage(
image, (TASImage*)viewRphiImage,
width * 0.68,
height * 0.025, 0, 0, viewRphiImage->GetWidth(),
160 viewRphiImage->GetHeight());
161 delete viewRphiImage;
164 CopyImage(
image, (TASImage*)viewZYImage,
width * 0.68,
height * 0.525, 0, 0, viewZYImage->GetWidth(),
165 viewZYImage->GetHeight());
168 static std::map<std::string, TASImage*> aliceLogos;
169 TASImage* aliceLogo =
nullptr;
170 if (aliceLogos.find(prefix) != aliceLogos.end()) {
171 aliceLogo = aliceLogos.find(prefix)->second;
174 if (aliceLogo ==
nullptr) {
176 if (aliceLogo->IsValid()) {
177 double ratio = (double)(aliceLogo->GetWidth()) / (
double)(aliceLogo->GetHeight());
178 aliceLogo->Scale(0.08 *
width, 0.08 *
width / ratio);
179 aliceLogos[prefix] = aliceLogo;
182 if (aliceLogo !=
nullptr) {
183 if (aliceLogo->IsValid()) {
189 int o2LogoMarginX = 0.01 *
width;
190 int o2LogoMarginY = 0.01 *
width;
191 int o2LogoSize = 0.04 *
width;
193 static std::map<std::string, TASImage*> o2Logos;
194 TASImage* o2Logo =
nullptr;
195 if (o2Logos.find(prefix) != o2Logos.end()) {
196 o2Logo = o2Logos.find(prefix)->second;
199 if (o2Logo ==
nullptr) {
201 if (o2Logo->IsValid()) {
202 double ratio = (double)(o2Logo->GetWidth()) / (
double)(o2Logo->GetHeight());
203 o2Logo->Scale(o2LogoSize, o2LogoSize / ratio);
204 o2Logos[prefix] = o2Logo;
208 if (o2Logo !=
nullptr) {
209 if (o2Logo->IsValid()) {
210 double ratio = (double)(o2Logo->GetWidth()) / (
double)(o2Logo->GetHeight());
211 image->Merge(o2Logo,
"alphablend", o2LogoMarginX,
height - o2LogoSize / ratio - o2LogoMarginY);
215 int textX = o2LogoMarginX + o2LogoSize + o2LogoMarginX;
216 int textY =
height - o2LogoSize - o2LogoMarginY;
220 std::vector<std::string> lines;
221 if (!collisionTime.empty()) {
224 TString::Format(
"Run number: %d",
228 TString::Format(
"First TF orbit: %d",
232 TString::Format(
"Date: %s",
233 collisionTime.c_str())));
236 TString::Format(
"Detectors: %s",
237 detectorsString.c_str())));
242 int textLineHeight = 0.015 *
height;
244 for (
int i = 0;
i < 4;
i++) {
246 image->DrawText(textX, textY +
i * textLineHeight, lines[
i].c_str(),
fontSize,
"#BBBBBB",
"FreeSansBold.otf");
250 image->WriteImage(fileName.c_str(), TImage::kPng);
253 auto stop = std::chrono::high_resolution_clock::now();
254 auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop -
start);