Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 13 deletions.
6 changes: 4 additions & 2 deletions lib/jkqtcommon/jkqtpbasicimagetools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions lib/jkqtcommon/jkqtpbasicimagetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <QColor>
#include <QReadWriteLock>
#include <vector>
#include <limits>
#include "jkqtcommon/jkqtcommon_imexport.h"
#include "jkqtcommon/jkqtpmathtools.h"

Expand Down Expand Up @@ -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)))) {
Expand All @@ -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();
Expand Down
6 changes: 2 additions & 4 deletions lib/jkqtplotter/graphs/jkqtpimageoverlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions lib/jkqtplotter/jkqtpimagetools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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));
Expand Down
Binary file modified screenshots/datastore_regression_linweight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/geometric.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/geometric_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/multiplot_controlwindow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/multiplot_controlwindow_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/parsedfunctionplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/parsedfunctionplot_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4a7b6b6

Please sign in to comment.