color Subroutine

public subroutine color(icolor)

NAME

color(3f) - [M_pixel:COLOR] set current color index
(LICENSE:PD)

SYNOPSIS

definition:

subroutine color(col)
integer,intent(in) :: col

DESCRIPTION

Set the current color. The standard colors are as follows:

   black  =  0  red      =  1  green  =  2  yellow  =  3
   blue   =  4  magenta  =  5  cyan   =  6  white   =  7

OPTION

 COL  A color number from 0 to 255. To define additional
      colors see mapcolor(3f).

EXAMPLE

Sample program:

 program demo_color
 use M_pixel
 use M_writegif, only : writegif
 implicit none
 real    :: b=0.5
 real    :: y1,y2,ym,x1,x2
 real    :: width=50.0/8.0,width2
 integer :: i
    !! set up long bar as plotting area
    call prefsize(1000,200)
    call vinit()
    call ortho2(-25.0-b, 25.0+b, -5.0-b, 5.0+b)
    call textsize( 3.5, 4.0)
    call font('DUPLEX')
    call centertext(.true.)
    call linewidth(90)
    y1=-5
    y2=5
    ym=0
    x1=-25+.05*width
    ! draw colored rectangle and a circle and label center of circle
    ! and repeat from colors 0 to 7.
    width2=width*0.95
    do i=0,7
       call color(i)
       x2=x1+width2
       call makepoly()
       call rect(x1,y1,x2,y2)
       call closepoly()
       call color(i+1)
       call move2((x1+x2)/2.0,ym)
       call drawstr(i)     ! convert number to string and draw it
       call circle((x1+x2)/2.0, ym, (x2-x1)/2.10)
       x1=x1+width
    enddo
    ! write plot as GIF file
    call writegif('color.3m_pixel.gif',P_pixel,P_colormap)
    call vexit()
    ! use system to display GIF file
    call execute_command_line('display color.3m_pixel.gif')
 end program demo_color

AUTHOR

John S. Urban

LICENSE

Public Domain

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: icolor

Contents

Source Code


Source Code

subroutine color(icolor)

! ident_16="@(#) M_pixel color(3f) set current color for lines drawn in pixel image"

integer,intent(in) :: icolor
   P_COLOR_INDEX=icolor
end subroutine color