kipp_render Subroutine

public subroutine kipp_render()

Render scene to current device.

Interactive device (/xw) opens once, new page per render; file device (/png etc) opens fresh per render so output file is stable.

Arguments

None

Source Code

   subroutine kipp_render()
      !! Render scene to current device.
      !!
      !! Interactive device (/xw) opens once, new page per render; file device (/png etc) opens
      !! fresh per render so output file is stable.
      logical :: newdev
      if (st%interactive) then
         newdev = st%devid <= 0
         if (newdev) then
            st%devid = giza_open_device(trim(st%device), trim(st%prefix))
            if (st%devid <= 0) then
               print *, '[kipp] cannot open device ', trim(st%device)
               return
            end if
            ! no "RETURN for next page" prompt between interactive renders
            call giza_stop_prompting()
         end if
         ! compose the frame off-screen and blit it once: without buffering
         ! giza copies the pixmap to the window after every primitive, so
         ! rapid zooms/pans flash the erased page, box and colorbar while
         ! they repaint.  Buffered, the window keeps the previous frame
         ! until giza_end_buffer swaps in the completed new one.
         call giza_begin_buffer()
         if (.not. newdev) call giza_change_page()
         call draw_scene()
         call giza_end_buffer()
      else
         st%devid = giza_open_device(trim(st%device), trim(st%prefix))
         if (st%devid <= 0) then
            print *, '[kipp] cannot open device ', trim(st%device)
            return
         end if
         call draw_scene()
         call giza_close_device()
         st%devid = -1     ! device is closed; nothing persists in file mode
         print '(a)', '[kipp] wrote '//trim(st%prefix)//'.png'
      end if
   end subroutine kipp_render