vinit Subroutine

public subroutine vinit(string)

NAME

vinit(3f) - [M_pixel] initialize pixel graphics module
(LICENSE:PD)

SYNOPSIS

definition:

subroutine vinit()

DESCRIPTION

Initialize the pixel graphics module. The pixel array P_pixel and the
colormap P_ColorMap are directly accessible after the call to allow
display or printing

OPTIONS

EXAMPLE

Sample program:

  program demo_vinit
  use M_pixel, only    : prefsize, vinit, ortho2, clear
  use M_pixel, only    : move2, draw2, vexit, color
  use M_pixel, only    : P_pixel, P_colormap
  use M_writegif, only : writegif
  implicit none
     call prefsize(60,40)
     call vinit()
     call ortho2(-300.0,300.0,-200.0,200.0)
     call clear(0)
     call color(1)
     call move2(-300.0,-200.0)
     call draw2(300.0,200.0)
     call move2(300.0,-200.0)
     call draw2(-300.0,200.0)
     call writegif('vinit.3m_pixel.gif',P_pixel,P_colormap)
     call vexit()
  end program demo_vinit

AUTHOR

John S. Urban

LICENSE

Public Domain

Arguments

Type IntentOptional Attributes Name
character(len=*), optional :: string

Contents

Source Code


Source Code

subroutine vinit(string)

! ident_32="@(#) M_pixel vinit(3f) initialize pixel array drawing module"

character(len=*),optional :: string

   P_X=0                                ! initialize current position
   P_Y=0

   if(allocated(P_pixel))then
      deallocate(P_Pixel)
   endif
   allocate(P_pixel(0:P_VIEWPORT_WIDTH-1,0:P_VIEWPORT_HEIGHT-1))
   P_VINIT_CALLED=.true.
   P_pixel=0

   P_WIDTH=1             ! line width
   P_COLOR_INDEX=1       ! pen color
   P_NSEGS=60            ! number of line segments making up a circle

!  If a pixel array has been declared to be real :: array(600,400)
!
!       o-----> X                         (right=600,top=0)
!       | #------------------------------------#
!       | |                                    |
!       | |                                    |
!       V |                                    |
!       Y |                                    |
!         #------------------------------------#
!    (left=0,bottom=400)
   P_viewport_left=0.0
   P_viewport_right=real(P_VIEWPORT_WIDTH-1)
   P_viewport_bottom=real(P_VIEWPORT_HEIGHT-1)
   P_viewport_top=0.0

   P_window_left=0.0
   P_window_right=real(P_VIEWPORT_WIDTH)
   P_window_bottom=0.0
   P_window_top=real(P_VIEWPORT_HEIGHT)
   call mapping()

   P_TEXT_HEIGHT=10.0
   P_TEXT_WIDTH=7.0
   P_TEXT_ANGLE=0.0
   P_TEXT_COSINE=1.0
   P_TEXT_SINE  =0.0
   P_X_CENTERTEXT=.false.
   P_Y_CENTERTEXT=.false.
   P_FONT='SIMPLEX'

   P_inpolygon=.false.
   P_polyvertex=1

end subroutine vinit