In the code snippet below, the verb "paint" is meant
to produce rectangles that are defined in the noun "rects",
but only the first rectangle is painted, for me.

So first I would like to know how to produce the other
rectangles.

And second I would like to know how to produce rectangles
that have dimensions that are compatible with the dimensions
of isigraph controls created with "xywh" dimensions. I think
there is a difference caused by measures in "pixels" and in
"units", but I cannot find a conversion between the two
measurement scales.

************test script below**************

NB. rectangles.ijs
NB. 5/23/7

require'gl2'
coinsert'jgl2'

GL2LAB=: 0 : 0
pc gl2lab closeok;
xywh 0 0 500 500;cc g isigraph rightmove bottommove;
cc pic isigraph;setxywhx pic 10 30 40 70;
pas 0 0;
rem form end;
)

gl2lab_run=: 3 : 0
wd GL2LAB
wd'pshow;'
)

gl2lab_g_paint=: 3 : 0
glrgb 255 0 0       NB. RGB red
glbrush ''          NB. red brush
glrect 10 30 40 70 NB. red rectangle
)

rects =: 70 70,"1~15 15, 95 15,: 175 15

paint=:4 : 0
  NB. wd'psel paledit;pactive;pshow'
  glsel 'pic'
  glrgb x
  glbrush ''
  glrect y{rects
  glpaint ''
  wd 'pshow;'
)

NB. create form (or just repaint if it already exists)
gl2lab=: 3 : 0
try.
  wd'psel gl2lab'
  glclear''        NB. clear out old drawing
  gl2lab_g_paint'' NB. new drawing
  glpaint''        NB. copy to screen
catch.
  gl2lab_run''
end.
)

Note 'demo'
gl2lab_run''
255 0 0   paint 0       NB. paints
255 255 0 paint 1       NB. NO paint
255 0 255 paint 2       NB. NO paint
)

************test script above**************

(B=)

Brian Schott
Atlanta, GA, USA
schott DOT bee are eye eh en AT gee em ae eye el DOT com
http://schott.selfip.net/~brian/
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to