convert Subroutine

private pure elemental subroutine convert(this, to)

Type Bound

color

Arguments

Type IntentOptional Attributes Name
class(color), intent(inout) :: this
character(len=*), intent(in) :: to

Calls

proc~~convert~~CallsGraph proc~convert color%convert proc~cmyk_to_rgb cmyk_to_rgb proc~convert->proc~cmyk_to_rgb proc~decimal_to_rgb decimal_to_rgb proc~convert->proc~decimal_to_rgb proc~hex_to_rgb hex_to_rgb proc~convert->proc~hex_to_rgb proc~hsl_to_rgb hsl_to_rgb proc~convert->proc~hsl_to_rgb proc~hsv_to_rgb hsv_to_rgb proc~convert->proc~hsv_to_rgb proc~rgb_to_cmyk rgb_to_cmyk proc~convert->proc~rgb_to_cmyk proc~rgb_to_decimal rgb_to_decimal proc~convert->proc~rgb_to_decimal proc~rgb_to_hex rgb_to_hex proc~convert->proc~rgb_to_hex proc~rgb_to_hsl rgb_to_hsl proc~convert->proc~rgb_to_hsl proc~rgb_to_hsv rgb_to_hsv proc~convert->proc~rgb_to_hsv proc~rgb_to_xyz rgb_to_xyz proc~convert->proc~rgb_to_xyz proc~xyz_to_rgb xyz_to_rgb proc~convert->proc~xyz_to_rgb

Called by

proc~~convert~~CalledByGraph proc~convert color%convert 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 convert(this, to)
      class(color),     intent(inout) :: this
      character(len=*), intent(in)    :: to
      integer(ik)                     :: r, g, b

      select case (to)

       case ('rgb2hex')
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
       case ('rgb2decimal')
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
       case ('rgb2cmyk')
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
       case ('rgb2hsv')
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
       case ('rgb2hsl')
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
       case ('rgb2xyz')
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('rgb2all')
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('hex2rgb')
         call hex_to_rgb(this%hex, this%r, this%g, this%b)
       case ('hex2decimal')
         call hex_to_rgb(this%hex, r, g, b)
         call rgb_to_decimal(r, g, b, this%decimal)
       case ('hex2cmyk')
         call hex_to_rgb(this%hex, r, g, b)
         call rgb_to_cmyk(r, g, b, this%c, this%m, this%y, this%k)
       case ('hex2hsv')
         call hex_to_rgb(this%hex, r, g, b)
         call rgb_to_hsv(r, g, b, this%h, this%s, this%v)
       case ('hex2hsl')
         call hex_to_rgb(this%hex, r, g, b)
         call rgb_to_hsl(r, g, b, this%hl, this%sl, this%vl)
       case ('hex2xyz')
         call hex_to_rgb(this%hex, r, g, b)
         call rgb_to_xyz(r, g, b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('hex2all')
         call hex_to_rgb(this%hex, this%r, this%g, this%b)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('decimal2rgb')
         call decimal_to_rgb(this%decimal, this%r, this%g, this%b)
       case ('decimal2hex')
         call decimal_to_rgb(this%decimal, r, g, b)
         call rgb_to_hex(r, g, b, this%hex)
       case ('decimal2cmyk')
         call decimal_to_rgb(this%decimal, r, g, b)
         call rgb_to_cmyk(r, g, b, this%c, this%m, this%y, this%k)
       case ('decimal2hsv')
         call decimal_to_rgb(this%decimal, r, g, b)
         call rgb_to_hsv(r, g, b, this%h, this%s, this%v)
       case ('decimal2hsl')
         call decimal_to_rgb(this%decimal, r, g, b)
         call rgb_to_hsl(r, g, b, this%hl, this%sl, this%vl)
       case ('decimal2xyz')
         call decimal_to_rgb(this%decimal, r, g, b)
         call rgb_to_xyz(r, g, b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('decimal2all')
         call decimal_to_rgb(this%decimal, this%r, this%g, this%b)
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('cmyk2rgb')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, this%r, this%g, this%b)
       case ('cmyk2hex')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, r, g, b)
         call rgb_to_hex(r, g, b, this%hex)
       case ('cmyk2decimal')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, r, g, b)
         call rgb_to_decimal(r, g, b, this%decimal)
       case ('cmyk2hsv')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, r, g, b)
         call rgb_to_hsv(r, g, b, this%h, this%s, this%v)
       case ('cmyk2hsl')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, r, g, b)
         call rgb_to_hsl(r, g, b, this%hl, this%sl, this%vl)
       case ('cmyk2xyz')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, r, g, b)
         call rgb_to_xyz(r, g, b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('cmyk2all')
         call cmyk_to_rgb(this%c, this%m, this%y, this%k, this%r, this%g, this%b)
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('hsv2rgb')
         call hsv_to_rgb(this%h, this%s, this%v, this%r, this%g, this%b)
       case ('hsv2hex')
         call hsv_to_rgb(this%h, this%s, this%v, r, g, b)
         call rgb_to_hex(r, g, b, this%hex)
       case ('hsv2decimal')
         call hsv_to_rgb(this%h, this%s, this%v, r, g, b)
         call rgb_to_decimal(r, g, b, this%decimal)
       case ('hsv2cmyk')
         call hsv_to_rgb(this%h, this%s, this%v, r, g, b)
         call rgb_to_cmyk(r, g, b, this%c, this%m, this%y, this%k)
       case ('hsv2hsl')
         call hsv_to_rgb(this%h, this%s, this%v, r, g, b)
         call rgb_to_hsl(r, g, b, this%hl, this%sl, this%vl)
       case ('hsv2xyz')
         call hsv_to_rgb(this%h, this%s, this%v, r, g, b)
         call rgb_to_xyz(r, g, b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('hsv2all')
         call hsv_to_rgb(this%h, this%s, this%v, this%r, this%g, this%b)
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('hsl2hsv')
         call hsl_to_rgb(this%hl, this%sl, this%vl, r, g, b)
         call rgb_to_hsv(r, g, b, this%h, this%s, this%v)
       case ('hsl2rgb')
         call hsl_to_rgb(this%hl, this%sl, this%vl, this%r, this%g, this%b)
       case ('hsl2hex')
         call hsl_to_rgb(this%hl, this%sl, this%vl, r, g, b)
         call rgb_to_hex(r, g, b, this%hex)
       case ('hsl2decimal')
         call hsl_to_rgb(this%hl, this%sl, this%vl, r, g, b)
         call rgb_to_decimal(r, g, b, this%decimal)
       case ('hsl2cmyk')
         call hsl_to_rgb(this%hl, this%sl, this%vl, r, g, b)
         call rgb_to_cmyk(r, g, b, this%c, this%m, this%y, this%k)
       case ('hsl2xyz')
         call hsl_to_rgb(this%hl, this%sl, this%vl, r, g, b)
         call rgb_to_xyz(r, g, b, this%xyz_x, this%xyz_y, this%xyz_z)
       case ('hsl2all')
         call hsl_to_rgb(this%hl, this%sl, this%vl, this%r, this%g, this%b)
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_xyz(this%r, this%g, this%b, this%xyz_x, this%xyz_y, this%xyz_z)

       case ('xyz2rgb')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, this%r, this%g, this%b)
       case ('xyz2hex')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, r, g, b)
         call rgb_to_hex(r, g, b, this%hex)
       case ('xyz2decimal')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, r, g, b)
         call rgb_to_decimal(r, g, b, this%decimal)
       case ('xyz2cmyk')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, r, g, b)
         call rgb_to_cmyk(r, g, b, this%c, this%m, this%y, this%k)
       case ('xyz2hsv')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, r, g, b)
         call rgb_to_hsv(r, g, b, this%h, this%s, this%v)
       case ('xyz2hsl')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, r, g, b)
         call rgb_to_hsl(r, g, b, this%hl, this%sl, this%vl)
       case ('xyz2all')
         call xyz_to_rgb(this%xyz_x, this%xyz_y, this%xyz_z, this%r, this%g, this%b)
         call rgb_to_hex(this%r, this%g, this%b, this%hex)
         call rgb_to_decimal(this%r, this%g, this%b, this%decimal)
         call rgb_to_cmyk(this%r, this%g, this%b, this%c, this%m, this%y, this%k)
         call rgb_to_hsv(this%r, this%g, this%b, this%h, this%s, this%v)
         call rgb_to_hsl(this%r, this%g, this%b, this%hl, this%sl, this%vl)

      end select
   end subroutine convert