Well even Liberty BASIC 4.5 allows constant drawing if you manage the segments correctly. No need for API. Perhaps if you gave us an example of the kind of drawing you are talking about? Not sure what memory management tools we will have in LB5, perhaps none are needed. Bit too early to know.
If you have not got involved yet you can get an Alpha release to explore here
Thanks Rod. This is an old subject.(very old) I seen 4.51 was released and I owned 4.50 (paid for) and was seeing if perhaps Carl took up the task of working on the core graphics for LB and the color extraction. I have advanced enough to achieve the drawing tasks I desire using FLUSH. As for the compressed encoder info, I can store the info in files without using APIs by recording the colors as they are being drawn in an array and then compress them after. Perhaps you can help me Rod. How many plots on the screen can I do in between flushes and how does flush take up memory? Can I just reset flush memory and then after lots of draws and flushes are done, just flush the larger drawn image? OR perhaps I could just save the BMP image every so often and load it back on the screen and draw some more and flush and repeat these tasks? I dont need code sample. I just would like to know what order you would do it if you were not allowed to use APIs and had this challenge.
Post by Brandon Parker on Nov 17, 2019 16:17:28 GMT -5
Michael, In the event that you are going to be drawing on/off to a GraphicBox (something like Paint), you should use the Flush command to create a segment. In creating a segment, you can then delete said segment at a later time if you desire. Just using Flush alone does not provide that ability.
Here are steps 1. Draw to the GraphicBox 2. Flush SegmentName to the GraphicBox (print #handle, "flush segmentName"). 3. Draw to the GraphicBox some more 4. If you want to have something like the ability to undo several drawing operations then Flush DifferentSegmentName to the GraphicBox. Otherwise, you can flush with the same SegmentName. 5. Remove a flushed segment by DelSegmenting it (print #handle, "delsegment segmentName"), and then ReDraw the graphics (print #handle, "redraw").
Note that you can also use the Segment ID by utilizing the appropriate commands.
Check out the Graphics Commands section of the Helpfile; it is extremely useful.
Windows 7 Home Premium 64-bit Intel(R) Quad Core(TM) i5 CPU M 430 @ 2.27GHz 4GB DDR3 RAM
Thanks Brandon. I will work on a solution using the instructions you have laid out. I have looked at the graphics section before in that area. I havent produced anything in LB for years, but I do use the tools in the editor (like icon creator and the editor). I wanted a more professional view on my subject posted before I would commit again to a project. I am very rusty in LB. Regards, Michael
Thanks Brandon, I have found a sample of what the program does.. (it was BMPtoCode, but the original version has gone missing) This program IS made in Liberty Basic using BMPtoCODE It served many purposes at the time. Image to code compression so you could share images you made in forums and compress them for use as icon tools within your programs.
My objective is to make a Liberty Basic version that allows image creation in a paint shop atmosphere, compression and code generation like the program I am posting. (without using any APIs) * thats just my objective
(it will be the same BUT the new program will have the image editor and ALL tools needed for magnification and editing built in) Copy and paste this into Liberty Basic and run... (its soooooo cooool) nomainwin open "Compressed BMP Data to Image project " for graphics_nsb_fs as #1 u=0 #1 "trapclose [quit]" ost$="" read x,y #1 "down;fill black" while nst$<>"100000" read nst$,t if nst$="0" then r=0:g=0:b=0 'black 0 0 0 if nst$="1" then r=192:g=128:b=64 ' brown 192 128 64 if nst$="2" then r=64:g=64:b=192 'dark blue 64 64 192 if nst$="3" then r=128:g=128:b=128' dark grey 128 128 128 if nst$="4" then r=128:g=0:b=0'dark red 128 0 0 if nst$="5" then r=224:g=192:b=0 'dark yellow 224 192 0 if nst$="6" then r=128:g=160:b=192'flat blue 128 160 192 if nst$="7" then r=32:g=192:b=64 'green 32 192 64 if nst$="8" then r=166:g=202:b=240'light blue 166 202 240 if nst$="9" then r=192:g=192:b=192 'light gray 192 192 192 if nst$="a" then r=192:g=224:b=0 'light green 192 224 0 if nst$="b" then r=224:g=32:b=64'light red 224 32 64 if nst$="c" then r=0:g=160:b=192 'medblue 0 160 192 if nst$="d" then r=224:g=128:b=64 'orange 224 128 64 if nst$="e" then r=224:g=160:b=192'pink 224 160 192 if nst$="f" then r=160:g=64:b=192'purple 160 64 192 if nst$="g" then r=192:g=220:b=192'tan 192 220 192 if nst$="h" then r=255:g=255:b=255'white 255 255 255 if nst$="i" then r=255:g=255:b=0'yellow 255 255 0 #1 "color ";r;" ";g;" ";b for u=0 to t a=a+1: print #1, "set ";c;" ";a :if a>x then c=c+1:a=0 next u wend wait [quit] close #1 end DATA 51,51 DATA 0,303,4,2,0,45,4,6,0,42,4,8,0,39,4,11,0,37,4,13,0,34,4,16,0,32,4,12,b,0,4,4,0,29,4,13,5,1,b,0,4 DATA 4,0,27,4,12,5,4,b,0,4,4,0,24,4,13,5,6,b,0,4,4,0,21,4,13,5,9,b,0,4,4,0,19,4,13,5,11,b,0,4,4 DATA 0,16,4,13,5,14,b,0,4,4,0,14,4,13,5,16,b,0,4,4,0,11,4,13,5,19,b,0,4,4,0,9,4,12,5,22,b,0,4,4,0 DATA 6,4,13,5,18,4,2,5,2,b,0,4,4,0,4,4,12,5,20,4,4,5,1,b,0,4,4,0,3,4,11,5,4,4,15,5,1,4,4,5,1 DATA b,0,4,4,0,3,4,8,5,6,4,17,5,0,4,4,5,1,b,0,4,4,0,3,4,6,5,8,4,17,5,0,4,4,5,1,b,0,4,4,0 DATA 3,4,6,b,1,5,6,4,17,5,0,4,4,5,1,b,0,4,4,0,3,4,8,b,2,5,4,4,15,5,1,4,4,5,1,b,0,4,4,0,3 DATA 4,11,b,1,5,20,4,4,5,1,b,0,4,4,0,3,4,13,b,2,5,18,4,2,5,2,b,0,4,4,0,6,4,13,b,1,5,22,b,0,4 DATA 4,0,9,4,12,b,2,5,19,b,0,4,4,0,11,4,13,b,1,5,17,b,0,4,4,0,14,4,12,b,1,5,15,b,0,4,4,0,16,4,13 DATA b,1,5,12,b,0,4,4,0,19,4,12,b,1,5,10,b,0,4,4,0,21,4,13,b,1,5,7,b,0,4,4,0,24,4,13,b,0,5,5,b DATA 0,4,4,0,26,4,13,b,1,5,2,b,0,4,4,0,29,4,13,b,0,5,0,b,0,4,4,0,31,4,13,b,0,4,4,0,34,4,16,0,37 DATA 4,13,0,39,4,11,0,42,4,8,0,44,4,6,0,47,4,2,100000,0
Last Edit: Nov 17, 2019 19:08:31 GMT -5 by michael