diff --git a/README.md b/README.md index b65a7eac..d72bdf16 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/example/example1.f90 b/example/example1.f90 index f311832a..cda9bf39 100644 --- a/example/example1.f90 +++ b/example/example1.f90 @@ -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 diff --git a/example/example2.f90 b/example/example2.f90 index b7dcc58f..070a3ac6 100644 --- a/example/example2.f90 +++ b/example/example2.f90 @@ -1,3619 +1,3620 @@ program example2 - use forimage, only: format_pnm - implicit none - - type(format_pnm) :: ex2 - integer, dimension(60,60) :: px + use forimage, only: format_pnm + implicit none - px = transpose(reshape(& - [255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 251,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 251,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 251,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 251,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 251,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 237,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 237,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 237,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 237,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 0,& - 237,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 242,& - 0,& - 0,& - 0,& - 0,& - 0,& - 119,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255,& - 255]& - ,shape=shape(px))) + type(format_pnm) :: ex2 + integer, dimension(60, 60) :: px - call ex2%set_pnm(encoding='ascii', file_format='pgm', width=60, height=60, max_color=255, comment='example 2', pixels=px) - call ex2%export_pnm('pnm_files/example2') + px = transpose(reshape( & + [255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 251, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 251, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 251, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 251, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 251, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 237, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 237, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 237, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 237, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 0, & + 237, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 242, & + 0, & + 0, & + 0, & + 0, & + 0, & + 119, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255, & + 255] & + , shape=shape(px))) - call ex2%import_pnm('pnm_files/example2','pgm','ascii') - call ex2%export_pnm('pnm_files/example2_ex') + call ex2%set_pnm(encoding='ascii', file_format='pgm', width=60, & + height=60, max_color=255, comment='example 2', pixels=px) + call ex2%export_pnm('pnm_files/example2') - call ex2%dlloc() + call ex2%import_pnm('pnm_files/example2', 'pgm', 'ascii') + call ex2%export_pnm('pnm_files/example2_ex') + + call ex2%dlloc() end program example2 diff --git a/example/example3.f90 b/example/example3.f90 index 1c204e30..5778f38e 100644 --- a/example/example3.f90 +++ b/example/example3.f90 @@ -1,21 +1,22 @@ program example3 - use forimage, only: format_pnm - implicit none - - type(format_pnm) :: ex3 - integer, dimension(4,12) :: px + use forimage, only: format_pnm + implicit none - px(1,:) = [0,0,0,0,0,0,0,0,0,15,0,15] - px(2,:) = [0,0,0,0,15,7,0,0,0,0,0,0] - px(3,:) = [0,0,0,0,0,0,0,15,7,0,0,0] - px(4,:) = [15,0,15,0,0,0,0,0,0,0,0,0] + type(format_pnm) :: ex3 + integer, dimension(4, 12) :: px - call ex3%set_pnm(encoding='ascii', file_format='ppm', width=4, height=4, max_color=15, comment='example 2', pixels=px) - call ex3%export_pnm('pnm_files/example3') + px(1, :) = [0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15] + px(2, :) = [0, 0, 0, 0, 15, 7, 0, 0, 0, 0, 0, 0] + px(3, :) = [0, 0, 0, 0, 0, 0, 0, 15, 7, 0, 0, 0] + px(4, :) = [15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0] - call ex3%import_pnm('pnm_files/example3','ppm','ascii') - call ex3%export_pnm('pnm_files/example3_ex') + call ex3%set_pnm(encoding='ascii', file_format='ppm', width=4, height=4, & + max_color=15, comment='example 2', pixels=px) + call ex3%export_pnm('pnm_files/example3') - call ex3%dlloc() + call ex3%import_pnm('pnm_files/example3', 'ppm', 'ascii') + call ex3%export_pnm('pnm_files/example3_ex') + + call ex3%dlloc() end program example3 diff --git a/fprettify.rc b/fprettify.rc new file mode 100644 index 00000000..72cb1732 --- /dev/null +++ b/fprettify.rc @@ -0,0 +1,45 @@ +# Configuration file for work of fprettify on source code. +# +# This file determines how to maintain white space, indentations, use of +# upper/lower case. Though some of them represent default levels of the +# linter's parameters (as by version 0.3.7), all of them are compiled in +# the program's sequence when requesting help by `./fprettify -h`. The +# style is applied by +# +# ```shell +# fprettify -c ./fprettify.rc source.f90 +# ``` +# +# to overwrite the old form of file `source.f90`. +# +# The constraint of 80 characters per line was set to ease visual access +# of ford's multicolumn html, reading git logs/check changes by vimdiff. + +indent=3 +line-length=80 +whitespace=2 +whitespace-comma=True +whitespace-assignment=True + +# Control whitespace around '::' declarations +whitespace-decl=True +enable-decl=False + +whitespace-relational=True +whitespace-logical=True +whitespace-plusminus=True +whitespace-multdiv=False +whitespace-print=True + +whitespace-type=False +whitespace-intrinsics=True +strict-indent=True +enable-replacements=False +c-relations=False + +case=[1,1,1,1] +strip-comments=False +disable-fypp=False +disable-indent-mod=False + +# END diff --git a/src/forimage.f90 b/src/forimage.f90 index aa940505..f9bce15a 100644 --- a/src/forimage.f90 +++ b/src/forimage.f90 @@ -1,73 +1,88 @@ module forimage implicit none - + private public format_pnm - !=============================================================================== +!=============================================================================== type format_pnm - character(2) :: magic_number - integer :: width - integer :: height - character(70) :: comment - integer :: max_color - integer, dimension(:,:), allocatable :: pixels - character(3) :: file_format - character(5) :: encoding + character(2) :: magic_number + integer :: width + integer :: height + character(70) :: comment + integer :: max_color + integer, dimension(:, :), allocatable :: pixels + character(3) :: file_format + character(5) :: encoding contains - procedure :: set_format + procedure :: allocate_pixels + procedure :: dlloc => deallocate_pnm + procedure :: export_pnm + procedure :: import_pnm + procedure :: set_comment procedure :: set_file_format - procedure :: set_magicnumber - procedure :: set_width + procedure :: set_format + procedure :: set_header procedure :: set_height - procedure :: set_comment + procedure :: set_magicnumber procedure :: set_max_color - procedure :: set_header - procedure :: allocate_pixels procedure :: set_pixels - procedure :: export_pnm procedure :: set_pnm - procedure :: import_pnm - procedure :: dlloc => deallocate_pnm + procedure :: set_width end type format_pnm - !=============================================================================== +!=============================================================================== contains - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_file_format(this, file_format) - class(format_pnm), intent(inout) :: this - character(3), intent(in) :: file_format - - this%file_format = file_format - end subroutine set_file_format - !=============================================================================== - - - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_format(this, encoding) - class(format_pnm), intent(inout) :: this - character(*), intent(in) :: encoding - - this%encoding = encoding - end subroutine set_format - !=============================================================================== - +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine allocate_pixels(this) + class(format_pnm), intent(inout) :: this + select case (this%magic_number) + case ('P1') + if (.not. allocated(this%pixels)) allocate (this%pixels(this%height, & + this%width)) + case ('P2') + if (.not. allocated(this%pixels)) allocate (this%pixels(this%height, & + this%width)) + case ('P3') + if (.not. allocated(this%pixels)) allocate (this%pixels(this%height, & + 3*this%width)) + end select + end subroutine allocate_pixels +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi +!=============================================================================== +!> author: Seyed Ali Ghasemi elemental pure subroutine deallocate_pnm(this) class(format_pnm), intent(inout) :: this - if (allocated(this%pixels)) deallocate(this%pixels) + if (allocated(this%pixels)) deallocate (this%pixels) end subroutine deallocate_pnm - !=============================================================================== +!=============================================================================== + +!=============================================================================== +!> author: Seyed Ali Ghasemi + impure subroutine export_pnm(this, file_name) + class(format_pnm), intent(inout) :: this + character(*), intent(in) :: file_name + integer :: nunit, i + open (newunit=nunit, file=file_name//'.'//this%file_format, & + status='replace') + write (nunit, '(a)') this%magic_number + write (nunit, '(a,a)') '# ', this%comment + write (nunit, '(g0,1x,g0)') this%width, this%height + if (this%file_format /= 'pbm') write (nunit, '(g0)') this%max_color + do i = 1, size(this%pixels, 1) + write (nunit, '(*(g0,1x))') this%pixels(i, :) + end do + close (nunit) + end subroutine export_pnm +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi +!=============================================================================== +!> author: Seyed Ali Ghasemi impure subroutine import_pnm(this, file_name, file_format, encoding) class(format_pnm), intent(inout) :: this character(*), intent(in) :: file_name @@ -80,9 +95,9 @@ impure subroutine import_pnm(this, file_name, file_format, encoding) this%encoding = encoding select case (encoding) - case ('binary','raw') - - print*, 'Error: not implementet yet!' + case ('binary', 'raw') + + print *, 'Error: not implemented yet!' select case (file_format) case ('pbm') @@ -93,226 +108,183 @@ impure subroutine import_pnm(this, file_name, file_format, encoding) end select - case ('ascii','plain') + case ('ascii', 'plain') select case (file_format) case ('pbm') - open (newunit = nunit, file = file_name//'.'//file_format) - read(nunit,*) this%magic_number - read(nunit,*) temp,this%comment - read(nunit,*) this%width, this%height + open (newunit=nunit, file=file_name//'.'//file_format) + read (nunit, *) this%magic_number + read (nunit, *) temp, this%comment + read (nunit, *) this%width, this%height call this%allocate_pixels() - do i = 1, size(this%pixels,1) - read(nunit, *) this%pixels(i,:) + do i = 1, size(this%pixels, 1) + read (nunit, *) this%pixels(i, :) end do - close(nunit) + close (nunit) case ('pgm') - open (newunit = nunit, file = file_name//'.'//file_format) - read(nunit,*) this%magic_number - read(nunit,*) temp,this%comment - read(nunit,*) this%width, this%height - read(nunit,*) this%max_color + open (newunit=nunit, file=file_name//'.'//file_format) + read (nunit, *) this%magic_number + read (nunit, *) temp, this%comment + read (nunit, *) this%width, this%height + read (nunit, *) this%max_color call this%allocate_pixels() - do i = 1, size(this%pixels,1) - read(nunit, *) this%pixels(i,:) + do i = 1, size(this%pixels, 1) + read (nunit, *) this%pixels(i, :) end do - close(nunit) + close (nunit) case ('ppm') - open (newunit = nunit, file = file_name//'.'//file_format) - read(nunit,*) this%magic_number - read(nunit,*) temp,this%comment - read(nunit,*) this%width, this%height - read(nunit,*) this%max_color + open (newunit=nunit, file=file_name//'.'//file_format) + read (nunit, *) this%magic_number + read (nunit, *) temp, this%comment + read (nunit, *) this%width, this%height + read (nunit, *) this%max_color call this%allocate_pixels() - do i = 1, size(this%pixels,1) - read(nunit, *) this%pixels(i,:) + do i = 1, size(this%pixels, 1) + read (nunit, *) this%pixels(i, :) end do - close(nunit) + close (nunit) end select end select end subroutine import_pnm - !=============================================================================== - - - !=============================================================================== - !> author: Seyed Ali Ghasemi - pure subroutine set_pnm(this, encoding, file_format,width,height,max_color,comment,pixels) - class(format_pnm), intent(inout) :: this - integer, intent(in) :: width - integer, intent(in) :: height - character(*), intent(in) :: comment - integer, optional, intent(in) :: max_color - integer, dimension(:,:), intent(in) :: pixels - character(*), intent(in) :: encoding - character(3), intent(in) :: file_format - character(2) :: magic_number - - select case (encoding) - case ('ascii','plain') - select case (file_format) - case ('pbm') - magic_number = 'P1' - case ('pgm') - magic_number = 'P2' - case ('ppm') - magic_number = 'P3' - end select - case ('binary','raw') - error stop 'Error: not implementet yet!' - select case (file_format) - case ('pbm') - magic_number = 'P4' - case ('pgm') - magic_number = 'P5' - case ('ppm') - magic_number = 'P6' - end select - end select - - call this%set_format(encoding) - call this%set_file_format(file_format) - call this%set_header(magic_number,width,height,comment,max_color) - call this%allocate_pixels() - call this%set_pixels(pixels) - end subroutine set_pnm - !=============================================================================== +!=============================================================================== +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_comment(this, comment) + class(format_pnm), intent(inout) :: this + character(*), intent(in) :: comment + this%comment = comment + end subroutine set_comment +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine allocate_pixels(this) +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_file_format(this, file_format) class(format_pnm), intent(inout) :: this - select case(this%magic_number) - case('P1') - if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) - case('P2') - if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, this%width)) - case('P3') - if (.not.allocated(this%pixels)) allocate(this%pixels(this%height, 3*this%width)) - end select - end subroutine allocate_pixels - !=============================================================================== + character(3), intent(in) :: file_format + this%file_format = file_format + end subroutine set_file_format +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_magicnumber(this, magic_number) +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_format(this, encoding) class(format_pnm), intent(inout) :: this - character(*), intent(in) :: magic_number - this%magic_number = magic_number - end subroutine set_magicnumber - !=============================================================================== + character(*), intent(in) :: encoding + this%encoding = encoding + end subroutine set_format +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_width(this, width) +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_header(this, magic_number, width, height, & + comment, max_color) class(format_pnm), intent(inout) :: this + character(*), intent(in) :: magic_number integer, intent(in) :: width - this%width = width - end subroutine set_width - !=============================================================================== + integer, intent(in) :: height + character(*), intent(in) :: comment + integer, optional, intent(in) :: max_color + call this%set_magicnumber(magic_number) + call this%set_width(height) + call this%set_height(width) + call this%set_comment(comment) + if (this%file_format /= 'pbm') call this%set_max_color(max_color) + end subroutine set_header +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi +!=============================================================================== +!> author: Seyed Ali Ghasemi elemental pure subroutine set_height(this, height) class(format_pnm), intent(inout) :: this integer, intent(in) :: height this%height = height end subroutine set_height - !=============================================================================== - +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_comment(this, comment) +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_magicnumber(this, magic_number) class(format_pnm), intent(inout) :: this - character(*), intent(in) :: comment - this%comment = comment - end subroutine set_comment - !=============================================================================== - + character(*), intent(in) :: magic_number + this%magic_number = magic_number + end subroutine set_magicnumber +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi +!=============================================================================== +!> author: Seyed Ali Ghasemi elemental pure subroutine set_max_color(this, max_color) class(format_pnm), intent(inout) :: this integer, intent(in) :: max_color this%max_color = max_color end subroutine set_max_color - !=============================================================================== - - - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_header(this, magic_number, width, height, comment, max_color) - class(format_pnm), intent(inout) :: this - character(*), intent(in) :: magic_number - integer, intent(in) :: width - integer, intent(in) :: height - character(*), intent(in) :: comment - integer, optional, intent(in) :: max_color - - call this%set_magicnumber(magic_number) - call this%set_width(height) - call this%set_height(width) - call this%set_comment(comment) - if (this%file_format /= 'pbm') call this%set_max_color(max_color) - end subroutine set_header - !=============================================================================== +!=============================================================================== - - !=============================================================================== - !> author: Seyed Ali Ghasemi +!=============================================================================== +!> author: Seyed Ali Ghasemi pure subroutine set_pixels(this, pixels) - class(format_pnm), intent(inout) :: this - integer, dimension(:,:), intent(in) :: pixels + class(format_pnm), intent(inout) :: this + integer, dimension(:, :), intent(in) :: pixels this%pixels = pixels end subroutine set_pixels - !=============================================================================== - +!=============================================================================== + +!=============================================================================== +!> author: Seyed Ali Ghasemi + pure subroutine set_pnm(this, encoding, file_format, width, height, & + max_color, comment, pixels) + class(format_pnm), intent(inout) :: this + integer, intent(in) :: width + integer, intent(in) :: height + character(*), intent(in) :: comment + integer, optional, intent(in) :: max_color + integer, dimension(:, :), intent(in) :: pixels + character(*), intent(in) :: encoding + character(3), intent(in) :: file_format + character(2) :: magic_number - !=============================================================================== - !> author: Seyed Ali Ghasemi - elemental pure subroutine set_pixel(this, grey,r,g,b, i, j) - class(format_pnm), intent(inout) :: this - integer, intent(in), optional :: grey - integer, intent(in), optional :: r, g, b - integer, intent(in) :: i, j - select case(this%magic_number) - case('P1') - this%pixels(i,j) = grey - case('P2') - this%pixels(i,j) = grey - case('P3') - this%pixels(i,3*j-2) = r - this%pixels(i,3*j-1) = g - this%pixels(i,3*j-0) = b + select case (encoding) + case ('ascii', 'plain') + select case (file_format) + case ('pbm') + magic_number = 'P1' + case ('pgm') + magic_number = 'P2' + case ('ppm') + magic_number = 'P3' + end select + case ('binary', 'raw') + error stop 'Error: not implemented yet!' + select case (file_format) + case ('pbm') + magic_number = 'P4' + case ('pgm') + magic_number = 'P5' + case ('ppm') + magic_number = 'P6' + end select end select - end subroutine set_pixel - !=============================================================================== + call this%set_format(encoding) + call this%set_file_format(file_format) + call this%set_header(magic_number, width, height, comment, max_color) + call this%allocate_pixels() + call this%set_pixels(pixels) + end subroutine set_pnm +!=============================================================================== - !=============================================================================== - !> author: Seyed Ali Ghasemi - impure subroutine export_pnm(this, file_name) +!=============================================================================== +!> author: Seyed Ali Ghasemi + elemental pure subroutine set_width(this, width) class(format_pnm), intent(inout) :: this - character(*), intent(in) :: file_name - integer :: nunit, i - - open (newunit = nunit, file = file_name//'.'//this%file_format, status='replace') - write(nunit,'(a)') this%magic_number - write(nunit,'(a,a)') '# ',this%comment - write(nunit, '(g0,1x,g0)') this%width, this%height - if (this%file_format /= 'pbm') write(nunit,'(g0)') this%max_color - do i = 1, size(this%pixels,1) - write(nunit, '(*(g0,1x))') this%pixels(i,:) - end do - close(nunit) - end subroutine export_pnm - !=============================================================================== + integer, intent(in) :: width + this%width = width + end subroutine set_width +!=============================================================================== end module forimage