39 Unstar Star 52 Fork 12

tboox / hnrC

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
imageconvector.cpp 854 Bytes
Copy Edit Web IDE Raw Blame History
ruki authored 2013-07-02 14:09 . ...
#include "imageconvector.h"
ImageConvector::ImageConvector()
{
}
image_type ImageConvector::convect(QImage const& qimage)
{
image_type image(qimage.width(), qimage.height());
for (int px = 0; px < qimage.width(); ++px)
{
for (int py = 0; py < qimage.height(); ++py)
{
QRgb qrgb = qimage.pixel(px, py);
image.at(px, py).red(qRed(qrgb));
image.at(px, py).green(qGreen(qrgb));
image.at(px, py).blue(qBlue(qrgb));
}
}
return image;
}
QImage ImageConvector::convect(image_type const& image)
{
QImage qimage(image.width(), image.height(), QImage::Format_RGB32);
for (int px = 0; px < image.width(); ++px)
{
for (int py = 0; py < image.height(); ++py)
{
qimage.setPixel(px, py, qRgb(image.at(px, py).red(), image.at(px, py).green(), image.at(px, py).blue()));
}
}
return qimage;
}

Comment ( 0 )

Sign in for post a comment

C
1
https://gitee.com/tboox/hnr.git
git@gitee.com:tboox/hnr.git
tboox
hnr
hnr
master

Search

131423 f1aaba0b 1899542 094922 1c74bed3 1899542