![]() |
Forum Index : Microcontroller and PC projects : off screen graphics
Author | Message | ||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2566 |
What happens when graphics go off screen. Here is a box and circle demo on lcd ili9341, different on ssd1306. no error message like out of range. I am going to test blit next. Some of this could be useful. Notice the minus display coordinates. https://www.youtube.com/watch?v=rg7KXsOmG4g 'off screen graphics OPTION EXPLICIT dim c% cls rgb(black) do for c%= 50 to -60 step-5 cls box c%,50,50,50,1,rgb(white) pause 50 next for c%= -60 to 330 step 5 cls box c%,50,50,50,1,rgb(white) pause 50 next for c%= 330 to 50 step-5 cls box c%,50,50,50,1,rgb(white) pause 50 next '--------------------- for c%= 50 to -60 step-5 cls box 50,c%,50,50,1,rgb(white) pause 50 next for c%= -60 to 250 step 5 cls box 50,c%,50,50,1,rgb(white) pause 50 next for c%= 250 to 50 step-5 cls box 50,c%,50,50,1,rgb(white) pause 50 next for c%= 100 to -70 step-5 cls circle c%,100,25 pause 50 next for c%= -70 to 350 step 5 cls circle c%,100,25 pause 50 next for c%= 350 to 100 step-5 cls circle c%,100,25 pause 50 next '--------------------- for c%= 100 to -80 step-5 cls circle 100,c%,25 pause 50 next for c%= -80 to 270 step 5 cls circle 100,c%,25 pause 50 next for c%= 270 to 100 step-5 cls circle 100,c%,25 pause 50 next loop |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
if memory serves (and I think your vid shows this) co-ordinates are normalised to the viewport (in this case the whole screen). In your vid you can clearly see that co-ords out of bounds are being normalised to the lowest or highest allowed - hence the "squishing" appearance. For devices that drive VGA I think there are options to hide stuff off screen and then have it bleed in. Sprites and maybe blit. You have to have the screen memory-mapped to do this because the mite has to remember what was there because there is no way to do it in the screen hardware itself (it's memory most likely covers just what you can see) lots of guessing Edited 2022-09-06 16:31 by CaptainBoing |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
You'd be wise to consider it what many languages call "undefined behaviour". That is, anything may happen and in addition it may change in future releases of the software. So, the wise thing to do is not to write code which transgresses the defined behaviour. If you do write code which goes into the undefined territory then don't complain if a future software version changes what happens. Also, don't expect the same behaviour with other displays or other 'mite variants. They may or may not behave the same, again "undefined behaviour". John Edited 2022-09-06 16:51 by JohnS |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2566 |
Circle off screen no "Squishing" as box does. A users analogue clock I tried using line and trig. using portrait lcd mode was partially off screen but worked fine. I agree that abiding with the rules is best to avoid problems. |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
This is a feature of MMBasic. Angled lines that are partially off the screen show the effect too. I 'observed' this in the PicoMite Betas thread. The quick-and-dirty solution I found was to draw a black box outline around the screen, erasing everything at the very edge of the screen. Looses 2 pixels of screen resolution in each direction, but less work than trying to find screen edge intersections. Visit Vegipete's *Mite Library for cool programs. |
||||
stanleyella![]() Guru ![]() Joined: 25/06/2022 Location: United KingdomPosts: 2566 |
I had thoughts of an image that fills the screen and 8 pixels off screen right side. Use blit read to save the screen and the drawn off screen. blit write the buffer pixels left, use blit read to read the screen and off screen. draw new graphics off screen and repeat. It was an idea for scrolling right to left, me not explaining well. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |