Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:38 29 Mar 2024 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 : Question on Drawing over an Image

Author Message
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 379
Posted: 10:02pm 08 Apr 2021
Copy link to clipboard 
Print this post

I have some puzzling behavior going on in a program I am writing, and I am hoping somebody can help.

If I do this simple thing:

Mode 1,12
Load PNG "blah.png"
line 0, 0, 799, 599,, RGB(RED)

everything works as I expect; that is, the image is shown and then the red line is drawn on top of the image. (I am using 12-bit color because I will eventually want to draw translucent stuff on top of the image.)

However, if I do this instead:

Mode 1,12
page write 1
load PNG "blah.png"
page write 0
page copy 1 to 0, B
line 0, 0, 799, 599,, RGB(RED)

The line does NOT appear on top of the image! (My actual code is more complicated but this is the essence.)

There must be something magic about the page copy but I can't imagine what it is.

-Bill
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 10:06pm 08 Apr 2021
Copy link to clipboard 
Print this post

The line is on top of the image on page 0. However, page 1 is on top of page 0.
Edited 2021-04-09 08:06 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5867
Posted: 10:47pm 08 Apr 2021
Copy link to clipboard 
Print this post

From my help pages (which came from Peter):
  Quote  The display always shows the contents of page 0 (16-bit and 8-bit) and pages 0 and 1 (12-bit). Use PAGE WRITE and PAGE COPY to avoid flashing and tearing artefacts.
For 12-bit colour depth page 0 is the lower level and page 1 the upper so the stack is: background, page 0, page 1 with each one overwriting the previous in turn as defined by the transparency values of each individual pixel.


Mode 1,12
page write 0
load PNG "blah.png"
page write 1
line 0, 0, 799, 599,, RGB(RED)
do:loop until inkey$ <> ""


Jim
VK7JH
MMedit   MMBasic Help
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 379
Posted: 11:28pm 08 Apr 2021
Copy link to clipboard 
Print this post

Thanks! I always thought pages 1 and 2 were totally offscreen. That explains a lot!

-Bill
 
William Leue
Guru

Joined: 03/07/2020
Location: United States
Posts: 379
Posted: 12:50am 09 Apr 2021
Copy link to clipboard 
Print this post

It works great, once I changed which page was which. Thanks much, vegipete and TassyJim, you guys certainly deserve your Guru labels!

-Bill
 
Print this page


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

© JAQ Software 2024