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
61f7da06
Commit
61f7da06
authored
22 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
bc387133
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Graphics/ReadImg.cpp
+124
-0
124 additions, 0 deletions
Graphics/ReadImg.cpp
Graphics/ReadImg.h
+4
-0
4 additions, 0 deletions
Graphics/ReadImg.h
with
128 additions
and
0 deletions
Graphics/ReadImg.cpp
0 → 100644
+
124
−
0
View file @
61f7da06
// Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
// Please report all bugs and problems to "gmsh@geuz.org".
#include
"ReadImg.h"
#include
"Gmsh.h"
#include
"GmshUI.h"
#include
"Views.h"
#include
<FL/Fl_PNM_Image.H>
// from an image, we create a post pro object
Post_View
*
Img2Pos
(
Fl_RGB_Image
&
img_init
)
{
img_init
.
desaturate
();
Fl_RGB_Image
*
img
=
(
Fl_RGB_Image
*
)
img_init
.
copy
(
128
,
128
);
const
uchar
*
data
=
img
->
array
;
int
height
=
img
->
h
();
int
width
=
img
->
w
();
int
dim
=
img
->
d
();
Post_View
*
v
=
BeginView
(
1
);
for
(
int
i
=
0
;
i
<
width
-
1
;
i
++
)
{
const
uchar
*
a
=
data
+
i
*
width
*
dim
;
const
uchar
*
a1
=
data
+
(
i
+
1
)
*
width
*
dim
;
double
y
=
1.
-
(
double
)
i
/
((
double
)
width
-
1.
);
double
y1
=
1.
-
(
double
)
(
i
+
1
)
/
((
double
)
width
-
1.
);
for
(
int
j
=
0
;
j
<
height
-
1
;
j
++
)
{
double
x
=
(
double
)
j
/
((
double
)
height
-
1.
);
double
x1
=
(
double
)
(
j
+
1
)
/
((
double
)
height
-
1.
);
double
z
=
0.0
;
if
(
dim
==
1
)
// grayscale
{
uchar
G1
=
a
[
j
];
uchar
G2
=
a1
[
j
];
uchar
G3
=
a1
[
j
+
1
];
uchar
G4
=
a
[
j
+
1
];
const
double
eps
=
0.005
;
const
double
Eps
=
.25
;
double
val1
=
Eps
*
(
G1
)
/
255.
+
eps
;
double
val2
=
Eps
*
(
G2
)
/
255.
+
eps
;
double
val3
=
Eps
*
(
G3
)
/
255.
+
eps
;
double
val4
=
Eps
*
(
G4
)
/
255.
+
eps
;
/*
val1*=val1;
val2*=val2;
val3*=val3;
val4*=val4;
*/
List_Add
(
v
->
ST
,
&
x
);
List_Add
(
v
->
ST
,
&
x
);
List_Add
(
v
->
ST
,
&
x1
);
List_Add
(
v
->
ST
,
&
y
);
List_Add
(
v
->
ST
,
&
y1
);
List_Add
(
v
->
ST
,
&
y1
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
val1
);
List_Add
(
v
->
ST
,
&
val2
);
List_Add
(
v
->
ST
,
&
val3
);
v
->
NbST
++
;
List_Add
(
v
->
ST
,
&
x
);
List_Add
(
v
->
ST
,
&
x1
);
List_Add
(
v
->
ST
,
&
x1
);
List_Add
(
v
->
ST
,
&
y
);
List_Add
(
v
->
ST
,
&
y1
);
List_Add
(
v
->
ST
,
&
y
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
z
);
List_Add
(
v
->
ST
,
&
val1
);
List_Add
(
v
->
ST
,
&
val3
);
List_Add
(
v
->
ST
,
&
val4
);
v
->
NbST
++
;
}
}
}
delete
img
;
return
v
;
}
void
read_pnm
(
char
*
name
)
{
Fl_PNM_Image
theVeryNicePicture
(
name
);
Post_View
*
v
=
Img2Pos
(
theVeryNicePicture
);
char
name2
[
256
];
strcpy
(
name2
,
name
);
strcat
(
name2
,
".pos"
);
EndView
(
v
,
1
,
name2
,
name
);
}
This diff is collapsed.
Click to expand it.
Graphics/ReadImg.h
0 → 100644
+
4
−
0
View file @
61f7da06
#ifndef _READ_IMG_
#define _READ_IMG_
void
read_pnm
(
char
*
name
);
#endif
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