color_slice Subroutine

private subroutine color_slice(self, j, i1, i2, lo, hi, c)

As slice, for the colors of a colored chain: c(rgba, point) of points lo .. hi of chunk j (null if not colored or nothing there).

Type Bound

LineChain

Arguments

Type IntentOptional Attributes Name
class(LineChain), intent(in) :: self
integer, intent(in) :: j

the chunk, and points i1 .. i2 (chain indices)

integer, intent(in) :: i1

the chunk, and points i1 .. i2 (chain indices)

integer, intent(in) :: i2

the chunk, and points i1 .. i2 (chain indices)

integer, intent(out) :: lo

chain indices (lo > hi: none)

integer, intent(out) :: hi

chain indices (lo > hi: none)

real(kind=c_float), intent(out), dimension(:,:), pointer :: c

(4, hi-lo+1): [r, g, b, a]


Calls

proc~~color_slice~~CallsGraph proc~color_slice LineChain%color_slice interface~vkf_line_colors vkf_line_colors proc~color_slice->interface~vkf_line_colors

Called by

proc~~color_slice~~CalledByGraph proc~color_slice LineChain%color_slice proc~point_color LineChain%point_color proc~point_color->proc~color_slice proc~write_intermediates write_intermediates proc~write_intermediates->proc~color_slice proc~write_marker write_marker proc~write_marker->proc~color_slice proc~write_segments~2 write_segments proc~write_segments~2->proc~color_slice proc~add_intermediates add_intermediates proc~add_intermediates->proc~write_intermediates proc~drawn_segment~2 CustomLineSegments%drawn_segment proc~drawn_segment~2->proc~point_color proc~marker_drawn_color MarkerArtist%marker_drawn_color proc~marker_drawn_color->proc~point_color proc~marker_update MarkerArtist%marker_update proc~marker_update->proc~write_marker proc~marker_update->proc~add_intermediates proc~segments_late_update CustomLineSegments%segments_late_update proc~segments_late_update->proc~write_segments~2

Source Code

    subroutine color_slice(self, j, i1, i2, lo, hi, c)
        class(LineChain), intent(in) :: self
        integer, intent(in) :: j, i1, i2                            !! the chunk, and points i1 .. i2 (chain indices)
        integer, intent(out) :: lo, hi                              !! chain indices (lo > hi: none)
        real(c_float), dimension(:,:), pointer, intent(out) :: c    !! (4, hi-lo+1): [r, g, b, a]
        real(c_float), dimension(:,:), pointer :: all
        integer(c_int) :: capacity
        type(c_ptr) :: data
        c => null()
        associate (k => self%chunks(j))
            lo = max(i1, k%first)
            hi = min(i2, k%first + k%capacity - 1)
            if (lo > hi .or. .not. self%colored) return
            data = vkf_line_colors(k%line, capacity)
            if (.not. c_associated(data)) return
            call c_f_pointer(data, all, [4, int(capacity)])
            c => all(:, lo-k%first+1:hi-k%first+1)
        end associate
    end subroutine color_slice