{ "cells": [ { "cell_type": "markdown", "id": "b2057037", "metadata": {}, "source": [ "# greyscale\n", "\n", "\n", "\n", "\n", "**Author:** Olivier Couet \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:37 PM." ] }, { "cell_type": "code", "execution_count": 1, "id": "ff42997b", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:10.453166Z", "iopub.status.busy": "2026-05-19T20:37:10.452983Z", "iopub.status.idle": "2026-05-19T20:37:11.130817Z", "shell.execute_reply": "2026-05-19T20:37:11.113477Z" } }, "outputs": [], "source": [ "TCanvas *c = new TCanvas(\"grey\", \"Grey Scale\", 500, 500);\n", "c->SetBorderMode(0);\n", "\n", "Int_t n = 200; // tunable parameter\n", "Float_t n1 = 1. / n;\n", "for (int i = 0; i < n; i++) {\n", " for (int j = 0; j < n; j++) {\n", " TBox *b = new TBox(n1 * j, n1 * (n - 1 - i), n1 * (j + 1), n1 * (n - i));\n", " Float_t grey = Float_t(i * n + j) / (n * n);\n", " b->SetFillColor(TColor::GetColor(grey, grey, grey));\n", " b->Draw();\n", " }\n", "}\n", "TPad *p = new TPad(\"p\", \"p\", 0.3, 0.3, 0.7, 0.7);\n", "const char *guibackground = gEnv->GetValue(\"Gui.BackgroundColor\", \"\");\n", "p->SetFillColor(TColor::GetColor(guibackground));\n", "p->Draw();\n", "p->cd();\n", "TText *t = new TText(0.5, 0.5, \"GUI Background Color\");\n", "t->SetTextAlign(22);\n", "t->SetTextSize(.09);\n", "t->Draw();\n", "\n", "c->SetEditable(kFALSE);" ] }, { "cell_type": "markdown", "id": "6ffbe693", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": 2, "id": "f84ac0a8", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:37:11.150249Z", "iopub.status.busy": "2026-05-19T20:37:11.150105Z", "iopub.status.idle": "2026-05-19T20:37:11.671803Z", "shell.execute_reply": "2026-05-19T20:37:11.671393Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "
\n", "\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }