How to remove white border of transparent pad

I have a transparent pad with an image on top of a canvas, which is showing a white border which I want to remove, see attached screenshot. However, I do not know how to do it by command line. If I right-click on the border via the GUI, then press SetLineAttributes and set the opacity to zero, it works. Any hint how could I achieve this in my script?

See a minimal working example below with silly images. Tested with ROOT master.

void test_pad()
	TGMainFrame* mf = new TGMainFrame(gClient->GetRoot(), 100, 100);
	gStyle->SetCanvasPreferGL();//NEEDED for fast drawing.
	TRootEmbeddedCanvas* fCanvas = new TRootEmbeddedCanvas("c",mf,600,600);
	mf->AddFrame(fCanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 2, 2, 2, 2));
	TImage* fWater = TImage::Open("water.jpg");
	TPad *p = new TPad("p","p",0.2,0.2,0.8,0.8);
	TImage *img = TImage::Open("chili.png");

Once you have changed the opacity to 0., save the canvas as a .C file and you will see, is the created macro, what is needed.

Thanks for the idea, but this approach does not work. When I save the canvas as test.C, close ROOT, and run root -l test.C, I get again the white border.

See attached test.C
test.C (863 KB)

When I run your initial macro I am not able to display the GUI … what have you done ?

I just saved the initial macro to a file called test_pad.cpp and run it as “root -l test_pad.cpp”, see attachment. You need also to save chili.png and water.jpg in the same directory. Then I put the mouse on the white line border (this is tricky because it is thin), right-click, and then SetLineAttributes.

[code]Ubuntu 16.04

| Welcome to ROOT 6.09/01 |
| © 1995-2016, The ROOT Team |
| Built for linuxx8664gcc |
| From heads/master@v6-09-01-415-ge249831, Nov 18 2016, 15:35:41 |

Try ‘.help’, ‘.demo’, ‘.license’, ‘.credits’, ‘.quit’/’.q’

test_pad.cpp (884 Bytes)

You macro gives me the attached picture … no way to show the GUI like in you first Screen shot

That is very tricky. Just move very slowly the mouse from inside the (inner) pad to outside the main canvas. At some point, the mouse will show you the option to resize the pad, right click then.

I think this is a bug, that happens only when SetCanvasPreferGL is called. A white border is shown, even if you specify SetFrameLineWidth(0). Without GL it works fine.

If GL is active, I found a long and dirty workaround. If I add these lines at the end of my script, I am able to hide the white border:

	Int_t ci = TColor::GetFreeColorIndex();
	TColor *color = new TColor(ci, 0,0,0,"",0.);