hellomike wrote: ↑
Mon 08 Jun 2020, 14:08
From the help I (wrongly) understood that I get
3 pixels wide and 3 pixels high because it (windows) doesn't paint row #0 and column #3.
RECTANGLE FILL 0,0,8,8 should
produce a 5 x 5 square (inclusive coordinates) and will
on versions of BBC BASIC that work 'properly'. As you say, Windows doesn't paint the bottom row and the right column, so in BB4W you end up with a 4 x 4 square instead.
Studying the BMP I now indeed see that I do get 4x4 pixels but it starts at row #1 and not row #0.
*GSAVE isn't affected by the Windows 'anomaly' (it's got nothing to do with drawing) and should always create a BMP with the position and dimensions you specify in the command, in both BB4W and BBCSDL.
Running the same program WITHOUT the FILL (I still want a rectangle 4 pixels wide and 4 pixels high) now, row#0 is included and column#4 as well! I get a rectangle 5x5 pixels!
I hope that doesn't surprise you, it shouldn't. Without the FILL it's simply a statement which draws four straight lines, so of course it's now 'inclusive' of the edges. It's best if you think not in terms of the 'shorthand' statements like RECTANGLE but rather the lower-level graphics commands that they generate:
Code: Select all
RECTANGLE FILL x,y,w,h equivalent to MOVE x,y : PLOT 97,w,h
RECTANGLE x,y,w,h equivalent to MOVE x,y : PLOT 9,w,0 : PLOT 9,0,h : PLOT 9,-w,0 : PLOT 9,0,-h
By the way, I'm dealing with several hundred K's of BB4W source. For the moment fully switching to BBC BASIC for SDL 2.0 is not an option.
Fair enough, but if 'pixel perfect' results are important to you (and that's relatively unusual given how small pixels are on modern displays, compared with the BBC Micro etc.) you will need to make adjustments to compensate for BB4W being 'different'. It might be a good idea to include REMs to remind you about these adjustments in case you ever want to port it to BBCSDL or Brandy.
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.