i'm taking a few lines of code i've found on the internet and am trying to write the c++ equivalent, however, the documentation on some of these classes/functions is often vague or not as comprehensive as i would like. also, i don't have qt set up to run/test any of this myself as i only needed to figure out these 3 things.
here are three code samples i'm working with and my questions for each one:
QImage image2
= image1
->scaled
(image1
->size
()/2);
QImage image2 = image1->scaled(image1->size()/2);
To copy to clipboard, switch view to plain text mode
Question 1:
does 'QImage image2' malloc memory and then contain a scaled version of 'image1', OR is 'image1' actually being scaled itself and 'image2' is just a pointer to 'image1'?
for(y=0;y<height;y++){
QRgb* image2 = (QRgb*)image1->scanLine(y);
//...
for(y=0;y<height;y++){
QRgb* image2 = (QRgb*)image1->scanLine(y);
//...
To copy to clipboard, switch view to plain text mode
Question 2:
Same thing here. Is 'QRgb* image2' allocating memory to store the scanline of 'image1'?
QVector<QRgb> colortable;
image1->setColorTable(colortable);
QVector<QRgb> colortable;
image1->setColorTable(colortable);
To copy to clipboard, switch view to plain text mode
Question 3:
what exactly is setColorTable doing/creating? it seems to be some sort of array/list of unique colors found in 'image1' - sort of like a palette, but that's all i could guess. if so, is this list sorted in any fashion, or is there anything else that might be important to know about it?
thanks in advance for your help!!!
Bookmarks