DECLARE SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM SHARED deg AS DOUBLE DIM SHARED rad AS DOUBLE DIM SHARED x1 AS DOUBLE DIM SHARED y1 AS DOUBLE DIM SHARED xx1 AS INTEGER DIM SHARED yy1 AS INTEGER DIM SHARED x2 AS DOUBLE DIM SHARED y2 AS DOUBLE DIM SHARED xx2 AS INTEGER DIM SHARED yy2 AS INTEGER DIM SHARED dash AS INTEGER CONST pi = 3.1415927# 'This is a degree wheel bitmap generator. Written by Lou Dudzik 12/2009. 'Screen 12 cannot set background color. Re-save as 24bit bitmap in paint, then invert colors. ' this sets up the screen with graphics viewport and text area CLS 'Clear screen. SCREEN 12 'Screen 12 is 640 by 480 pxl. PRINT "This will save the image as a bitmap. It will be saved in the PRINT "same folder this program resides in. Open it in paint and save" PRINT "as a 24-bit bitmap. Then invert the colors. After that, copy and " PRINT "paste as necessary to complete the wheel." INPUT ""; g CLS VIEW (0, 0)-(639, 479) 'Making the graphics veiwport square. In order to put a zero point in the middle, need an odd number of pixels. Instead of 480 pxls, using 479 pxls. Therefore 0 to 478. WINDOW (0, 0)-(639, 479) 'x Scale will be 0 to +639. This way pxl location is rounded off using CINT. Then a pxl is plotted with an exact pxl location, instead of relying on the LINE function to round off pixl location. LINE (0, 0)-(0, 479) 'vertical axis LINE (0, 0)-(639, 0) 'horizontal axis LINE (455, 455)-(639, 639) 'diag upper right FOR dash = 50 TO 550 STEP 50 LINE (dash, -6)-(dash, 6) 'draws hash marks on the axes. LINE (-6, dash)-(6, dash) NEXT dash FOR deg = 0 TO 45 'only drawing 1/8 of the wheel. Use paint to copy and past to complete the wheel. This way it will have symmetry in every way. rad = deg * (pi / 180#) 'converts degrees to radians IF CINT(deg / 45) = deg / 45 THEN 'plot the 45 degree increments x1 = 500# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 500# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 634# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 634# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 10) = deg / 10 THEN 'plot the 10 degree increments x1 = 100# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 100# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 639# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 639# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSEIF CINT(deg / 5#) = deg / 5 THEN 'plot the 5-degree increments x1 = 580# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 580# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 634# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 634# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) ELSE 'plot the 1 degree increments x1 = 600# * COS(rad) 'this determines the x position of the start point of the degree mark. y1 = 600# * SIN(rad) 'this determines the y position of the start point of the degree mark. x2 = 630# * COS(rad) 'this determines the x position of the finish point of the degree mark. y2 = 630# * SIN(rad) 'this determines the y position of the finish point of the degree mark. xx1 = CINT(x1) 'rounds to the nearest pxl yy1 = CINT(y1) 'rounds to the nearest pxl xx2 = CINT(x2) 'rounds to the nearest pxl yy2 = CINT(y2) 'rounds to the nearest pxl LINE (xx1, yy1)-(xx2, yy2) END IF NEXT deg 'END 'this is used for troubleshooting. it stops before the bitmap is saved. VIEW 'needed before saving the bitmap WINDOW 'needed before saving the bitmap FourBIT 0, 0, 639, 479, "DegWhlBig" 'this is the line to call the screen 12 bitmap generator 'important to note, before the call, if a WINDOW or VIEW command was set, they should be cancelled before calling the sub. 'This is done by a simple WINDOW and/or VIEW statement with no arguments. 'They must be reinstated after returning from the sub if further screen printing will be done. SYSTEM '------------------------this is the screen 12 bitmap generator--------------- SUB FourBIT (x1%, y1%, x2%, y2%, FileNAME$) DIM FileCOLORS%(1 TO 48) DIM Colors4%(15) IF INSTR(FileNAME$, ".BMP") = 0 THEN FileNAME$ = RTRIM$(LEFT$(FileNAME$, 8)) + ".BMP" END IF FOR x = x1% TO x2% FOR y = y1% TO y2% Colors4%(POINT(x, y)) = 1 NEXT y NEXT x FOR n = 0 TO 15 IF Colors4%(n) = 1 THEN SigCOLORS& = SigCOLORS& + 1 NEXT n FileTYPE$ = "BM" Reserved1% = 0 Reserved2% = 0 OffsetBITS& = 118 InfoHEADER& = 40 PictureWIDTH& = x2% - x1% + 1 PictureDEPTH& = y2% - y1% + 1 NumPLANES% = 1 BPP% = 4 Compression& = 0 WidthPELS& = 3780 DepthPELS& = 3780 NumCOLORS& = 16 IF PictureWIDTH& MOD 8 <> 0 THEN ZeroPAD$ = SPACE$((8 - PictureWIDTH& MOD 8) \ 2) END IF ImageSIZE& = (((ImageWIDTH& + LEN(ZeroPAD$)) * ImageDEPTH&) + .1) / 2 FileSIZE& = ImageSIZE& + OffsetBITS& Colr = 0 FOR n = 1 TO 48 STEP 3 OUT &H3C7, Colr FileCOLORS%(n) = INP(&H3C9) FileCOLORS%(n + 1) = INP(&H3C9) FileCOLORS%(n + 2) = INP(&H3C9) Colr = Colr + 1 NEXT n OPEN FileNAME$ FOR BINARY AS #1 PUT #1, , FileTYPE$ PUT #1, , FileSIZE& PUT #1, , Reserved1% 'should be zero PUT #1, , Reserved2% 'should be zero PUT #1, , OffsetBITS& PUT #1, , InfoHEADER& PUT #1, , PictureWIDTH& PUT #1, , PictureDEPTH& PUT #1, , NumPLANES% PUT #1, , BPP% PUT #1, , Compression& PUT #1, , ImageSIZE& PUT #1, , WidthPELS& PUT #1, , DepthPELS& PUT #1, , NumCOLORS& PUT #1, , SigCOLORS& u$ = " " FOR n% = 1 TO 46 STEP 3 Colr$ = CHR$(FileCOLORS%(n% + 2) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n% + 1) * 4) PUT #1, , Colr$ Colr$ = CHR$(FileCOLORS%(n%) * 4) PUT #1, , Colr$ PUT #1, , u$ 'Unused byte NEXT n% FOR y = y2% TO y1% STEP -1 FOR x = x1% TO x2% STEP 2 HiX = POINT(x, y) LoX = POINT(x + 1, y) HiNIBBLE$ = HEX$(HiX) LoNIBBLE$ = HEX$(LoX) HexVAL$ = "&H" + HiNIBBLE$ + LoNIBBLE$ a$ = CHR$(VAL(HexVAL$)) PUT #1, , a$ NEXT x PUT #1, , ZeroPAD$ NEXT y CLOSE #1 END SUB '-------------------------Four Bit----------------