I thought i knew how to do it when i was traveling with a train but now that i tried doing it it doesn't work... Can someone please tell me how to do it properly, or what am i missing here... I tried doing something and the picture stay the same :
{
setPixmap(*t);
//setOpacity(0.5);
setPos(game->width()/2-this->boundingRect().width()/2,game->height()/2-this->boundingRect().height()/2);
for(int i=0;i<tmp.height();i++){
for(int k=0;k<tmp.width();k++){
//color.setRgb(255*0.5,255*0.5,255*0.5);
color.setRgb(tmp.pixel(k,i));
//color.setAlpha(tmp.pixelColor(k,i).alpha());
color.setRgb(color.red()*0.5,color.blue()*0.5,color.green()*0.5);
tmp.setPixelColor(k,i,color);
}
}
t->fromImage(tmp);
}
Player::Player(QGraphicsPixmapItem *parent)
{
QPixmap *t = new QPixmap(":/Images/PlayerMoveDownStill.png");
setPixmap(*t);
//setOpacity(0.5);
setPos(game->width()/2-this->boundingRect().width()/2,game->height()/2-this->boundingRect().height()/2);
QImage tmp = t->toImage();
QColor color;
for(int i=0;i<tmp.height();i++){
for(int k=0;k<tmp.width();k++){
//color.setRgb(255*0.5,255*0.5,255*0.5);
color.setRgb(tmp.pixel(k,i));
//color.setAlpha(tmp.pixelColor(k,i).alpha());
color.setRgb(color.red()*0.5,color.blue()*0.5,color.green()*0.5);
tmp.setPixelColor(k,i,color);
}
}
t->fromImage(tmp);
}
To copy to clipboard, switch view to plain text mode
Bookmarks