Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rearrangment/reformat of the source code #5

Closed
wants to merge 13 commits into from
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@ ford ford.yml

## Contributing

Contributions to `ForImage` are welcome!
If you find any issues or would like to suggest improvements, please open an issue.
Contributions to `ForImage` are welcome! If you find any issues or would like
to suggest improvements, please open an issue. For consistency of the source
code, use `snake_case` to name the variables and procedures and use
[fprettify](https://github.com/pseewald/fprettify) altogether with the style
file `fprettify.rc`.
41 changes: 21 additions & 20 deletions example/example1.f90
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
program example1
use forimage, only: format_pnm
implicit none

type(format_pnm) :: ex1
integer, dimension(10,6) :: px
use forimage, only: format_pnm
implicit none

px(1,:) = [0,0,0,0,1,0]
px(2,:) = [0,0,0,0,1,0]
px(3,:) = [0,0,0,0,1,0]
px(4,:) = [0,0,0,0,1,0]
px(5,:) = [0,0,0,0,1,0]
px(6,:) = [0,0,0,0,1,0]
px(7,:) = [1,0,0,0,1,0]
px(8,:) = [0,1,1,1,0,0]
px(9,:) = [0,0,0,0,0,0]
px(10,:) = [0,0,0,0,0,0]
type(format_pnm) :: ex1
integer, dimension(10, 6) :: px

call ex1%set_pnm(encoding='ascii', file_format='pbm', width=10, height=6, comment='example 1', pixels=px)
call ex1%export_pnm('pnm_files/example1')
px(1, :) = [0, 0, 0, 0, 1, 0]
px(2, :) = [0, 0, 0, 0, 1, 0]
px(3, :) = [0, 0, 0, 0, 1, 0]
px(4, :) = [0, 0, 0, 0, 1, 0]
px(5, :) = [0, 0, 0, 0, 1, 0]
px(6, :) = [0, 0, 0, 0, 1, 0]
px(7, :) = [1, 0, 0, 0, 1, 0]
px(8, :) = [0, 1, 1, 1, 0, 0]
px(9, :) = [0, 0, 0, 0, 0, 0]
px(10, :) = [0, 0, 0, 0, 0, 0]

call ex1%import_pnm('pnm_files/example1','pbm','ascii')
call ex1%export_pnm('pnm_files/example1_ex')
call ex1%set_pnm(encoding='ascii', file_format='pbm', width=10, &
height=6, comment='example 1', pixels=px)
call ex1%export_pnm('pnm_files/example1')

call ex1%dlloc()
call ex1%import_pnm('pnm_files/example1', 'pbm', 'ascii')
call ex1%export_pnm('pnm_files/example1_ex')

call ex1%dlloc()

end program example1
Loading