Acknowledged
CIQQA-3178

Dc.clear with COLOR_TRANSPARENT does not work as documented

The documentation states that Dc.clear does the following:

Erase the screen using the background color.
Note: 

Starting form version 3.1.0, COLOR_TRANSPARENT will also be honored as background color, which will cause the value of pixels in the clip region to be replaced by COLOR_TRANSPARENT. For example, this can be used to clear the transparent overlay layer so animation background is visible.

However, for COLOR_TRANSPARENT, this works only once in an onUpdate. A second call to Dc.clear with COLOR_TRANSPARENT as background color will not replace the pixels drawn in the same onUpdate. For other colors like COLOR_BLACK, this does work.

  • Yes, you are right, I thought about it the wrong way.

    I tested it, and it seems the Dc gets cleared before every onUpdate. And the background is transparent by default. Both foreground and background colors default to black, so if drawing something and you'd like the background to stay transparent, you need to set the background.

    I now also tried setting a clip (before drawing anything). but it does not make a difference, Dc.clear still does not clear when background is set to transparent.

  • 1.In the text is simple, it  has the background (e,g. black) and pixels for chars so transparent means don't draw any pixel from char that is black in font. 

    Which pixels should be avoided when clear() is called? This one defined for foreground?

    2. Maybe the keyword is the clip() 

    which will cause the value of pixels in the clip region to be replaced by COLOR_TRANSPARENT

  • In the related doc bug report I linked to, I wrote:

    I am unable to test this exhaustively with my real fr955 device as:

    - for a data field, both the sim and the real fr955 apparently clear the dc before calling onUpdate()

    - for a device app, the real fr955 clears the dc before calling onUpdate(), while the sim does not

    (When I said device app, I meant the main app and not the glance view).

    What you could be seeing is that the glance view is automatically clearing the dc before calling onUpdate, as flocsy said. I would also agree with flocsy here: "I think to test your theory that the 1st clear works in the way you think you must draw something before the 1st clear.

  • I don't agree with your conclusions. I think to test your theory that the 1st clear works in the way you think you must draw something before the 1st clear.

    I think you will be surprised. My guess is that it works just like the 2nd call. I think that the 1st clear doesn't need to clear the output of the previous call of onUpdate because the system does give you a clear DC. This might not be the case for all devices though.