Java教程

qt图像生成工具类

本文主要是介绍qt图像生成工具类,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

picutil.h–图像生成

#ifndef PICUTIL_H
#define PICUTIL_H


#include <QPainter>
#include <QFont>
#include <QBrush>
#include <QColor>
#include <QPaintDevice>
#include <QPaintEngine>
#include <QPixmap>
#include <QPainterPath>
#include <QDebug>
#include <QLCDNumber>
#include <QRect>
#include <QRectF>
#include <QPoint>
#include <QPointF>
#include <QLabel>
#include <QTimer>
#include <QFile>
#include "filter.h"

namespace picShtUtil {
class generalImage
{
public:
    generalImage() {}
    QList<QStringList> data;
    QList<QStringList> colorList;//画板
    int max_radio_real=0;//高温权重
    int min_radio_real=0;
    int max_point_x;//高温32*32坐标点
    int max_point_y;
    int min_point_x;//低温32*32坐标点
    int min_point_y;
    float max;//高温上传值
    float min;
    int pow=256;//色阶权重
    const long _RADIUS = 10;

    //生成图像
    QImage becomeImage(float maxT,float minT,QStringList dataList){
        //第一步:画板初始化
            ini();
        //第二步:数据处理
            getData(maxT,minT,dataList);//数据处理
        //第三步:成图
            // 创建一个 QImage 对象
            QImage image(32, 32, QImage::Format_RGB32);
            QRgb value;
            // 改变指定区域的像素点的值
            for(int i=0;i<32;i++){
                for(int j=0;j<32;j++){
                    QString realData=data.at(i).at(j);
                    int ratio=realData.toInt();
                    if(ratio==max_radio_real){//高温点--黑
                        uint red = 0;
                        uint green = 0;
                        uint blue = 0;
                        value = qRgb(red, green, blue);
                        image.setPixel(i, j, value);
                        //获取点的位置
                        max_point_x=i;
                        max_point_y=j;
                    }else if(ratio==min_radio_real){//低温点--白
                        uint red = 255;
                        uint green = 255;
                        uint blue = 255;
                        value = qRgb(red, green, blue);
                        image.setPixel(i, j, value);
                        //获取点的位置
                        min_point_x=i;
                        min_point_y=j;
                    }
                    else{
                        QStringList rgb=colorList.at(ratio);
                        QString redTemp =rgb.at(0);
                        QString greenTemp=rgb.at(1);
                        QString blueTemp =rgb.at(2);
                        uint red = redTemp.toInt();
                        uint green = greenTemp.toInt();
                        uint blue = blueTemp.toInt();
                        value = qRgb(red, green, blue);
                        image.setPixel(i, j, value);    // 设置每个像素点的值
                    }

                }
            }
            image=image.scaled(320,320, Qt::KeepAspectRatio);//放大10倍

            //高斯模糊处理
            QImage image_deal;
            image_deal=image.convertToFormat(QImage::Format_RGB888);
            static filter::pair_t pair[] =
            {
                { filter::Gauss, filter::Blur1D },
                { filter::Gauss, filter::Blur2D }
            };
            filter::bitmap_t bmp;
            bmp.set((filter::bitmap_t::pixel_t*)image_deal.bits(),
                   image_deal.width(), image_deal.height());
            filter::Filter(pair[0], bmp, _RADIUS);

            //图像90度顺时针旋转+绘制文字
            QMatrix leftmatrix;
            leftmatrix.rotate(90);
            image_deal=image_deal.transformed(leftmatrix);//旋转90度
            QPainter painter1(&image_deal);
            //在图像上标注点
            //高温
            int change_point_x_max=320-max_point_y*10;
            int change_point_y_max=max_point_x*10;
            painter1.drawText(QPoint(change_point_x_max,change_point_y_max),QString::number(max));
            //低温
            int change_point_x_min=320-min_point_y*10;
            int change_point_y_min=min_point_x*10;
            painter1.drawText(QPoint(change_point_x_min,change_point_y_min),QString::number(min));


            return image_deal;
    }
    //初始化
    void ini(){
        //根据线性渐变色条得到颜色表
        QLinearGradient linear=QLinearGradient(QPoint(0,0),QPoint(pow-1,0));

        linear.setColorAt(0, Qt::blue);
        linear.setColorAt(0.3, Qt::blue);
        linear.setColorAt(0.4, Qt::green);
        linear.setColorAt(0.5, Qt::yellow);
        linear.setColorAt(1, Qt::red);

        //把渐变色绘制到Img方便取颜色
        QImage img(pow,1,QImage::Format_ARGB32);
        QPainter painter(&img);
        painter.fillRect(img.rect(),linear);
        QStringList temp;
        for(quint32 i=0;i<pow;i++){
            QColor color=img.pixel(i,0);
            temp << QString::number(color.red())  <<  QString::number(color.green())<< QString::number(color.blue());
            colorList <<temp;
            temp.clear();
        }
    }
    //数据处理
    void getData(float maxT,float minT,QStringList dataList){
        data.clear();
        max=maxT;
        min=minT;
        QStringList temp;
        for(int i=0;i<dataList.count();i++){
            QString numTemp=dataList.at(i);
            float num=numTemp.toFloat();
            int radio=(num-min)/(max-min)*(pow-1);
            temp << QString::number(radio);
            if(((i+1)%32==0)&&(i!=0)){
                data <<temp;
                temp.clear();
            }
            if(num==max){
                max_radio_real=radio;
            }
            if(num==min){
                min_radio_real=radio;
            }

        }
    }

};
}
#endif // PICUTIL_H

