PROGRAM GRAPHIC!       Example graphic.f

! Code converted using TO_F90 by Alan Miller
! Date: 2001-03-15  Time: 00:02:46

USE JAPI


INTEGER :: frame,canvas


INTEGER,dimension(1:10) ::x,y
!DATA x /10,20,30,40,50,60,70,80,90,100/
!DATA y /10,90,10,90,10,90,10,90,10,90/
x(1:10)= (/ 10,20,30,40,50,60,70,80,90,100 /)
y(1:10)=(/ 10,90,10,90,10,90,10,90,10,90 /)

IF( .NOT. j_start()) THEN
  PRINT*, "can't connect to JAPI server"
  GO TO 20
END IF

frame   = j_frame("Graphik Primitiven")
CALL j_setsize(frame,720,260)

canvas  = j_canvas(frame,700,230)
CALL j_setpos(canvas,10,30)

CALL j_show(frame)
CALL j_pack(frame)

CALL j_setnamedcolor(canvas,j_blue)

!       call j_cliprect(canvas,30,30,170,170)

!--     Normal

CALL j_translate(canvas,10,10)
CALL j_drawline(canvas,10,10,90,90)
CALL j_drawstring(canvas,0,105,"Line")

CALL j_translate(canvas,100,0)
CALL j_drawpolygon(canvas,10,x,y)
CALL j_drawstring(canvas,0,105,"Polygon")

CALL j_translate(canvas,100,0)
CALL j_drawrect(canvas,10,10,80,80)
CALL j_drawstring(canvas,0,105,"Rectangle")

CALL j_translate(canvas,100,0)
CALL j_drawroundrect(canvas,10,10,80,80,20,20)
CALL j_drawstring(canvas,0,105,"RoundRect")

CALL j_translate(canvas,100,0)
CALL j_drawcircle(canvas,50,50,40)
CALL j_drawstring(canvas,0,105,"Circle")

CALL j_translate(canvas,100,0)
CALL j_drawoval(canvas,50,50,40,20)
CALL j_drawstring(canvas,0,105,"Oval")

CALL j_translate(canvas,100,0)
CALL j_drawarc(canvas,50,50,40,30,113,210)
CALL j_drawstring(canvas,0,105,"Arc")


!--     Filled

CALL j_translate(canvas,-600,100)
CALL j_drawpolyline(canvas,10,x,y)
CALL j_drawstring(canvas,0,105,"Polyline")

CALL j_translate(canvas,100,0)
CALL j_fillpolygon(canvas,10,x,y)
CALL j_drawstring(canvas,0,105,"FillPolygon")

CALL j_translate(canvas,100,0)
CALL j_fillrect(canvas,10,10,80,80)
CALL j_drawstring(canvas,0,105,"FillRectangle")

CALL j_translate(canvas,100,0)
CALL j_fillroundrect(canvas,10,10,80,80,20,20)
CALL j_drawstring(canvas,0,105,"FillRoundRect")

CALL j_translate(canvas,100,0)
CALL j_fillcircle(canvas,50,50,40)
CALL j_drawstring(canvas,0,105,"FillCircle")

CALL j_translate(canvas,100,0)
CALL j_filloval(canvas,50,50,40,20)
CALL j_drawstring(canvas,0,105,"FillOval")

CALL j_translate(canvas,100,0)
CALL j_fillarc(canvas,50,50,40,30,113,210)
CALL j_drawstring(canvas,0,105,"FillArc")

NEXTACTION: DO
      IF(j_nextaction() == frame) EXIT NEXTACTION
END DO NEXTACTION

20  continue
CALL j_quit()
END PROGRAM GRAPHIC

