{ "cells": [ { "cell_type": "markdown", "id": "50d58bcd", "metadata": {}, "source": [ "# trans_graph\n", "Demonstrates how to access and manipulate ARGB pixel values of an image +...\n", " - how to make a part of an image to be transparent.\n", " - how to merge/alphablend an image with transparent colors\n", " with some background image.\n", "\n", "\n", "\n", "\n", "**Author:** Valeriy Onuchin \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:38 PM." ] }, { "cell_type": "markdown", "id": "611715e4", "metadata": {}, "source": [ " Definition of a helper function: " ] }, { "cell_type": "code", "execution_count": 1, "id": "977de68d", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:47.293027Z", "iopub.status.busy": "2026-05-19T20:38:47.292916Z", "iopub.status.idle": "2026-05-19T20:38:47.299171Z", "shell.execute_reply": "2026-05-19T20:38:47.298633Z" } }, "outputs": [], "source": [ "%%cpp -d\n", "\n", "#include \"TColor.h\"\n", "#include \"TImage.h\"\n", "#include \"TImageDump.h\"\n", "#include \"TVirtualPad.h\"\n", "#include \"TROOT.h\"\n", "#include \"TFrame.h\"\n", "\n", "UInt_t color2rgb(TColor *col)\n", "{\n", " // returns RGB value of color\n", "\n", " return ((UInt_t(col->GetRed() * 255) << 16) + (UInt_t(col->GetGreen() * 255) << 8) + UInt_t(col->GetBlue() * 255));\n", "}" ] }, { "cell_type": "markdown", "id": "0565a751", "metadata": {}, "source": [ "remember if we are in batch mode" ] }, { "cell_type": "code", "execution_count": 2, "id": "22a6f27a", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:47.300282Z", "iopub.status.busy": "2026-05-19T20:38:47.300165Z", "iopub.status.idle": "2026-05-19T20:38:47.630279Z", "shell.execute_reply": "2026-05-19T20:38:47.629576Z" } }, "outputs": [], "source": [ "Bool_t batch = gROOT->IsBatch();" ] }, { "cell_type": "markdown", "id": "7b32f87a", "metadata": {}, "source": [ "switch to batch mode" ] }, { "cell_type": "code", "execution_count": 3, "id": "92f6c394", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:47.631694Z", "iopub.status.busy": "2026-05-19T20:38:47.631564Z", "iopub.status.idle": "2026-05-19T20:38:47.843824Z", "shell.execute_reply": "2026-05-19T20:38:47.843159Z" } }, "outputs": [], "source": [ "gROOT->SetBatch(kTRUE);" ] }, { "cell_type": "markdown", "id": "2370deb2", "metadata": {}, "source": [ "execute gr001_simple.C macro" ] }, { "cell_type": "code", "execution_count": 4, "id": "ba8181b6", "metadata": { "collapsed": false, "execution": { "iopub.execute_input": "2026-05-19T20:38:47.845300Z", "iopub.status.busy": "2026-05-19T20:38:47.845185Z", "iopub.status.idle": "2026-05-19T20:38:48.048410Z", "shell.execute_reply": "2026-05-19T20:38:48.047850Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "\n", "