filter.h–高斯工具类

//
// Image Filter
//
// Author:	darkcat
// Blog:	http://darkc.at
// E-Mail:	memleak@darkc.at
// Version:	20130810
//

#ifndef __filter_h__
#define __filter_h__

#include <math.h>
#include <new>

//

#ifndef FILTER_ALLOC
#define FILTER_ALLOC filter::alloc_t
#endif/*FILTER_ALLOC*/

//

namespace filter
{
    struct alloc_t
    {
        static void* alloc(unsigned int size) { return ::malloc(size); }
        static void  free (void* ptr)         { ::free(ptr); }
    };

    template <typename TypeT, typename AllocT = FILTER_ALLOC>
    class auto_t
    {
    protected:
        TypeT* _point;
        long _size;

    public:
        auto_t() : _point(0), _size(0) {}
        auto_t(long size) :
            _point(::new (AllocT::alloc(sizeof(TypeT) * size)) TypeT[size])
          , _size(size) {}
        virtual ~auto_t()
        {
            if (_point)
            {
                for (long i = 0; i < _size; ++i) _point[i].~TypeT();
                AllocT::free(_point);
            }
        }

        void set(long size)
        {
            this->~auto_t();
            ::new (this) auto_t(size);
        }

        long size() { return _size; }

        TypeT& operator[](long num) { return _point[num]; }
    };

    //

    class bitmap_t
    {
    public:
        typedef unsigned char channel_t;

        struct pixel_t
        {
            channel_t r, g, b;
            pixel_t() : r(0), g(0), b(0) {}
        };

        struct buff_t
        {
            double r, g, b;
            buff_t() : r(0.0), g(0.0), b(0.0) {}
        };

    protected:
        pixel_t* _bits;
        long _w, _h, _size;

    public:
        bitmap_t() : _bits(0), _w(0), _h(0), _size(0) {}

        void set(pixel_t* bits, long w, long h)
        {
            _bits = bits;
            _w = w;
            _h = h;
            _size = 0;
        }

        long w() { return _w; }
        long h() { return _h; }

        long size()
        {
            if (_size) return _size;
            else       return _size = _w * _h;
        }

        pixel_t& operator[](long num) { return _bits[num]; }
    };

    class buffer_t : public auto_t<bitmap_t::buff_t>
    {
    public:
        buffer_t() {}
        buffer_t(bitmap_t& bitmap) : 
            auto_t<bitmap_t::buff_t>(bitmap.size()) {}

        void set(bitmap_t& bitmap)
        { ::new (this) buffer_t(bitmap); }
    };

    class filter_t : public auto_t<double>
    {
    protected:
        long _radius;

    public:
        filter_t() {}
        filter_t(long radius, long size) : 
            auto_t<double>(size), _radius(radius) {}

        void set(long radius, long size)
        { ::new (this) filter_t(radius, size); }

        long radius() { return _radius; }
    };

    static const double PI = 3.141592653589793;

    //

    template <typename T1, typename T2>
    T1 Clamp(T2 n) { return (T1)(n > (T1)~0 ? (T1)~0 : n); }

    template <typename T>
    T Diamet(T r) { return ((r * 2) + 1); }

    template <typename T>
    bool Equal(T n1, T n2) { return (fabs(n1 - n2) < (T)0.000001); }

    template <typename T>
    T Edge(T i, T x, T w)
    {
        T i_k = x + i;
        if      (i_k < 0)  i_k = -x;
        else if (i_k >= w) i_k = w - 1 - x;
        else               i_k = i;
        return i_k;
    }

    void Normalization(filter_t& kernel)
    {
        double sum = 0.0;
        for(int n = 0; n < kernel.size(); ++n)
            sum += kernel[n];
        if (Equal(sum, 1.0)) return;
        for(int n = 0; n < kernel.size(); ++n)
            kernel[n] = kernel[n] / sum;
    }

    //

    void Blur1D(bitmap_t& bitmap, filter_t& kernel)
    {
        Normalization(kernel);

        buffer_t buff(bitmap);

        for(long inx = 0, y = 0; y < bitmap.h(); ++y)
        {
            for(long x = 0; x < bitmap.w(); ++x, ++inx)
            {
                for(long n = 0, i = -kernel.radius(); i <= kernel.radius(); ++i, ++n)
                {
                    long i_k = Edge(i, x, bitmap.w());
                    long inx_k = inx + i_k;
                    buff[inx].r += bitmap[inx_k].r * kernel[n];
                    buff[inx].g += bitmap[inx_k].g * kernel[n];
                    buff[inx].b += bitmap[inx_k].b * kernel[n];
                }
            }
        }

        for(long inx = 0, x = 0; x < bitmap.w(); ++x)
        {
            for(long y = 0; y < bitmap.h(); ++y)
            {
                inx = y * bitmap.w() + x;
                double r = 0.0, g = 0.0, b = 0.0;
                for(long n = 0, i = -kernel.radius(); i <= kernel.radius(); ++i, ++n)
                {
                    long i_k = Edge(i, y, bitmap.h());
                    long inx_k = inx + i_k * bitmap.w();
                    r += buff[inx_k].r * kernel[n];
                    g += buff[inx_k].g * kernel[n];
                    b += buff[inx_k].b * kernel[n];
                }
                bitmap[inx].r = Clamp<bitmap_t::channel_t>(r);
                bitmap[inx].g = Clamp<bitmap_t::channel_t>(g);
                bitmap[inx].b = Clamp<bitmap_t::channel_t>(b);
            }
        }
    }

    void Blur2D(bitmap_t& bitmap, filter_t& kernel)
    {
        filter_t matrix(kernel.radius(), kernel.size() * kernel.size());
        for(long n = 0, i = 0; i < kernel.size(); ++i)
            for(long j = 0; j < kernel.size(); ++j, ++n)
                matrix[n] = kernel[i] * kernel[j];

        Normalization(matrix);

        for(long inx = 0, y = 0; y < bitmap.h(); ++y)
        {
            for(long x = 0; x < bitmap.w(); ++x, ++inx)
            {
                double r = 0.0, g = 0.0, b = 0.0;
                for (long n = 0, j = -matrix.radius(); j <= matrix.radius(); ++j)
                {
                    long j_k = Edge(j, y, bitmap.h());
                    for (long i = -matrix.radius(); i <= matrix.radius(); ++i, ++n)
                    {
                        long i_k = Edge(i, x, bitmap.w());
                        long inx_k = inx + j_k * bitmap.w() + i_k;
                        r += bitmap[inx_k].r * matrix[n];
                        g += bitmap[inx_k].g * matrix[n];
                        b += bitmap[inx_k].b * matrix[n];
                    }
                }
                bitmap[inx].r = Clamp<bitmap_t::channel_t>(r);
                bitmap[inx].g = Clamp<bitmap_t::channel_t>(g);
                bitmap[inx].b = Clamp<bitmap_t::channel_t>(b);
            }
        }
    }

    //

    void Average(filter_t& kernel, long radius)
    {
        kernel.set(radius, Diamet(radius));

        double average = 1.0 / (double)kernel.size();

        for(long n = 0; n < kernel.size(); ++n)
            kernel[n] = average;
    }

    void Linear(filter_t& kernel, long radius)
    {
        kernel.set(radius, Diamet(radius));

        double b = 2.0 / (double)kernel.size();
        double a = -(b / radius);

        for(long n = 0, i = -kernel.radius(); i <= kernel.radius(); ++i, ++n)
            kernel[n] = a * abs(i) + b;
    }

    void Gauss(filter_t& kernel, long radius)
    {
        kernel.set(radius, Diamet(radius));

        static const double SQRT2PI = sqrt(2.0 * PI);

        double sigma = (double)radius / 3.0;
        double sigma2 = 2.0 * sigma * sigma;
        double sigmap = sigma * SQRT2PI;

        for(long n = 0, i = -kernel.radius(); i <= kernel.radius(); ++i, ++n)
            kernel[n] = exp(-(double)(i * i) / sigma2) / sigmap;
    }

    //

    typedef void (*mark_t)(filter_t&, long);
    typedef void (*blur_t)(bitmap_t&, filter_t&);

    bool Filter(mark_t mark, blur_t blur, bitmap_t& bitmap, long radius)
    {
        if (radius < 1) return false;

        filter_t kernel;
        mark(kernel, radius);
        blur(bitmap, kernel);

        return true;
    }

    struct pair_t
    {
        mark_t mark;
        blur_t blur;
    };

    bool Filter(pair_t& pair, bitmap_t& bitmap, long radius)
    {
        return Filter(pair.mark, pair.blur, bitmap, radius);
    }
}

//

#endif/*__filter_h__*/

使用
MainWindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QWidget>
#include <QPainter>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;

protected:
    void paintEvent(QPaintEvent *event);




};

#endif // MAINWINDOW_H

MainWindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "picutil.h"
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}


MainWindow::~MainWindow()
{
    delete ui;
}
//系统自动刷新
void MainWindow::paintEvent(QPaintEvent *)
{
    //测试数据
    float max=47.2;
    float min=7;
    QStringList temp;
    temp<<"22.2"<<"22.9"<<"22.4"<<"23.5"<<"22.6"<<"22.7"<<"22.7"<<"24.1"<<"24.4"<<"23.4"<<"24.3"<<"23.7"<<"24.7"<<"27.3"<<"27.3"<<"26.2"<<"27.4";
    temp <<"28.3"<<"28.3"<<"26.7"<<"28"<<"26"<<"24.2"<<"25.3"<<"24.8"<<"25.7"<<"24.4"<<"23.5"<<"23.2"<<"22.6"<<"23.3"<<"22.2"<<"22.3"<<"24.8"<<"22.2";
    temp<<"22.2"<<"20.9"<<"24.6"<<"24.5"<<"24.6"<<"24.6"<<"21.7"<<"24"<<"25.9"<<"26.2"<<"29.6"<<"29.5"<<"27.1"<<"28.1"<<"29.2"<<"28.7"<<"27.9"<<"27.4";
    temp<<"24.9"<<"25.6"<<"24.4"<<"22.9"<<"22.5"<<"21.5"<<"24.4"<<"24.2"<<"21.9"<<"23.1"<<"19.9"<<"21.2"<<"21.3"<<"24.7"<<"23.1"<<"22.9"<<"22.2"<<"22.5";
    temp<<"23.1"<<"25.1"<<"26.1"<<"25.4"<<"28.7"<<"26.4"<<"29.8"<<"30.2"<<"30"<<"28.9"<<"29"<<"28.7"<<"29.2"<<"29.6"<<"27.8"<<"28.8"<<"26.4"<<"25";
    temp<<"25.6"<<"22.5"<<"23.7"<<"23.1"<<"23.5"<<"23.9"<<"22.7"<<"22.7"<<"23.2"<<"23.1"<<"22.7"<<"19"<<"22.8"<<"23.6"<<"23.6"<<"25.2"<<"24.8"<<"28.4";
    temp<<"29.5"<<"31.3"<<"29.8"<<"31.3"<<"28.6"<<"30.7"<<"31.8"<<"32.2"<<"29.7"<<"30.7"<<"29.8"<<"27.7"<<"28.7"<<"26.7"<<"25.6"<<"26.1"<<"23"<<"25.4";
    temp<<"23.9"<<"24.1"<<"24"<<"24.9"<<"24.6"<<"22.2"<<"21.4"<<"19.9"<<"23.2"<<"23.8"<<"23.3"<<"25.3"<<"27.9"<<"30.6"<<"32.4"<<"32.9"<<"33.9"<<"35.7"<<"35.4"<<"33.1"<<"32.2"<<"35"<<"34.2"<<"32.8"<<"30.7"<<"29.6"<<"28.3"<<"28.3"<<"27"<<"23.5"<<"23.5"<<"22"<<"23.5"<<"22.4"<<"25.1"<<"22.9"<<"25.3"<<"23.4"<<"22.7"<<"22.4"<<"23.5"<<"23.4"<<"25.6"<<"25.4"<<"27.4"<<"31.2"<<"33.9"<<"35.3"<<"35.1"<<"34.2"<<"35.1"<<"34.6"<<"34.8"<<"35"<<"32.9"<<"30.7"<<"31.8"<<"33.1"<<"29.1"<<"29.2"<<"28"<<"25.1"<<"23.7"<<"23.3"<<"24"<<"22.7"<<"23.5"<<"23.7"<<"23.2"<<"23.1"<<"22.5"<<"24.3"<<"22.9"<<"25.1"<<"24.8"<<"26.7"<<"31.5"<<"33.9"<<"33.8"<<"30.6"<<"34.9"<<"35.2"<<"33.9"<<"35.7"<<"34.8"<<"35.6"<<"34.5"<<"33.8"<<"35.2"<<"34.3"<<"30.4"<<"30.3"<<"28.4"<<"25.4"<<"25.3"<<"23.2"<<"23.3"<<"23.1"<<"23"<<"23.2"<<"22.6"<<"22"<<"23.2"<<"20.7"<<"24.4"<<"25.7"<<"24.3"<<"30.4"<<"32.5"<<"33.8"<<"34.9"<<"33.9"<<"33.1"<<"35"<<"30.6"<<"33.8"<<"35.3"<<"35.4"<<"35.3"<<"34.7"<<"34"<<"35.1"<<"33.2"<<"31.6"<<"29.9"<<"41.2"<<"24.6"<<"24.4"<<"23.6"<<"23.6"<<"24.5"<<"24.8"<<"25.5"<<"24.2"<<"24.2"<<"23.6"<<"22.3"<<"24.9"<<"27"<<"31.8"<<"33.9"<<"33.3"<<"34.1"<<"34.1"<<"34.3"<<"35.1"<<"34.8"<<"34.5"<<"35.9"<<"35.1"<<"34.9"<<"35.4"<<"35.1"<<"35.3"<<"35.1"<<"33.2"<<"30.3"<<"27.8"<<"24.5"<<"22.7"<<"24.7"<<"23.3"<<"23.2"<<"23.1"<<"23.7"<<"25.2"<<"25.5"<<"23.2"<<"24.3"<<"24.3"<<"26.1"<<"31.3"<<"31.8"<<"34.9"<<"34.5"<<"34.1"<<"35.2"<<"34.9"<<"34.8"<<"35.1"<<"34.8"<<"34.8"<<"33.8"<<"33"<<"34.7"<<"32.8"<<"34.6"<<"34"<<"32.5"<<"27.8"<<"25"<<"23.9"<<"22.6"<<"22.3"<<"22.3"<<"23.6"<<"24.8"<<"25.4"<<"27.8"<<"21.7"<<"23.6"<<"24.8"<<"24.6"<<"31.9"<<"33.7"<<"34.6"<<"33.5"<<"29.4"<<"34.2"<<"35.2"<<"35.3"<<"37.6"<<"35.3"<<"34.9"<<"33.3"<<"34.1"<<"35.2"<<"35.4"<<"33.8"<<"34.4"<<"32.3"<<"27.2"<<"25.8"<<"23.2"<<"23.1"<<"23.9"<<"23.6"<<"24.9"<<"23"<<"24.6"<<"27"<<"21.4"<<"22.5"<<"23.2"<<"25.3"<<"26"<<"28.1"<<"32.8"<<"33.9"<<"34.6"<<"33.2"<<"33.8"<<"31.1"<<"31.8"<<"34.7"<<"36.2"<<"34.2"<<"34"<<"32.6"<<"33.8"<<"34.2"<<"35.4"<<"32.3"<<"27.5"<<"25.4"<<"24.8"<<"23.3"<<"23.1"<<"20.6"<<"23.6"<<"23.8"<<"22.3"<<"22.6"<<"23.2"<<"23.3"<<"22.7"<<"24.2"<<"30.6"<<"34.2"<<"33.9"<<"34.5"<<"34.9"<<"35"<<"34.9"<<"34.1"<<"34.6"<<"34.4"<<"35.1"<<"34.9"<<"34.7"<<"33"<<"34.4"<<"33.3"<<"34.2"<<"32.3"<<"27"<<"24"<<"22.8";
    temp<<"23.4"<<"23.9"<<"24.7"<<"23.3"<<"24.4"<<"24"<<"22.3"<<"23.5"<<"24.4"<<"24"<<"25.7"<<"31.9"<<"31.8"<<"33.3"<<"34.1"<<"34.2"<<"34.5"<<"34.6"<<"32.8"<<"33.8"<<"34.3"<<"32.4"<<"33.6"<<"33.6"<<"33.5"<<"33.7"<<"33.2"<<"34"<<"33.7"<<"25.6"<<"24.1"<<"23"<<"24.1"<<"24"<<"24"<<"22.8"<<"22.6"<<"24.8"<<"22.5"<<"22"<<"24.2"<<"23.2"<<"23.6"<<"32.9"<<"34.4"<<"33.6"<<"33.7"<<"29.8"<<"34.3"<<"34.5"<<"32.8"<<"36.1"<<"31.5"<<"33.2"<<"33.2"<<"33.4"<<"33.7"<<"35.1"<<"34.5"<<"32.9"<<"32.2"<<"28.4"<<"23.9"<<"22.4"<<"24.2"<<"21.8"<<"23.4"<<"23.6"<<"22.5"<<"22.8"<<"23.9"<<"23"<<"23"<<"25.1"<<"23.6"<<"31.8"<<"35.1"<<"34.7"<<"33.7"<<"34.2"<<"34.3"<<"34.4"<<"30.5"<<"31.1"<<"33.9"<<"34.3"<<"34.3"<<"35.3"<<"33"<<"34.8"<<"33.6"<<"33.8"<<"33.6"<<"31.1"<<"23.4"<<"24.3"<<"24.4"<<"22.9"<<"23.3"<<"23.9"<<"22.4"<<"24.1"<<"22.6"<<"21.5"<<"22.2"<<"24.9"<<"24.9"<<"30.8"<<"33.6"<<"33.4"<<"33.1"<<"33.9"<<"34.6"<<"34.7"<<"33.4"<<"33.5"<<"33.2"<<"33.9"<<"34.2"<<"33.9"<<"32.6"<<"32.8"<<"33"<<"33.3"<<"31.3"<<"29.6"<<"23.5"<<"25.8"<<"22.2"<<"27.3"<<"24.1"<<"23.5"<<"24"<<"22.7"<<"21.4"<<"23.5"<<"23.4"<<"21.6"<<"24.8"<<"29.9"<<"33.8"<<"34.4"<<"34.6"<<"34.6"<<"34.3"<<"34.3"<<"33.3"<<"34.6"<<"33.6"<<"33.3"<<"36.3"<<"35.1"<<"32.4"<<"34.4"<<"33"<<"31"<<"32.8"<<"27.5"<<"24"<<"25.5"<<"24.5"<<"23.8"<<"23.6"<<"24.3"<<"23.3"<<"24.2"<<"23.6"<<"23.3"<<"23.1"<<"24.1"<<"23.7"<<"30.5"<<"34.2"<<"34.2"<<"34.2"<<"33.9"<<"34.3"<<"34.6"<<"32.8"<<"33.9"<<"33.3"<<"33.2"<<"34.5"<<"35.5"<<"34.6"<<"33.9"<<"31.9"<<"33.8"<<"31.1"<<"25.8"<<"24.8"<<"24.7"<<"24"<<"22.2"<<"23.6"<<"22.3"<<"22.3"<<"25.7"<<"23.8"<<"23"<<"22.8"<<"22.2"<<"23.4"<<"29.6"<<"33.2"<<"7"<<"32.8"<<"34.6"<<"32.8"<<"35.3"<<"35"<<"34"<<"33.9"<<"34.9"<<"34.9"<<"34.7"<<"33.3"<<"32.6"<<"32.8"<<"31.8"<<"47.2"<<"7.8"<<"24.2"<<"24.8"<<"24.9"<<"25.8"<<"26.7"<<"22.8"<<"21.8"<<"23.9"<<"23.7"<<"23.7"<<"24.5"<<"24.6"<<"25.8"<<"25.5"<<"32.4"<<"33.6"<<"33.5"<<"34.6"<<"32.9"<<"34.6"<<"33.6"<<"34.8"<<"32.8"<<"35.1"<<"34.2"<<"35.2"<<"34.9"<<"33.2"<<"33.1"<<"29.7"<<"23.1"<<"24.2"<<"23.4"<<"25.5"<<"25.8"<<"28.5"<<"25.9"<<"23.6"<<"23.7"<<"24.3"<<"22.2"<<"23.5"<<"24.3"<<"25.8"<<"25.2"<<"25.4"<<"33.6"<<"33.8"<<"35.1"<<"34.2"<<"33.6"<<"34.2"<<"34.1"<<"34.1"<<"34.1"<<"34.4"<<"35.4"<<"34.6"<<"33"<<"32.4"<<"32.6"<<"26.5"<<"25.1"<<"24.6"<<"24.6"<<"26.1"<<"24.9"<<"25.9"<<"25.1"<<"23.6"<<"22.6"<<"24.2"<<"23.3"<<"24.7"<<"24.5"<<"26.5"<<"24.4"<<"25"<<"29.3"<<"33.4"<<"32.6"<<"35.1"<<"33.3"<<"34.2"<<"34.1"<<"34"<<"36.1"<<"33.3"<<"34.5"<<"34.3"<<"33.8"<<"32.8"<<"30.5"<<"26.1"<<"25.3"<<"24.3"<<"23.9"<<"24.5"<<"24.8"<<"22.4"<<"23.4"<<"21.9"<<"22.9"<<"25.9"<<"24.1"<<"24"<<"22.6"<<"23.2"<<"23.4"<<"23.3"<<"25.2"<<"33.4"<<"33.9"<<"34.9"<<"35.3"<<"35.3"<<"35.1"<<"33.3"<<"35.6"<<"34.8"<<"35.1"<<"34.8"<<"33.3"<<"31.8"<<"31.1"<<"25.3"<<"24.8"<<"24.4"<<"24.2"<<"23.7"<<"21.6"<<"24.2"<<"23.6"<<"22.7"<<"23.6"<<"22.9"<<"23.1"<<"22.6"<<"22"<<"25.9"<<"24.9"<<"22.4"<<"24.3"<<"27.5"<<"33.4"<<"33.7"<<"33"<<"33.6"<<"32.2"<<"34.6"<<"34.3"<<"34.4"<<"34.1"<<"33.5"<<"34.5"<<"31"<<"26.8"<<"23.8"<<"24.1"<<"23.9"<<"23"<<"21.7"<<"24.2"<<"27"<<"23.2"<<"23.1"<<"21.8"<<"23"<<"21.6"<<"23.8"<<"23.7"<<"23.8"<<"24.8"<<"23.6"<<"24.7"<<"27.1"<<"32.8"<<"34.4"<<"33.5"<<"34.4"<<"34.5"<<"36"<<"34.5"<<"34.8"<<"34.5"<<"33.8"<<"33.3"<<"32.8"<<"27.8"<<"23.5"<<"22.9"<<"24.9"<<"24.1"<<"25.9"<<"24"<<"24.3"<<"22.9"<<"24.4"<<"21.9"<<"25"<<"23.8"<<"23.2"<<"22.1"<<"25.7"<<"23.3"<<"24.2"<<"26.8"<<"29.6"<<"32.3"<<"34.3"<<"34.3"<<"34"<<"31.9"<<"33.3"<<"32.8"<<"33.9"<<"34.4"<<"33.8"<<"34"<<"34"<<"28.7"<<"28.3"<<"26.2"<<"24.3"<<"24.1"<<"24.2"<<"24.1"<<"23.6"<<"22.8"<<"22.1"<<"22.3"<<"24.5"<<"25.6"<<"27.4"<<"28.2"<<"27.4"<<"28.7"<<"28.5"<<"29.4"<<"35.7"<<"32.6"<<"33.8"<<"33.7"<<"35.3"<<"34.1"<<"33.8"<<"32.7"<<"34.5"<<"34"<<"33.8"<<"35.1"<<"32"<<"30.7"<<"30.6"<<"29.8"<<"29.2"<<"28.6"<<"26.7"<<"26.7"<<"27.9"<<"24.1"<<"25.8"<<"26.7"<<"28.2"<<"29"<<"29.4"<<"29.6"<<"28.7"<<"29.6"<<"30.2"<<"29.8"<<"32.7"<<"34.2"<<"35.3"<<"34.1"<<"32.4"<<"32.7"<<"34"<<"33.8"<<"33.2"<<"34.2"<<"33.9"<<"32"<<"32.5"<<"31.6"<<"33.1"<<"28.3"<<"29.3"<<"29.7"<<"28.9"<<"26.7"<<"29.4"<<"29.6"<<"29.2"<<"26.9"<<"28.2"<<"29.9"<<"29.9"<<"30.5"<<"30.2"<<"30.8"<<"31.5"<<"30.5"<<"33.7"<<"35.6"<<"34.5"<<"33"<<"34.5"<<"32.9"<<"31.5"<<"33.4"<<"32.2"<<"35.5"<<"32.1"<<"31.3"<<"32"<<"31.2"<<"31.2"<<"30.7"<<"32.4"<<"28.9"<<"28.7"<<"29"<<"28.1"<<"29.6"<<"29"<<"28"<<"29.3"<<"30.3"<<"29.7"<<"31.1"<<"28.2"<<"30.4"<<"31"<<"30.7"<<"30.5"<<"30.2"<<"34"<<"35.1"<<"32.5"<<"31.2"<<"32.6"<<"32.6"<<"31.4"<<"30.4"<<"32.2"<<"31.6"<<"33.9"<<"30.8"<<"30.7"<<"32.7"<<"31.8"<<"31.1"<<"30.7"<<"30"<<"28.4"<<"29.3"<<"28.3"<<"28.9"<<"31.1"<<"30.6"<<"31.1"<<"27.9"<<"30.7"<<"30.6"<<"33.2"<<"32.5"<<"33.7"<<"29.4"<<"30.7"<<"31.1"<<"31.9"<<"32.1"<<"31.1"<<"32.6"<<"30.4"<<"32.3"<<"32.1"<<"30.8"<<"30.8"<<"31.3"<<"32.5"<<"30.7"<<"32"<<"31.6"<<"29"<<"29.4"<<"30.2"<<"30.9";

    //生成图像
    picShtUtil::generalImage gim;
    QImage image= gim.becomeImage(max,min,temp);

    QPainter painter1(this);
    painter1.drawImage(0, 0,image);

}


这篇关于qt图像生成工具类的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!