cmyk_to_rgb Subroutine

private pure elemental subroutine cmyk_to_rgb(c, m, y, k, r, g, b)

Arguments

Type IntentOptional Attributes Name
integer(kind=ik), intent(in) :: c
integer(kind=ik), intent(in) :: m
integer(kind=ik), intent(in) :: y
integer(kind=ik), intent(in) :: k
integer(kind=ik), intent(out) :: r
integer(kind=ik), intent(out) :: g
integer(kind=ik), intent(out) :: b

Called by

proc~~cmyk_to_rgb~~CalledByGraph proc~cmyk_to_rgb cmyk_to_rgb proc~convert color%convert proc~convert->proc~cmyk_to_rgb proc~initialize_colors initialize_colors proc~initialize_colors->proc~convert proc~set color%set proc~initialize_colors->proc~set program~demo_color demo_color program~demo_color->proc~convert proc~find_nearest color%find_nearest program~demo_color->proc~find_nearest proc~print_available_colors color%print_available_colors program~demo_color->proc~print_available_colors proc~save_available_colors color%save_available_colors program~demo_color->proc~save_available_colors program~demo_color->proc~set program~example26 example26 program~example26->proc~convert program~example26->proc~set program~example27 example27 program~example27->proc~convert program~example27->proc~find_nearest program~example27->proc~set proc~find_nearest->proc~initialize_colors proc~print_available_colors->proc~initialize_colors proc~save_available_colors->proc~initialize_colors proc~set_by_name color%set_by_name proc~set_by_name->proc~initialize_colors proc~set->proc~set_by_name program~example29 example29 program~example29->proc~print_available_colors program~example29->proc~save_available_colors program~example28 example28 program~example28->proc~set

Source Code

   elemental pure subroutine cmyk_to_rgb(c, m, y, k, r, g, b)
      integer(ik), intent(in)  :: c, m, y, k
      integer(ik), intent(out) :: r, g, b
      real(rk) :: cr, mg, yl

      cr = real(c, kind=rk) / 100.0_rk
      mg = real(m, kind=rk) / 100.0_rk
      yl = real(y, kind=rk) / 100.0_rk

      r = nint(255.0_rk * (1.0_rk - cr) * (1.0_rk - real(k, kind=rk) / 100.0_rk), kind=ik)
      g = nint(255.0_rk * (1.0_rk - mg) * (1.0_rk - real(k, kind=rk) / 100.0_rk), kind=ik)
      b = nint(255.0_rk * (1.0_rk - yl) * (1.0_rk - real(k, kind=rk) / 100.0_rk), kind=ik)
   end subroutine cmyk_to_rgb