src/gui/image/qppmhandler.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   240             }
   240             }
   241         }
   241         }
   242     }
   242     }
   243 
   243 
   244     if (nbits == 1) {                                // bitmap
   244     if (nbits == 1) {                                // bitmap
   245         outImage->setNumColors(2);
   245         outImage->setColorCount(2);
   246         outImage->setColor(0, qRgb(255,255,255)); // white
   246         outImage->setColor(0, qRgb(255,255,255)); // white
   247         outImage->setColor(1, qRgb(0,0,0));        // black
   247         outImage->setColor(1, qRgb(0,0,0));        // black
   248     } else if (nbits == 8) {                        // graymap
   248     } else if (nbits == 8) {                        // graymap
   249         outImage->setNumColors(maxc+1);
   249         outImage->setColorCount(maxc+1);
   250         for (int i=0; i<=maxc; i++)
   250         for (int i=0; i<=maxc; i++)
   251             outImage->setColor(i, qRgb(i*255/maxc,i*255/maxc,i*255/maxc));
   251             outImage->setColor(i, qRgb(i*255/maxc,i*255/maxc,i*255/maxc));
   252     }
   252     }
   253 
   253 
   254     return true;
   254     return true;
   285         default:
   285         default:
   286             break;
   286             break;
   287         }
   287         }
   288     }
   288     }
   289 
   289 
   290     if (image.depth() == 1 && image.numColors() == 2) {
   290     if (image.depth() == 1 && image.colorCount() == 2) {
   291         if (qGray(image.color(0)) < qGray(image.color(1))) {
   291         if (qGray(image.color(0)) < qGray(image.color(1))) {
   292             // 0=dark/black, 1=light/white - invert
   292             // 0=dark/black, 1=light/white - invert
   293             image.detach();
   293             image.detach();
   294             for (int y=0; y<image.height(); y++) {
   294             for (int y=0; y<image.height(); y++) {
   295                 uchar *p = image.scanLine(y);
   295                 uchar *p = image.scanLine(y);