Download ACS Basic Graphics Programming
Transcript
ACS Basic Graphics Programming Manual 26 February 2015 ACS Basic Graphics Programming ACS Basic provides several commands to draw graphics. When used with the Color LCD 320x240 Terminal the graphics are displayed on an actual LCD display screen. When used with the CFSound-IV the graphics are displayed on a virtual screen that may be viewed and interacted with via a VNC network connection. In this manual the word ‘display’ refers to the Color LCD 320x240 Terminal LCD display screen or the CFSound-IV virtual display screen. Screen Coordinates The graphic drawing commands use pairs of numbers to identify where you want to draw on the display. In computer terminology these are referred to as screen coordinates. The first number of the pair is the X coordinate and identifies a horizontal starting point that ranges from zero to one less than the width of the display (0 – 319). The second number of the pair is the Y coordinate and identifies a vertical starting point that ranges from zero to one less than the height of the display (0 – 239). The X and Y coordinates for drawing start at 0, 0 at the lower left corner of the display and range to 319, 239 at the upper right corner of the display as shown in this diagram: X=0, y=239 X=319, y=239 Screen Coordinates X=0, y=0 X=319, y=0 Drawing is clipped at the coordinate boundaries of the display – commands that specify coordinates outside of these boundaries will not affect the display when either coordinate exceeds these values. Pixels The screen is divided up into thousands of dots arranged in columns (0 – 319) and rows (0 – 239) that can be individually colored with one of 65536 colors. In computer terminology these dots are referred to as pixels. The pixel color is selected by specifying the amount of three pure color components that are added to form the desired color – the amount of Red, the amount of Green and the amount of Blue. In computer terminology this is referred to as an additive RGB color model. The display supports 32 Red levels (0 – 31), 64 Green levels (0 – 63) and 32 Blue levels (0 – 31) for each pixel. There are more green levels than red or blue because the human eye is most sensitive to changes in green. Thirty two unique values can be determined using 5 binary bits, and sixty three unique values can be specified using 6 binary bits – so this form of RGB color encoding is known as RGB565. Hey – the total number of bits is 16 – the same number in our integer arithmetic! So, since the colors are additive, black must be equal to zero, and white must be equal to 65535 (largest 16-bit number). The ACS Basic drawing commands allow your program to control the colors of one or more pixels at a time, depending upon the command, to draw graphic objects. The command to draw a single pixel is the simplest command – this table shows how the command is constructed and what the command arguments are (don’t type this in directly, it is a description showing you how to construct this command): DRAW.PIXEL x,y,color x screen x coordinate (0 – 319) y screen y coordinate (0 – 240) color RGB565 pixel color Sets the pixel at x,y on the current drawing @SURFACE to color Copyright©1992-2015 by ACS, Sarasota, Florida 1 ALL RIGHTS RESERVED