Scripts/GL Image

From J Wiki
Jump to navigation Jump to search

Wm yes check.png

Name

glimage -- ad hoc image created with gl commands

Instalation

Copy to user/glimage.ijs

Usage

require '~user/glimage.ijs'

viewrgb 'glcommands ...' gli width,height

savemat_jviewmat_ 'gl.bmp'
viewbmp 'gl.bmp'

Examples

Simple one-line script

viewrgb 'glellipse 10 10,(,~W)-20' gli 200 200
Gli1.png

Larger example. First, define a noun-script:

t1=: 0 : 0
  glbrush glrgb 3#196
  glpen 2 0 [  glrgb 3#128
  glellipse 10 10,(W,H)-20
  glfont 'Arial 14 bold angle150'
  gltext 'Hello, world!' [ gltextxy 40,H%2
)

Then call gli

  viewrgb t1 gli 200 100
  savemat_jviewmat_ 'gl.bmp'
  viewbmp 'gl.bmp'
Gli2.png

The following method allows generating huge images, larger than the screen size. Don't try this at home. If image is black you are out of memory.

'g.bmp' writebmp~ 'glellipse 50 50,,~W-100[glpen 20 0' gli 2#2200

View


Contributed by Oleg Kobchenko