Second thing, I don’t knows how to manage color,
the function Setimage want a *double,and I don’t know How to convert a rgb color inwhich red green and blue are represented by numbers between 0-255 in a double number
[code]
MianFrame::DoDraw()
{
TImage *img1;
img1 = TImage::Open(“1.pgm”);
double *vt= new double(4);
for (int i=0;i<4;i++)
vt[i]=1;
what you want to do is not possible yet. You can only display TImage’s in a TCanvas or a TRootEmbeddedCanvas, not directly in a TGMainFrame.
Further, the double arrays are only used if you want to set image data coming from another source (e.g. 2d array, CCD, etc.), not from a picture like l.pgm.
Have a look at the $ROOTSYS/tutorials/galaxy_image.C and rose_image.C
You have a syntax error (or maybe a typo) which could lead to any sort of problem.
You wrote:
double *vt= new double(4);
for (int i=0;i<4;i++) vt[i]=1;
This actually does
[ul]allocates enough memory for only ONE double and assigns it the value 4
write out-of bounds for 3 doubles causing all sort of possible problems.[/ul]
The correct code would be:
double *vt= new double[4];
for (int i=0;i<4;i++) vt[i]=1;
Note the brackets instead of paranthesis.