Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Traitement_Images
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jorge.leitemac
Traitement_Images
Commits
0c5f1dcc
Commit
0c5f1dcc
authored
Nov 26, 2020
by
jorge.leitemac
Browse files
Options
Downloads
Patches
Plain Diff
fix fix lib sdl2
parent
3859f251
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+0
-1
0 additions, 1 deletion
Makefile
main.c
+24
-19
24 additions, 19 deletions
main.c
with
24 additions
and
20 deletions
Makefile
+
0
−
1
View file @
0c5f1dcc
CC
=
gcc
-O3
-Wall
-Wextra
-pedantic
-fsanitize
=
address
-fsanitize
=
leak
-lm
CC
=
gcc
-O3
-Wall
-Wextra
-pedantic
-fsanitize
=
address
-fsanitize
=
leak
-lm
all
:
exec
exec
:
matrix.o pgm.o gfx.o main.o
exec
:
matrix.o pgm.o gfx.o main.o
$(
CC
)
$^
-o
$@
-lSDL2
-g
-pedantic
$(
CC
)
$^
-o
$@
-lSDL2
-g
-pedantic
...
...
This diff is collapsed.
Click to expand it.
main.c
+
24
−
19
View file @
0c5f1dcc
#include
"gfx.h"
#include
"gfx.h"
#include
"pgm.h"
#include
"pgm.h"
static
void
renderPgm
(
struct
gfx_context_t
*
context
,
const
pgm
*
const
orig
)
{
pgm_error
renderPgm
(
struct
gfx_context_t
*
context
,
const
pgm
*
const
orig
)
{
//Modification de la fonction dans l'exemple d'utilisation de la lib pour intégrer pgm
//Modification de la fonction dans l'exemple d'utilisation de la lib pour intégrer pgm
gfx_clear
(
context
,
COLOR_BLACK
);
uint32_t
intensity
;
uint32_t
intensity
;
uint32_t
color
;
uint32_t
color
;
gfx_clear
(
context
,
COLOR_BLACK
);
for
(
int
i
=
0
;
i
<
orig
->
pixels
.
m
;
i
++
)
for
(
int
i
=
0
;
i
<
orig
->
pixels
.
m
;
i
++
)
{
{
for
(
int
j
=
0
;
j
<
orig
->
pixels
.
n
;
j
++
)
for
(
int
j
=
0
;
j
<
orig
->
pixels
.
n
;
j
++
)
{
{
intensity
=
orig
->
max
;
intensity
=
orig
->
pixels
.
data
[
i
][
j
]
;
color
=
MAKE_COLOR
(
intensity
,
intensity
,
intensity
);
color
=
MAKE_COLOR
(
intensity
,
intensity
,
intensity
);
gfx_putpixel
(
context
,
i
,
j
,
color
);
gfx_putpixel
(
context
,
j
,
i
,
color
);
}
}
}
}
return
success
;
}
}
int
main
(){
int
main
(){
...
@@ -25,19 +29,6 @@ int main(){
...
@@ -25,19 +29,6 @@ int main(){
pgm_read_from_file
(
&
p
,
"./img/mandrill.pgm"
);
pgm_read_from_file
(
&
p
,
"./img/mandrill.pgm"
);
pgm_write_to_file
(
&
p
,
"./img/mandrill2.pgm"
);
pgm_write_to_file
(
&
p
,
"./img/mandrill2.pgm"
);
int
longueur
=
p
.
pixels
.
m
;
int
hauteur
=
p
.
pixels
.
n
;
struct
gfx_context_t
*
ctxt
=
gfx_create
(
"image"
,
longueur
,
hauteur
);
if
(
!
ctxt
)
{
fprintf
(
stderr
,
"Graphics initialization failed!
\n
"
);
return
EXIT_FAILURE
;
}
while
(
gfx_keypressed
()
!=
SDLK_ESCAPE
)
{
renderPgm
(
ctxt
,
&
p
);
gfx_present
(
ctxt
);
}
gfx_destroy
(
ctxt
);
pgm
ph
;
pgm
ph
;
pgm_photomaton
(
&
ph
,
&
p
);
pgm_photomaton
(
&
ph
,
&
p
);
...
@@ -77,6 +68,20 @@ int main(){
...
@@ -77,6 +68,20 @@ int main(){
pgm_crop
(
&
crop
,
&
p
,
100
,
200
,
100
,
200
);
pgm_crop
(
&
crop
,
&
p
,
100
,
200
,
100
,
200
);
pgm_write_to_file
(
&
crop
,
"./img/crop_mandrill.pgm"
);
pgm_write_to_file
(
&
crop
,
"./img/crop_mandrill.pgm"
);
int
longueur
=
p
.
pixels
.
m
;
int
hauteur
=
p
.
pixels
.
n
;
struct
gfx_context_t
*
ctxt
=
gfx_create
(
"image"
,
longueur
,
hauteur
);
if
(
!
ctxt
)
{
fprintf
(
stderr
,
"Graphics initialization failed!
\n
"
);
return
EXIT_FAILURE
;
}
renderPgm
(
ctxt
,
&
p
);
gfx_present
(
ctxt
);
while
(
gfx_keypressed
()
!=
SDLK_ESCAPE
)
{
}
gfx_destroy
(
ctxt
);
...
...
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
sign in
to comment