;pro makesquare

;To make the square that represents a 3x3 pixel region consisting of 
;the right colors

pro makesquare, XOff = XOff, YOff = YOff, $
		XWidth = XWidth, YWidth = YWidth, $
		TvFlag = TvFlag

;Offsets
If not keyword_set(XOff) then XOff = 0.90
If not keyword_set(YOff) then YOff = 0.800
If not keyword_set(XWidth) then XWidth = 0.025
If not keyword_set(YWidth) then YWidth = 0.025

If TvFlag eq 1 or TvFlag eq 2 then begin  

  TvImFlag = 0 

  ;lower left
  tvimage,[[[(replicate((fsc_color('orange',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('orange',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('orange',/triple,/row))[2],5,5))]]], $
	true =3, $
	position = [XOff, YOff, XOff+XWidth, YOff+YWidth],$
	/normal

  ;left
  tvimage,[[[(replicate((fsc_color('red',/triple,/row))[0],5,5))]],$
	[[(replicate((fsc_color('red',/triple,/row))[1],5,5))]],$
	[[(replicate((fsc_color('red',/triple,/row))[2],5,5))]]], $
	true =3, $
	position = [XOff,YOff+YWidth,XOff+XWidth,YOff+2*YWidth], $
	/normal

  ;upper left
  tvimage,[[[(replicate((fsc_color('blue',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('blue',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('blue',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff,YOff+2*YWidth,XOff+XWidth,YOff+3*YWidth],$
	/normal

  ;lower 
  tvimage,[[[(replicate((fsc_color('brown',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('brown',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('brown',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff+XWidth, YOff,XOff+2*XWidth,YOff+2*YWidth],$
	/normal
  ;middle
  tvimage,[[[(replicate((fsc_color('black',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('black',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('black',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff+XWidth,YOff+YWidth,XOff+2*XWidth,YOff+2*YWidth],$
	/normal

  ;upper
  tvimage,[[[(replicate((fsc_color('purple',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('purple',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('purple',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff+XWidth,YOff+2*YWidth,XOff+2*XWidth,YOff+3*YWidth], $
	/normal

  ;lower right
  tvimage,[[[(replicate((fsc_color('green',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('green',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('green',/triple,/row))[2],5,5))]]], $
        true =3, position = [XOff+2*XWidth,YOff,XOff+3*XWidth,YOff+YWidth], $
	/normal

  ;middle right
  tvimage,[[[(replicate((fsc_color('yellow',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('yellow',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('yellow',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff+2*XWidth,YOff+YWidth,XOff+3*XWidth,YOff+2*YWidth],$
	/normal

  ;upper right
  tvimage,[[[(replicate((fsc_color('pink',/triple,/row))[0],5,5))]],$
        [[(replicate((fsc_color('pink',/triple,/row))[1],5,5))]],$
        [[(replicate((fsc_color('pink',/triple,/row))[2],5,5))]]], $
        true =3, $
	position = [XOff+2*XWidth,YOff+2*YWidth,XOff+3*XWidth, YOff+3*YWidth],$
	/normal

Endif Else If TvFlag eq 3 then begin

  TvImFlag = 0

  ;lower left
  tvimage,[[(replicate((fsc_color('orange'))[0],5,5))]],$
        position = [XOff, YOff, XOff+XWidth, YOff+YWidth],$
        /normal, tv = TvImFlag
 
  ;left
  tvimage,[[(replicate((fsc_color('red'))[0],5,5))]],$
        position = [XOff,YOff+YWidth,XOff+XWidth,YOff+2*YWidth], $
        /normal, tv = TvImFlag
 
  ;upper left
  tvimage,[[(replicate((fsc_color('blue'))[0],5,5))]],$
        position = [XOff,YOff+2*YWidth,XOff+XWidth,YOff+3*YWidth],$
        /normal, tv = TvImFlag
 
  ;lower 
  tvimage,[[(replicate((fsc_color('brown'))[0],5,5))]],$
        position = [XOff+XWidth, YOff,XOff+2*XWidth,YOff+2*YWidth],$
        /normal, tv = TvImFlag
  ;middle
  tvimage,[[(replicate((fsc_color('black'))[0],5,5))]],$
        position = [XOff+XWidth,YOff+YWidth,XOff+2*XWidth,YOff+2*YWidth],$
        /normal, tv = TvImFlag
 
  ;upper
  tvimage,[[(replicate((fsc_color('purple'))[0],5,5))]],$
        position = [XOff+XWidth,YOff+2*YWidth,XOff+2*XWidth,YOff+3*YWidth], $
        /normal, tv = TvImFlag
 
  ;lower right
  tvimage,[[(replicate((fsc_color('green'))[0],5,5))]],$
        position = [XOff+2*XWidth,YOff,XOff+3*XWidth,YOff+YWidth], $
        /normal, tv = TvImFlag
 
  ;middle right
  tvimage,[[(replicate((fsc_color('yellow'))[0],5,5))]],$
        position = [XOff+2*XWidth,YOff+YWidth,XOff+3*XWidth,YOff+2*YWidth],$
        /normal, tv = TvImFlag
 
  ;upper right
  tvimage,[[(replicate((fsc_color('pink'))[0],5,5))]],$
        position = [XOff+2*XWidth,YOff+2*YWidth,XOff+3*XWidth, YOff+3*YWidth],$
        /normal, tv = TvImFlag

EndIf

end
