6 pure module function clr_to_hex_string(this) result(txt)
8 class(color),
intent(in) :: this
12 integer(int32) :: r, g, b, clr
15 if (this%red < 0)
then
17 else if (this%red > 255)
then
23 if (this%green < 0)
then
25 else if (this%green > 255)
then
31 if (this%blue < 0)
then
33 else if (this%blue > 255)
then
40 clr = ishft(r, 16) + ishft(g, 8) + b
43 write(txt,
'(Z6.6)') clr
47 pure module subroutine clr_copy_from(this, clr)
48 class(color),
intent(inout) :: this
49 class(color),
intent(in) :: clr
51 this%green = clr%green
58 pure module subroutine clr_assign(x, y)
59 type(color),
intent(out) :: x
60 class(color),
intent(in) :: y
65 pure module function clr_equals(x, y) result(rst)
66 type(color),
intent(in) :: x, y
69 if (x%red /= y%red .or. &
70 x%green /= y%green .or. &
78 pure module function clr_not_equals(x, y) result(rst)
79 type(color),
intent(in) :: x, y
81 rst = .not.clr_equals(x, y)