#include <QPainter>
#include <QDebug>
-const int IMAGE_WIDTH = 60; ///< Created image width
-const int IMAGE_HEIGHT = 60; ///< Created image height
-const int ORIGINAL_IMAGE_X = 5; ///< Original image x position
-const int ORIGINAL_IMAGE_Y = 5; ///< Original image y position
+const int IMAGE_WIDTH = 64; ///< Created image width
+const int IMAGE_HEIGHT = 64; ///< Created image height
+const int ORIGINAL_IMAGE_X = 7; ///< Original image x position
+const int ORIGINAL_IMAGE_Y = 7; ///< Original image y position
const int ROUNDNESS = 9; ///< Image roundness
const int CLIP_X_OFFSET = 1; ///< Clip
QPixmap AvatarImage::create(const QPixmap &image)
{
- QPixmap avatarImage = QPixmap(60, 60);
+// QPixmap avatarImage = QPixmap(IMAGE_WIDTH, IMAGE_HEIGHT);
+// avatarImage.fill(Qt::transparent);
+// QPainter painter(&avatarImage);
+//
+// QRect imageRect = QRect(0, 0, image.width(), image.height());
+//
+// QPainterPath roundedRect;
+// roundedRect.addRoundedRect(ORIGINAL_IMAGE_X-1, ORIGINAL_IMAGE_Y-1, imageRect.width()+1,
+// imageRect.height()+1,ROUNDNESS,ROUNDNESS);
+// painter.save();
+// painter.setClipPath(roundedRect);
+// painter.drawPixmap(QPointF(ORIGINAL_IMAGE_X, ORIGINAL_IMAGE_Y), image);
+// painter.restore();
+// painter.drawPixmap(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
+// QPixmap(":/res/images/profile_pic_border.png"));
+//
+// return avatarImage;
+
+
+
+ //addroundedRect taitaa olla aika turhaa koodia
+
+
+ QPixmap avatarImage = QPixmap(image.width(), image.height());
avatarImage.fill(Qt::transparent);
QPainter painter(&avatarImage);
+ painter.setPen(Qt::red);
+ painter.drawPixmap(QPointF(0,0),image);
+ //painter.eraseRect(QRect(QPoint(0,0),QPoint(100,100)));
+ //painter.setWindow(QRect(0, 0, avatarImage.width()/2, avatarImage.height()/2)); ei vaikuta
+ //painter.setViewport(QRect(0, 0, avatarImage.width()/2, avatarImage.height()/2)); ei vaikuta
+ painter.drawRect(QRect(0,0,30,40));
+ painter.drawRoundedRect(QRect(10,10,30,30),3,3,Qt::AbsoluteSize);
+ QPixmap valo(":res/images/gps_position_accurate.png");
+ painter.drawPixmap(QPointF(20,30), valo);
+
- QRect imageRect = QRect(0, 0, image.width(), image.height());
-
- QPainterPath roundedRect;
- roundedRect.addRoundedRect(ORIGINAL_IMAGE_X-1, ORIGINAL_IMAGE_Y-1, imageRect.width()+1,
- imageRect.height()+1,ROUNDNESS,ROUNDNESS);
- painter.save();
- painter.setClipPath(roundedRect);
- painter.drawPixmap(QPointF(ORIGINAL_IMAGE_X, ORIGINAL_IMAGE_Y), image);
- painter.restore();
- painter.drawPixmap(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
- QPixmap(":/res/images/profile_pic_border.png"));
return avatarImage;
}