FIXed Security Alerts:
- https://github.com/jkriege2/JKQtPlotter/security/code-scanning/3 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/4 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/5 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/6 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/7 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/8 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/9 - https://github.com/jkriege2/JKQtPlotter/security/code-scanning/10
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |