Subscribe Bookmark
Craige_Hales

Staff

Joined:

Mar 21, 2013

Wall Paper

No video this time, it seems to move all by itself. 

The JSL, attached below, is the first step in another project.  It demonstrates drawing into a matrix (circles and text), displaying the image on the screen, and, commented-out at the end, saving the image to disk. 

The different size circles (nib is an old term for the part of a pen that touches the paper) are pre-rendered into an array.  If you run the JSL a second time, it detects the array already exists and doesn't spend any time regenerating it.  The ParallelAssign function is used to create the nibs; if you have enough CPUs it may be pretty fast anyway. The nib-circles have soft edges.

The DrawCircle function uses the selected pre-rendered nib to do a fast matrix assignment into the pixel matrix.  The strange looking :: operator is building an array of subscripts to reference a small part of the pixels matrix and also has to clip near the edges.  The final assignment in DrawCircle is doing alpha blending.  Notice the :* operator -- that's the element-wise matrix multiplier.  It took several hours to figure out what was wrong when I used the matrix multiply...very odd (and interesting) errors.

The image is built in gray-scale and the color is created in the NewImage at the end with the coefficients on the R,G,B colors.

This image is 1080x1920.  Make sure you know how to change your wallpaper back to something less unsettling.

10134_wallPaper.png

Article Tags