This morning I worked hard and made Pie Chart Maker 2. It lets you make many slices of the pie using random colors. I also added printer support to be able to print it on the printer. It uses bplus's graphic rotation to be able to print the screen vertically instead of the default landscape. Thanks! You can add up to 500 slices but I doubt anyone will make that many. lol
Thank you everyone for your support, it helps a lot because I don't have any forums or email or anything on my website that tells me people are using my programs.
Oh also, this program will tell you if you have gone past the 100% mark and ask you to type it in again, after the first slice.
As with the other one, it lets you save to a .bmp file as well to be used with other programs.
(There is an updated version after this post.)
'One Piece Pie Chart Maker by Ken G. on Oct. 31. 2019.
'Thank you to bplus for the graphic rotation for printer support.
'Thank you also to everyone on the QB64.org forum for your support!
'Freeware
_TITLE "One Piece Pie Chart Maker" again:
INPUT "How many slices for your chart (1-500):"; amount
p = 0
pc = 100
seconds = 0
sec = 0
pc = pc - p
again2:
LOCATE 1, 1:
PRINT amount
- slice
+ 1;
". Type Percentage Here (0 -"; pc;
"):";
seconds = sec
sec = (p * .6) + seconds
seconds = seconds + .0001
s = (60 - seconds) * 6 + 180
c = c + .000125
two:
'Erase the input line
'Hole Filler
_TITLE "(T)ext, (P)rint, (S)ave, (D)elete, Esc to Quit" 'Print to your printer.
printing:
LOCATE 1, 1:
INPUT "Are you sure you want to print to your printer (Y/N):"; yn$
printing2:
'printer prep (code copied and pasted from bplus Free Calendar Program)
_MAPTRIANGLE (XMAX
, 0)-(0, 0)-(0, YMAX
), 0 TO(0, 0)-(0, XMAX
)-(YMAX
, XMAX
), landscape&
_MAPTRIANGLE (XMAX
, 0)-(XMAX
, YMAX
)-(0, YMAX
), 0 TO(0, 0)-(YMAX
, 0)-(YMAX
, XMAX
), landscape&
landscape& = 0
j& = 0
'Add text to the picture.
Text:
_TITLE "TEXT MODE - Use Mouse To Click Where You Want To Place Text Then Type Text And Press Enter To Finish." clr&
= POINT(mouseX
, mouseY
) LOCATE mouseY
/ 16, mouseX
/ 8 _TITLE "(T)ext, (S)ave, (D)elete, Esc to Quit" 'Save .bmp picture file to your computer.
saving:
'Now we call up the SUB to save the image to BMP.
SaveImage 0, "temp.bmp"
PRINT " Your BMP file will be saved in the" PRINT " same directory as this program is." PRINT " It can be used with almost any" PRINT " other graphics program or website." PRINT " It is saved using:" PRINT " width: 800 height: 600 pixels." PRINT " Type a name to save your picture" PRINT " and press the Enter key. Do not" PRINT " add .bmp at the end, the program" PRINT " will do it automatically." PRINT " Also do not use the name temp" PRINT " because the program uses that name" PRINT " and it would be erased the next time" PRINT " you save a picture." PRINT " Q and Enter goes to main screen." nm$ = nm$ + ".bmp"
'Checking to see if the file already exists on your computer.
PRINT " File Already Exists" PRINT " Saving will delete your old" PRINT " Would you like to still do it?" PRINT " Esc goes to start screen." llloop:
saving2:
'Rename temp.bmp to your chosen name.
nm$ = ""
INPUT "Do you wish to make another pie chart (Y/N):"; yesno$
IF bytesperpixel&
= 1 THEN bpp&
= 8 ELSE bpp&
= 24 b$
= "BM????QB64????" + MKL$(40) + MKL$(x&
) + MKL$(y&
) + MKI$(1) + MKI$(bpp&
) + MKL$(0) + "????" + STRING$(16, 0) 'partial BMP header info(???? to be filled later) FOR c&
= 0 TO 255 ' read BGR color settings from JPG image + 1 byte spacer(CHR$(0)) MID$(b$
, 11, 4) = MKL$(LEN(b$
)) ' image pixel data offset(BMP header) FOR py&
= y&
- 1 TO 0 STEP -1 ' read JPG image pixel color data r$ = ""
c&
= POINT(px&
, py&
) 'POINT 32 bit values are large LONG values d$ = d$ + r$ + padder$
MID$(b$
, 35, 4) = MKL$(LEN(d$
)) ' image size(BMP header) b$ = b$ + d$ ' total file data bytes to create file
MID$(b$
, 3, 4) = MKL$(LEN(b$
)) ' size of data file(BMP header)