2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jukka Saastamoinen - jukka.saastamoinen@ixonos.com
6 Jussi Laitinen - jussi.laitinen@ixonos.com
8 Situare is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 version 2 as published by the Free Software Foundation.
12 Situare is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Situare; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23 #include "avatarimage.h"
27 const int IMAGE_WIDTH = 64; ///< Created image width
28 const int IMAGE_HEIGHT = 64; ///< Created image height
29 const int ORIGINAL_IMAGE_X = 7; ///< Original image x position
30 const int ORIGINAL_IMAGE_Y = 7; ///< Original image y position
31 const int ROUNDNESS = 9; ///< Image roundness
32 const int CLIP_X_OFFSET = 1; ///< Clip
34 QPixmap AvatarImage::create(const QPixmap &image)
36 // QPixmap avatarImage = QPixmap(IMAGE_WIDTH, IMAGE_HEIGHT);
37 // avatarImage.fill(Qt::transparent);
38 // QPainter painter(&avatarImage);
40 // QRect imageRect = QRect(0, 0, image.width(), image.height());
42 // QPainterPath roundedRect;
43 // roundedRect.addRoundedRect(ORIGINAL_IMAGE_X-1, ORIGINAL_IMAGE_Y-1, imageRect.width()+1,
44 // imageRect.height()+1,ROUNDNESS,ROUNDNESS);
46 // painter.setClipPath(roundedRect);
47 // painter.drawPixmap(QPointF(ORIGINAL_IMAGE_X, ORIGINAL_IMAGE_Y), image);
49 // painter.drawPixmap(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT,
50 // QPixmap(":/res/images/profile_pic_border.png"));
52 // return avatarImage;
56 //addroundedRect taitaa olla aika turhaa koodia
59 QPixmap avatarImage = QPixmap(image.width(), image.height());
60 avatarImage.fill(Qt::transparent);
61 QPainter painter(&avatarImage);
62 painter.setPen(Qt::red);
63 painter.drawPixmap(QPointF(0,0),image);
64 //painter.eraseRect(QRect(QPoint(0,0),QPoint(100,100)));
65 //painter.setWindow(QRect(0, 0, avatarImage.width()/2, avatarImage.height()/2)); ei vaikuta
66 //painter.setViewport(QRect(0, 0, avatarImage.width()/2, avatarImage.height()/2)); ei vaikuta
67 painter.drawRect(QRect(0,0,30,40));
68 painter.drawRoundedRect(QRect(10,10,30,30),3,3,Qt::AbsoluteSize);
69 QPixmap valo(":res/images/gps_position_accurate.png");
70 painter.drawPixmap(QPointF(20,30), valo);