Using TASImage as a hidden pad?

Hi,

I would like to create symbols to put then into the Picture pool. Thanks to bellenot it works for TPad quite well. The Problem is that I do not want to display those circles I’m drawing in a pad on the Form but I have update them before reading them by TImage::fromPad();

I saw now that there is an TASImage with methods implemented like DrawCircle(). But it crashes in my case on two independent machines with different root versions and setup. Most probably I’m doing something wrong. It does not work in a compiled version nor in an interpreted way:

void roottest(){
/*	
	TCanvas* c1 = new TCanvas("canvas","canvas",300,300);
	TASImage *img = (TASImage*)TImage::Create();
	img->FromPad(c1);
*/
	TASImage *img = new TASImage(300,300);
	img->DrawCircle(50, 5, 4);
}

*** Break *** segmentation violation

===========================================================
There was a crash (#7 0xb7ac9a8d in SigHandler () from /home/Promme/bin/root/lib/libCore.so).
This is the entire stack trace of all threads:

#0 0xffffe430 in __kernel_vsyscall ()
#1 0xb6e88933 in waitpid () from /lib/libc.so.6
#2 0xb6e2a12b in ?? () from /lib/libc.so.6
#3 0xb6f4304d in system () from /lib/libpthread.so.0
#4 0xb7ac338d in TUnixSystem::Exec () from /home/Promme/bin/root/lib/libCore.so
#5 0xb7ac8dae in TUnixSystem::StackTrace () from /home/Promme/bin/root/lib/libCore.so
#6 0xb7ac998d in TUnixSystem::DispatchSignals () from /home/Promme/bin/root/lib/libCore.so
#7 0xb7ac9a8d in SigHandler () from /home/Promme/bin/root/lib/libCore.so
#8 0xb7abffd2 in sighandler () from /home/Promme/bin/root/lib/libCore.so
#9
#10 0xb6272b51 in asim_apply_path () from /home/Promme/bin/root/lib/libASImage.so
#11 0xb6273356 in asim_straight_ellips () from /home/Promme/bin/root/lib/libASImage.so
#12 0xb627419d in asim_circle () from /home/Promme/bin/root/lib/libASImage.so
#13 0xb62356dc in TASImage::DrawCircle () from /home/Promme/bin/root/lib/libASImage.so
#14 0xb640f755 in G__G__Graf_182_0_58 () from /home/Promme/bin/root/lib/libGraf.so
#15 0xb72dfb36 in Cint::G__ExceptionWrapper () from /home/Promme/bin/root/lib/libCint.so
#16 0xb739506c in G__execute_call () from /home/Promme/bin/root/lib/libCint.so
#17 0xb7396a86 in G__call_cppfunc () from /home/Promme/bin/root/lib/libCint.so
#18 0xb73734af in G__interpret_func () from /home/Promme/bin/root/lib/libCint.so
#19 0xb735ecaa in G__getfunction () from /home/Promme/bin/root/lib/libCint.so
#20 0xb7453f3e in G__getstructmem () from /home/Promme/bin/root/lib/libCint.so
#21 0xb744d718 in G__getvariable () from /home/Promme/bin/root/lib/libCint.so
#22 0xb73305bf in G__getitem () from /home/Promme/bin/root/lib/libCint.so
#23 0xb7334fa2 in G__getexpr () from /home/Promme/bin/root/lib/libCint.so
#24 0xb73c4867 in G__exec_statement () from /home/Promme/bin/root/lib/libCint.so
#25 0xb7371564 in G__interpret_func () from /home/Promme/bin/root/lib/libCint.so
#26 0xb735ed83 in G__getfunction () from /home/Promme/bin/root/lib/libCint.so
#27 0xb73306c8 in G__getitem () from /home/Promme/bin/root/lib/libCint.so
#28 0xb7334fa2 in G__getexpr () from /home/Promme/bin/root/lib/libCint.so
#29 0xb7343138 in G__calc_internal () from /home/Promme/bin/root/lib/libCint.so
#30 0xb73d5609 in G__process_cmd () from /home/Promme/bin/root/lib/libCint.so
#31 0xb7ab2864 in TCint::ProcessLine () from /home/Promme/bin/root/lib/libCore.so
#32 0xb7aaeb97 in TCint::ProcessLineSynch () from /home/Promme/bin/root/lib/libCore.so
#33 0xb79d1bce in TApplication::ExecuteFile () from /home/Promme/bin/root/lib/libCore.so
#34 0xb79d1f1c in TApplication::ProcessFile () from /home/Promme/bin/root/lib/libCore.so
#35 0xb79cfbf6 in TApplication::ProcessLine () from /home/Promme/bin/root/lib/libCore.so
#36 0xb70a34f1 in TRint::Run () from /home/Promme/bin/root/lib/libRint.so
#37 0x08048ed5 in main ()

my root version is .26

What is my missunderstanding?

Maybe I’m drawing somehow over the allowed area?

        TASImage *img = new TASImage(500,500);
	img->DrawRectangle(300, 300, 300+10, 300+10, "#FFFFFF", 10);

works?!

Hi,

Try this way:

void test_img() { TImage *img = TImage::Create(); img->FillRectangle("#FFFFFF", 0, 0, 100, 100); img->BeginPaint(); img->DrawCircle(50, 50, 20); img->EndPaint(); img->WriteImage("test_img.png"); }
Cheers, Bertrand.

Funny, it works. I thought TImage is abstract and Painting is not Implemented?! However it works perfectly. Thanks again!