Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
d2c11a6c
Commit
d2c11a6c
authored
8 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
fix for images with alpha channel
parent
9cb49a8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Graphics/ReadImg.cpp
+11
-11
11 additions, 11 deletions
Graphics/ReadImg.cpp
with
11 additions
and
11 deletions
Graphics/ReadImg.cpp
+
11
−
11
View file @
d2c11a6c
...
...
@@ -20,7 +20,7 @@
// from an image, we create a post-procession view
static
PViewDataList
*
Img2Data
(
Fl_RGB_Image
&
img_init
,
int
quads
=
1
,
int
resizex
=
0
,
int
resizey
=
0
)
int
resizex
=
0
,
int
resizey
=
0
)
{
img_init
.
desaturate
();
// convert to grayscale
...
...
@@ -36,7 +36,7 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1,
int
width
=
img
->
w
();
int
dim
=
img
->
d
();
if
(
dim
!=
1
)
{
if
(
dim
!=
1
&&
dim
!=
2
)
{
Msg
::
Error
(
"Unable to obtain one-channel image"
);
return
0
;
}
...
...
@@ -52,12 +52,12 @@ static PViewDataList *Img2Data(Fl_RGB_Image &img_init, int quads=1,
for
(
int
j
=
0
;
j
<
width
-
1
;
j
++
)
{
double
x
=
j
;
double
x1
=
j
+
1
;
double
val1
=
(
double
)
a
[
j
]
/
255.
;
double
val2
=
(
double
)
a1
[
j
]
/
255.
;
double
val3
=
(
double
)
a1
[
j
+
1
]
/
255.
;
double
val4
=
(
double
)
a
[
j
+
1
]
/
255.
;
double
val1
=
(
double
)
a
[
j
*
dim
]
/
255.
;
double
val2
=
(
double
)
a1
[
j
*
dim
]
/
255.
;
double
val3
=
(
double
)
a1
[
(
j
+
1
)
*
dim
]
/
255.
;
double
val4
=
(
double
)
a
[
(
j
+
1
)
*
dim
]
/
255.
;
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
(
y
);
d
->
SQ
.
push_back
(
y1
);
d
->
SQ
.
push_back
(
y1
);
d
->
SQ
.
push_back
(
y
);
...
...
@@ -112,25 +112,25 @@ static int EndPos(const char *name, PViewData *d)
}
}
int
read_pnm
(
std
::
string
fileName
)
int
read_pnm
(
std
::
string
fileName
)
{
Fl_PNM_Image
img
(
fileName
.
c_str
());
return
EndPos
(
fileName
.
c_str
(),
Img2Data
(
img
));
}
int
read_jpeg
(
std
::
string
fileName
)
int
read_jpeg
(
std
::
string
fileName
)
{
Fl_JPEG_Image
img
(
fileName
.
c_str
());
return
EndPos
(
fileName
.
c_str
(),
Img2Data
(
img
));
}
int
read_png
(
std
::
string
fileName
)
int
read_png
(
std
::
string
fileName
)
{
Fl_PNG_Image
img
(
fileName
.
c_str
());
return
EndPos
(
fileName
.
c_str
(),
Img2Data
(
img
));
}
int
read_bmp
(
std
::
string
fileName
)
int
read_bmp
(
std
::
string
fileName
)
{
Fl_BMP_Image
img
(
fileName
.
c_str
());
return
EndPos
(
fileName
.
c_str
(),
Img2Data
(
img
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment