Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:14 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : off screen graphics

Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 10:25pm 05 Sep 2022
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2170
Posted: 06:29am 06 Sep 2022
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 4044
Posted: 06:48am 06 Sep 2022
Copy link to clipboard 
Print this post

  stanleyella said  What happens when graphics go off screen.

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 Kingdom
Posts: 2566
Posted: 04:27pm 06 Sep 2022
Copy link to clipboard 
Print this post

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: Canada
Posts: 1132
Posted: 07:56pm 06 Sep 2022
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2566
Posted: 10:30pm 06 Sep 2022
Copy link to clipboard 
Print this post

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.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025