Post by tenochtitlanuk on Dec 25, 2020 11:41:11 GMT
Lots of good advice here! Marry Season Greetings all!!
Here's a version I've used. Can't find the polished/finished version where I made it read all the details from the bmp file- some are hard-coded into the code below.
Here's a version I've used. Can't find the polished/finished version where I made it read all the details from the bmp file- some are hard-coded into the code below.
This image shows it is easy to copy part of a BMP where you've written some horizontal text, then swap the rows/columns to rotate it to vertical and draw it where you wish..
Good to see you posting Andy- I've learned a lot from you..
' Make Width and Height be read rather than stated and swap them in the preamble
' Make into a more generalised sub or proc
nomainwin
WindowWidth =450
WindowHeight =490
open "Display" for graphics_nsb as #wg
'
#wg "trapclose quit"
#wg "down ; fill 192 192 64"
#wg "up ; goto 10 40 ; backcolor 192 192 64 ; color black"
#wg "down ; font Times_New_Roman bold 14"
#wg "\" +" Liberty & JB Rule! Let's conquer the World! "
#wg "flush ; getbmp scr 10 22 412 21"
bmpsave "scr", "source.bmp"
Width =412 ' Make x a multiple of four...
Height = 21
dim Pix$( Width, Height) ' set up local pixel arrays Pix$( x, y) holding 'RGB' as 3 bytes)
fn$ ="source.bmp"
open fn$ for binary as #fIn
pre$ =input$( #fIn, 66) ' x42 ie 66 byte preamble
pixel$ =input$( #fIn, 4 *Width *Height)
seek #fIn, 66
for y =0 to Height -1
for x =0 to Width -1
Pix$( x, y) =input$( #fIn, 4) ' x20 =32 ie 4-bytes per pixel
next x
next y
'tail$ =input$( #fIn, 1648)
newPre$ =left$( pre$, 18) +fourByte$( Height) +fourByte$( Width) +mid$( pre$, 27, 51)
close #fIn
open "rotated.bmp" for binary as #fOut
#fOut, newPre$;
for x =0 to Width '-1
for y =Height -1 to 0 step -1
#fOut, Pix$( x, y);
scan
next y
next x
'#fOut tail$;
close #fOut
'timer 500, [o]: wait
'[o] timer 0
loadbmp "scr", "rotated.bmp"
#wg "drawbmp scr 10 40"
wait
function fourByte$( i)
b1 = i mod 2^8
b1$ =chr$( b1)
i =( i -b1) /2^8
if i <0 then i =0
b2 = i mod 2^8
b2$ =chr$( b2)
i =( i -b2) /2^8
if i<0 then i =0
b3 = i mod 2^8
b3$ =chr$( b3)
i =( i -b3) /2^8
if i<0 then i =0
b4 = i mod 2^8
b4$ =chr$( b4)
fourByte$ = b1$ +b2$ +b3$ +b4$
end function
sub quit h$
close #wg
end
end sub