TASImage not implemented for PDF

Dear All,

I already discussed with Rene, that TASImage shows a strange behavior for pdf outputs with the Alice Logo, therefore I prepared a short macro reproducing the problem. The output for gifs and eps is really good but in pdf files the logo is not displayed at all, which is annoying at some point, as I would like to create pdf, eps, gif outputs with the same script just changing the suffix.
May you please check this?

Unfortunately I can not attach the logo directly so I put it on
physi.uni-heidelberg.de/~fbock/

Regards Friederike
ALICELOGOdrawsimple.C (1.73 KB)

This is something known. The first version of TASImage was drawing simple boxes to render bitmap files in PostScript files. The generated huge PS files were almost unusable. To fix this problem I implemented a set of function:
[size=85]
virtual void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2)
virtual void CellArrayEnd()
virtual void CellArrayFill(Int_t r, Int_t g, Int_t b)
[/size]
These functions were implemented before I implemented the TPDF and TSVG classes. As storing a bitmap file in a vector graphics format does not really make sense, these functions have not been implemented yet in TPDF and TSVG (TPostScript was enough). But that’s on the “to-do” list. When you run your macro you get many messages saying these functions are not implemented. I guess you saw them for TSVG.

Now, It should be clear that PDF and SVG are not programming languages like PostScript therefore the PDF and SVG version of this set of functions will not be as clever as the PostScript one and the size of the generated files might be much bigger.

Note that there a message telling it is not yet implemented for PDF:

root [0]
Processing ALICELOGOdrawsimple.C...
Warning in <TASImage::Paint>: PDF not implemeted yet

With Qt layer “on” one can use the class doc.trolltech.com/4.6/qprinter.html .
You can define the output format doc.trolltech.com/4.6/qprinter.h … ormat-enum . Unfortunately, there is no ROOT generic interface (in the other words, there is no Qt-based implementation of ROOT TPDF class yet) to make your code free of the explicit Qt dependency as soon as PDF output is concern.
Fortunately, there is Qt-based implementation of ROOT TImage class and there is the dedicated method to convert TASImage into QImage.
To check the quality I created a small stand-alone application.

#include <QtGui> int main(int argc,char **argv) { QApplication aa(argc,argv); QImage im("rose512.jpg"); QPrinter pdf; pdf.setOutputFileName ("rose512.pdf"); QPainter p(&pdf); p.drawImage(QPoint(0,0),im); return 0; }

It reads the $ROOTSYS/tutorials/image/rose512.jpg 112 Kbytes image and writes it to 64 Kb pdf file attached.rose512.pdf (63.2 KB)
Here you are the Alice logo picked from eppog.web.cern.ch/eppog/Members/ … ments.html and converted to PDF with the code above ALICElogo.pdf (14.1 KB)

Hi Valeri,
Thanks for the input.
The quality of the logo is poor but may be that’s enough.
I am wondering your technique can render properly the image produced by:
$ROOTSYS/tutorials/rose_image.C
(ie: several pads).

[quote=“couet”]…The quality of the logo is poor but may be that’s enough.[/quote]The original gif is 130 x 130 pixels . I think the PDF is good enough. I did not find it is worse then the original gif. [quote=“couet”]I am wondering your technique can render properly the image produced by:$ROOTSYS/tutorials/rose_image.C
(ie: several pads).[/quote]The rose_image.C input is the pixmap image in jpg format. For such images one has to define the term “properly”. However, this issue has nothing to do with the “pdf” ( or any other file )format.
As soon as pdf format to represent the pixmap is concern the answer is," Yes, I do not see any insurmountable obstacle." For example, one could provide the Qt-based plugin either for TVirtualPS interface (see $ROOTSYS/etc/plugins/TVirtualPS ) or for TVirtualX . This way the user code could be free of Qt dependency. The user would be required to select the correct plugin. That’s. I think this is a good exercise for the smart summer student. (Yes, one will be required to maintain that code for years too :wink: