資源簡介
通過RGB顏色表自己設置好colorbar,然后將數組通過程序繪圖。pdf文檔是RGB顏色對照表,PPT是自己建立的colorbar。帶有測試數據,分數高是因為這些都是自己花了一個星期搞定的,自己不是專業人士,所以很費功夫。

代碼片段和文件信息
#include?“colorbar.h“
#include?
#include
#include
#include
#include
ColorBar::ColorBar(Qobject?*parent)?:?Qobject(parent)
{
????setAutoFillBackground(true);
????setPalette(QPalette(Qt::white));
????pix=NULL;
}
void?ColorBar::paintEvent(QPaintEvent?*event)
{
????QPainter?painter(this);
????QColor?color;
????QRect?section;
????float?colorBarLength=343.0;//設置顏色條的長度
????//------設置為gray顏色條---------//
????for(int?i=0;i<=colorBarLength;i++)//?gray
????{
???????//color.setRgbF(i/colorBarLengthi/colorBarLengthi/colorBarLength);//也可以使用這種方法
???????color.setHsv(00(colorBarLength-i)/colorBarLength*255);
????????section.setRect(15050+i*1201);
????????painter.fillRect(sectioncolor);
????}
????//------設置為jet顏色條---------//
????float?tempLength=colorBarLength/4;
????for(int?i=0;i ????{
????????color.setRgbF(00(tempLength/2+i)/tempLength);
????????section.setRect(200colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+1;i ????{
????????color.setRgbF(0(i-tempLength/2)/tempLength1);
????????section.setRect(200colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+tempLength+1;i ????{
????????color.setRgbF((i-tempLength-tempLength/2)/tempLength1(tempLength*2+tempLength/2-i)/tempLength);
????????section.setRect(200colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+2*tempLength+1;i ????{
????????color.setRgbF(1(tempLength*3+tempLength/2-i)/tempLength0);
????????section.setRect(200colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+3*tempLength+1;i ????{
????????color.setRgbF((colorBarLength-i+tempLength/2)/(tempLength)00);
????????section.setRect(200colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????//------設置為hsv顏色條---------//
????for(int?i=0;i<=colorBarLength;i++)//?hsv
????{
????????color.setHsvF(i/colorBarLength11);
????????section.setRect(250colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????//------設置為hot顏色條---------//
????tempLength=colorBarLength/2.5;
????for(int?i=0;i ????{
????????color.setRgbF((tempLength/2+i)/tempLength00);
????????section.setRect(300colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+1;i ????{
????????color.setRgbF(1(i-tempLength/2)/tempLength0);
????????section.setRect(300colorBarLength+50-i*1201);
????????painter.fillRect(sectioncolor);
????}
????for(int?i=tempLength/2+tempLength+1;i ????{
????????color.setRgbF(11(i-tempLen
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4199??2016-07-08?20:38??TxtBmp\colorbar.cpp
?????文件????????358??2016-07-08?20:37??TxtBmp\colorbar.h
?????文件???????4174??2016-07-08?23:59??TxtBmp\colorbar01.cpp
?????文件????????306??2016-07-08?20:39??TxtBmp\colorbar01.h
?????文件????????169??2009-09-17?19:12??TxtBmp\main.cpp
?????文件??????73932??2016-07-08?13:32??TxtBmp\Microsoft?Excel.txt
?????文件???????5404??2016-07-08?23:37??TxtBmp\txt2bmp.cpp
?????文件????????862??2016-07-08?22:23??TxtBmp\txt2bmp.h
?????文件????????413??2016-07-08?20:39??TxtBmp\txt2bmp.pro
?????文件??????18682??2016-07-08?23:59??TxtBmp\txt2bmp.pro.user
?????文件?????????67??2009-09-17?19:12??TxtBmp\txt2bmp.qrc
?????文件???????1896??2016-07-08?22:18??TxtBmp\txt2bmp.ui
?????目錄??????????0??2016-07-08?23:59??TxtBmp
-----------?---------??----------?-----??----
???????????????110462????????????????????13
- 上一篇:RemapKey.exe
- 下一篇:最強親測 vmware專業清理工具專家版
評論
共有 條評論