Demonstrates how to access and manipulate ARGB pixel values of an image +...
- how to make a part of an image to be transparent.
- how to merge/alphablend an image with transparent colors with some background image.
i 0 0.000000 1.986693
i 1 0.100000 2.955202
i 2 0.200000 3.894183
i 3 0.300000 4.794255
i 4 0.400000 5.646425
i 5 0.500000 6.442177
i 6 0.600000 7.173561
i 7 0.700000 7.833269
i 8 0.800000 8.414710
i 9 0.900000 8.912074
i 10 1.000000 9.320391
i 11 1.100000 9.635582
i 12 1.200000 9.854497
i 13 1.300000 9.974950
i 14 1.400000 9.995736
i 15 1.500000 9.916648
i 16 1.600000 9.738476
i 17 1.700000 9.463001
i 18 1.800000 9.092974
i 19 1.900000 8.632094
*************** File trans_graph.png created ***************
{
}
void trans_graph()
{
gROOT->Macro(
"$ROOTSYS/tutorials/graphs/graph.C");
TImage *fore = dmp.GetImage();
gPad->SetCanvasSize(400, 300);
UInt_t col = argb[idx] & 0xffffff;
if ((col == rgb1) || (col == rgb2)) {
argb[idx] = 0;
} else {
argb[idx] = 0xff000000 + col;
}
}
}
back->
Merge(fore,
"alphablend", 20, 20);
printf("*************** File trans_graph.png created ***************\n");
delete back;
}
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Save canvas as an image (GIF, JPEG, PNG, XPM, TIFF etc.).
An abstract interface to image processing library.
static TImage * Open(const char *file, EImageFileTypes type=kUnknown)
Open a specified image file.
virtual UInt_t * GetArgbArray()
virtual UInt_t GetWidth() const
virtual void WriteImage(const char *, EImageFileTypes=TImage::kUnknown)
virtual void Merge(const TImage *, const char *="alphablend", Int_t=0, Int_t=0)
virtual UInt_t GetHeight() const
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
- Author
- Valeriy Onuchin
Definition in file trans_graph.C.