Skip to content
Snippets Groups Projects
Commit d2c11a6c authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix for images with alpha channel

parent 9cb49a8c
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1, ...@@ -36,7 +36,7 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1,
int width = img->w(); int width = img->w();
int dim = img->d(); int dim = img->d();
if(dim != 1) { if(dim != 1 && dim != 2) {
Msg::Error("Unable to obtain one-channel image"); Msg::Error("Unable to obtain one-channel image");
return 0; return 0;
} }
...@@ -52,10 +52,10 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1, ...@@ -52,10 +52,10 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1,
for(int j = 0; j < width - 1; j++) { for(int j = 0; j < width - 1; j++) {
double x = j; double x = j;
double x1 = j + 1; double x1 = j + 1;
double val1 = (double)a[j]/255.; double val1 = (double)a[j * dim]/255.;
double val2 = (double)a1[j]/255.; double val2 = (double)a1[j * dim]/255.;
double val3 = (double)a1[j + 1]/255.; double val3 = (double)a1[(j + 1) * dim]/255.;
double val4 = (double)a[j + 1]/255.; double val4 = (double)a[(j + 1) * dim]/255.;
if(quads){ // generate quads if(quads){ // generate quads
d->SQ.push_back(x); d->SQ.push_back(x); d->SQ.push_back(x); d->SQ.push_back(x);
d->SQ.push_back(x1); d->SQ.push_back(x1); d->SQ.push_back(x1); d->SQ.push_back(x1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment