To reiterate: "in BBC BASIC for SDL 2.0 (all editions) *DISPLAY can display BMP, JPG, GIF and PNG images".
Thanks Richard. I did see that earlier. And it is noted for future use on the pi3 and on my MAC.
My old MacBook Pro, does need a task like this and it can display Investing.com and uses an older version of BBCSDL.
If say, I could put a transparent window overtop of the screen and then use the TINT or POINT to extract the colors, that could make
short work of the need for DLLs. I have found the program I had that used the system calls for the color extraction but it
needs convert to BBC BASIC
(I am having problems posting text for some reason. some of my text in this region was omitted after submitting)
(I nearly have the whole thing extracted from BMPtoCode and if I could understand how it is done differently in BBC Basic, I can put LB to rest and also, if I can understand more about DLLs in BBC Basic I could finally after many years understand a bigger dimension.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(this program is in the process of being modified to use the mouse location to locate the color location and to help me identify the colors that exist
at the part of the screen I need to extract. the number length would be like around this big: 10.98 maximum size and the decimal is crucial.)
This subject would not be appropriate for LBB or LB or BBC Basic as this is a LB program and I want to convert to BBC BASIC, but I want to understand the differences.
I dont want a finished program provided. (so thats not what I am asking for.)
Here is where I have been looking, but there is more than what is here:
http://www.bbcbasic.co.uk/wiki/doku.php ... put-output
* UPDATE: I think I have found the information in: Introduction to the Windows API
Here is what I found:
Functions in other DLLs must be explicitly loaded into memory, and must be called by address rather than by name. For example to call the function OleUIChangeIconA which is in OLEDLG.DLL you must perform the following steps:
SYS "LoadLibrary", "OLEDLG.DLL" TO oledlg%
SYS "GetProcAddress", oledlg%, "OleUIChangeIconA" TO chicon%
SYS chicon%, ci% TO uint%
Once you have finished with them, it is important to 'release' any DLLs which you have loaded:
SYS "FreeLibrary", oledlg%
To ensure that the DLLs are released however your program exits, include code similar to the following in a 'cleanup' routine called from your ON CLOSE and ON ERROR handlers:
oledlg% += 0 : IF oledlg% THEN SYS "FreeLibrary", oledlg%
I have an idea of how some of the information would be passed to the above example pieces. But what about the long statements?
I know that i and j would be screen locations and pColor is the color that is extracted, but is this layout used in any way to represent the same
extraction method? Is there something missing in the above example?
Code: Select all
' NOTE : this program will not run as it is.
open "user32" for dll as #user
Open "gdi32"for DLL as #gdi
CallDll #user, "GetDC",_
hWnd as long,_
hDC as long
CallDll #gdi, "GetPixel",_
hDC as long,_
i as long,_
j as long,_
pColor as long
call getRGB pColor,r,g,b
nst$=""
if r=0 and g=0 and b=0 then nst$="0" 'black
if r=192 and g=128 and b=64 then nst$="1" ' brown
if r=64 and g=64 and b=192 then nst$="2" 'dark blue
if r=128 and g=128 and b=128 then nst$="3" ' dark grey
if r=128 and g=0 and b=0 then nst$="4" 'dark red
if r=224 and g=192 and b=0 then nst$="5" 'dark yellow
if r=128 and g=160 and b=192 then nst$="6" 'flat blue
if r=32 and g=192 and b=64 then nst$="7" 'green
if r=166 and g=202 and b=240 then nst$="8" 'light blue
if r=192 and g=192 and b=192 then nst$="9" 'light gray
if r=192 and g=224 and b=0 then nst$="a" 'light green
if r=224 and g=32 and b=64 then nst$="b" 'light red
if r=0 and g=160 and b=192 then nst$="c" 'medblue
if r=224 and g=128 and b=64 then nst$="d" 'orange
if r=224 and g=160 and b=192 then nst$="e" 'pink
if r=160 and g=64 and b=192 then nst$="f" 'purple
if r=192 and g=220 and b=192 then nst$="g" 'tan
if r=255 and g=255 and b=255 then nst$="h" 'white
if r=255 and g=255 and b=0 then nst$="i" 'yellow
if nst$="" then nst$="0" 'prevent misses
print #1, nst$
#1 "vertscrollbar on 0 "; DisplayHeight
#1 "horizscrollbar on 0 "; DisplayWidth
#1 "down"
#1 "size 2"
#1 "when leftButtonMove [draw]"
wait
[draw]
#draw, "set "; MouseX; " "; MouseY
wait
#1 "when rightButtonMove [quit
CallDll #user, "ReleaseDC",_
hWnd as long,_
hDC as long,_
r as long
close #user
close #gdi
cursor normal
end
sub getRGB pixcol, byref r, byref g, byref b
b = int(pixcol / (256*256)) '*
g = int((pixcol - b *256*256) / 256) '*
r = int(pixcol - b*256*256 - g*256) '*
end sub
[quit]
close #1
end
Focus is on code subject. Feel free to judge the quality of my work.