| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
SSHAPE image , { [ + | - ] xValA [ , [ + | - ] yValA ] | distanceA ; angleA } [ , { [ + | - ] xValB [ , [ + | - ] yValB ] | distanceB ; angleB } ]
*Due to a bug in the original C128 ROMs (start-up message says (c)1985), only positive/unsigned values of 0 to 65535 may be used.
Save a rectangular region of the bitmap screen to RAM.
The image is a string variable in which to save a portion of the bitmap. Attempting to omit image, or use a literal value (numeric or string), will generate SYNTAX ERROR. Attempting to use a numeric variable will generate a TYPE MISMATCH ERROR. Because a BASIC string is limited to 255 bytes, the area of the bitmap you can save is limited. To determine the number of bytes (length of string) that will be needed, use this formula: Bytes needed = INT((Width + bits_per_pixel - 1) / 4 / bits_per_pixel) * Height + 4 where bits_per_pixel is 1 for high-resolution or 2 for multi-color bitmap mode. You might (correctly) infer from that formula that only the bitmap pixels are saved, the color information is not! Anyway, using the full screen width, the biggest image you can save is 6 rasters tall. Using the full screen height, the biggest image you can save is 8 pixels wide (high-res bitmap) or 4 pixels wide (multi-color). The area of the bitmap that is to be saved as an image is specified by two corners of a rectangle. Each corner is specified by a point. The first point (following the image variable) is required. The second point is optional; it defaults to the pixel cursor (the last point calculated in the previous bitmap command). Any specified points will be effected by SCALE if it is active. The resulting points may be off-screen, but no error occurs as long as they are legal values as shown above. These off-screen regions are saved in the image as 0 bits (representing the background color). The region specified by the corner points is inclusive. So for example, SSHAPE A$, 0,0, 7,7 will save an area 8 pixels wide and 8 pixels tall. For numeric parameters (all but image), any floating-point numbers will first be converted to integers (see INT). If any value is out-of-range (see above) an ILLEGAL QUANTITY ERROR is generated. If no bitmap has been setup (see GRAPHIC), a NO GRAPHICS AREA is generated. Once you haved saved an image, with SSHAPE (or SPRSAV), it is easy to make copies in memory with simple variable assignments (see LET) but there is seldom any reason to do this! For experimenting, note the syntax of this command/statement is almost identical to BOX, so you can use the BOX with the same parameters except specify a colorSource instead of the image variable. This will draw a rectangle around the region that would be saved. Note the pixels under the BOX boundry would also be saved, not just the pixels inside. Example of omitting optional "Corner B":
Example of relative rectangular and polar coordinate:
Typical example (both corners):
© H2Obsession, 2014 |