Bitmap/Fortran: Difference between revisions
Content added Content deleted
m (moved Basic bitmap storage/Fortran to Bitmap/Fortran) |
No edit summary |
||
Line 32: | Line 32: | ||
img%height = 0 |
img%height = 0 |
||
end subroutine init_img |
end subroutine init_img |
||
subroutine set_color(color, r, g, b) |
|||
type(rgb), intent(out) :: color |
|||
integer, intent(in) :: r, g, b |
|||
where ( r > 255 ) |
|||
color%red = 255 |
|||
elsewhere ( r < 0 ) |
|||
color%red = 0 |
|||
else |
|||
color%red = r |
|||
end where |
|||
where ( g > 255 ) |
|||
color%green = 255 |
|||
elsewhere ( g < 0 ) |
|||
color%green = 0 |
|||
else |
|||
color%green = g |
|||
end where |
|||
where ( b > 255 ) |
|||
color%blue = 255 |
|||
elsewhere ( b < 0 ) |
|||
color%blue = 0 |
|||
else |
|||
color%blue = b |
|||
end where |
|||
end subroutine set_color |
|||
function colordistance(c1, c2) result(res) |
function colordistance(c1, c2) result(res) |