jkriege2 2024-01-09 16:44:00 +01:00
parent e0df1a8f0e
commit 4a7b6b60d1
11 changed files with 16 additions and 13 deletions

View File

@ -2168,8 +2168,10 @@ QImage JKQTPImageTools::GetPaletteImage(int i, int width)
QImage JKQTPImageTools::GetPaletteImage(int i, int width, int height)
{
QImage img;
QVector<double> pic(width*height,0);
for (int j=0; j<width*height; j++) {
const long NPixels=static_cast<int>(jkqtp_bounded<long>(0, width*height, std::numeric_limits<int>::max()));
QVector<double> pic(NPixels,0);
for (int j=0; j<NPixels; j++) {
pic[j]=j%width;
}
JKQTPImageTools::array2image<double>(pic.data(), width, height, img, static_cast<JKQTPMathImageColorPalette>(i), Qt::black, Qt::black);

View File

@ -30,6 +30,7 @@
#include <QColor>
#include <QReadWriteLock>
#include <vector>
#include <limits>
#include "jkqtcommon/jkqtcommon_imexport.h"
#include "jkqtcommon/jkqtpmathtools.h"
@ -482,11 +483,12 @@ struct JKQTPImageTools {
if (!dbl_in || width<=0 || height<=0)
return;
const long NPixels= width*height;
double min = *dbl_in;
double max = *dbl_in;
if (jkqtp_approximatelyEqual(minColor, maxColor, JKQTP_DOUBLE_EPSILON)) {
bool first=true;
for (int i=1; i<width*height; ++i)
for (int i=1; i<NPixels; ++i)
{
T v=dbl_in[i];
if (!(std::isnan(static_cast<long double>(v)) || std::isinf(static_cast<long double>(v)))) {
@ -511,8 +513,8 @@ struct JKQTPImageTools {
QVector<T> dbl1;
if (logScale) {
double logB=log10(logBase);
dbl1=QVector<T>(width*height, 0);
for (int i=0; i<width*height; i++) {
dbl1=QVector<T>(jkqtp_bounded<int>(NPixels), 0);
for (int i=0; i<NPixels; i++) {
dbl1[i]=log10(dbl_in[i])/logB;
}
dbl=dbl1.data();

View File

@ -96,10 +96,8 @@ QImage JKQTPOverlayImage::drawImage() {
if (!data) return QImage();
QImage img(Nx, Ny, QImage::Format_ARGB32);
//QRgb tc=trueColor.rgba();
//QRgb fc=falseColor.rgba();
QRgb tc=qRgba(jkqtp_roundTo<int>(trueColor.red()*trueColor.alphaF()), jkqtp_roundTo<int>(trueColor.green()*trueColor.alphaF()), jkqtp_roundTo<int>(trueColor.blue()*trueColor.alphaF()), trueColor.alpha());
QRgb fc=qRgba(jkqtp_roundTo<int>(falseColor.red()*falseColor.alphaF()), jkqtp_roundTo<int>(falseColor.green()*falseColor.alphaF()), jkqtp_roundTo<int>(falseColor.blue()*falseColor.alphaF()), falseColor.alpha());
const QRgb tc=qRgba(jkqtp_roundTo<int>(trueColor.redF()*trueColor.alphaF()*255.0), jkqtp_roundTo<int>(trueColor.greenF()*trueColor.alphaF()*255.0), jkqtp_roundTo<int>(trueColor.blueF()*trueColor.alphaF()*255.0), trueColor.alpha());
const QRgb fc=qRgba(jkqtp_roundTo<int>(falseColor.redF()*falseColor.alphaF()*255.0), jkqtp_roundTo<int>(falseColor.greenF()*falseColor.alphaF()*255.0), jkqtp_roundTo<int>(falseColor.blueF()*falseColor.alphaF()*255.0), falseColor.alpha());
for (int32_t y=0; y<Ny; y++) {
QRgb* line=(QRgb*)img.scanLine(Ny-1-y);

View File

@ -252,11 +252,11 @@ QIcon JKQTPColorPaletteStyleAndToolsMixin::getPaletteIcon(JKQTPMathImageColorPal
QImage JKQTPColorPaletteStyleAndToolsMixin::getPaletteImage(int i, size_t width)
{
QImage img;
std::vector<double> pic(static_cast<size_t>(width), 0.0);
std::vector<double> pic(width, 0.0);
for (size_t j=0; j<width; j++) {
pic[j]=j;
}
JKQTPImageTools::array2image<double>(pic.data(), static_cast<int>(width), 1, img, static_cast<JKQTPMathImageColorPalette>(i), 0, width-1);
JKQTPImageTools::array2image<double>(pic.data(), jkqtp_bounded<int>(width), 1, img, static_cast<JKQTPMathImageColorPalette>(i), 0, width-1);
return img;
}
@ -296,9 +296,10 @@ QImage JKQTPColorPaletteStyleAndToolsMixin::getPaletteKeyImage(int i, size_t wid
const double w2x=double(width*width)/(8.0*8.0);
const double w2y=double(height*height)/(8.0*8.0);
std::vector<double> pic(width*height, 0.0);
const size_t NPixels=jkqtp_bounded<size_t>(width*height);
std::vector<double> pic(NPixels, 0.0);
double mmax=0;
for (size_t j=0; j<width*height; j++) {
for (size_t j=0; j<NPixels; j++) {
const size_t x=j%width;
const size_t y=j/width;
pic[j]=exp(-0.5*(double((x-x01)*double(x-x01))/w1x+double((y-y01)*double(y-y01))/w1y))+0.7*exp(-0.5*(double((x-x02)*double(x-x02))/w2x+double((y-y02)*double(y-y02))/w2y));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB