Complete
over 2 years ago

WERETECH-12048

Fix will be applied to next SDK release.

Devices affected will have firmware updates in a future firmware build.

No more transparency for font background on bufferd bitmap since SDK 4.0

Hi, 

I use a bufferedBitmap with color palette and custom bitmap fonts without antialiasing.

Since SDK 4.0 the font background  is not more transparent. The color is defined before:

dc.setColor(CustomColor, gfx.COLOR_TRANSPARENT);
   

The code is running many years without problem.

I don't understand, what's going wrong with new SDK

Parents
  • How are you creating the BufferedBitmap?

    With ConnectIQ 4.0 we added Graphics.createBufferedBitmap() which allows applications some control over the amount of memory needed for the given bitmap. We then shared this code with the old BufferedBitmap constructor.

    If you are using code that only runs on devices that don't have 4.0 SDK support, then it sounds like we have a bug in that we don't create a render target with enough alpha bits to properly draw text. If you are using createBufferedBitmap and testing on devices with 4.0 SDK support, it sounds like you might need to see about supplying the :alphaBlending option in the options dict.

Comment
  • How are you creating the BufferedBitmap?

    With ConnectIQ 4.0 we added Graphics.createBufferedBitmap() which allows applications some control over the amount of memory needed for the given bitmap. We then shared this code with the old BufferedBitmap constructor.

    If you are using code that only runs on devices that don't have 4.0 SDK support, then it sounds like we have a bug in that we don't create a render target with enough alpha bits to properly draw text. If you are using createBufferedBitmap and testing on devices with 4.0 SDK support, it sounds like you might need to see about supplying the :alphaBlending option in the options dict.

Children
  • Hello Travis, I am setting :alphaBlending to ALPHA_BLENDING_FULL on my 4-bit bitmap, and the described behavior (drawing text on transparent background 'eats up' whatever was in the bitmap before the draw call).

    Do you have a sample code that would draw a text to the bitmap without deleting what is already there? Can such thing be accomplished in SDK 4 (eg. on Fenix 7)?

  • More than three months have passed. Ticket has been created, but the problem has not been solved!!!

    I am asked by the user of my developments. I'll redirect their wrath to Garmin.

    Ugliness!!!

  • To reproduce this sample is a little bit complex. But I have another sample, it is simple

    The digital time with this look is created with a dseg7 font, which is printed in white and then with offset 1px in black.

    This is only working with a transparent font background. For the always on second hand is a buffered bitmap created with palette.

                if (offscreenBuffer == null) {
                	offscreenBuffer = new Gfx.BufferedBitmap({
                    :width=> VA_Width-12,
                    :height=>VA_Height-12,
                    :palette=> [ProfileColors[0], ProfileColors[1], ProfileColors[2], ProfileColors[3], 
                    			ProfileColors[8], ProfileColors[7], ProfileColors[9], Gfx.COLOR_GREEN,
                    			CustomColorHands, CustomColorHandsShadow, DigColor, DigColorShadow]
               	 	});
    
                	targetDc = offscreenBuffer.getDc();
                	
                }

    The colors are defined with different color profiles

    And this print the digitaltime string:

     

            if (DigitalTimeType == 3 && !ClassicHands && HideElements == 0) {  // some conditions to draw shadow 
            	dc.setColor(DigColorShadow, Gfx.COLOR_TRANSPARENT);
            	dc.drawText(X-1, Y-1, fontDseg7, timeString, Gfx.TEXT_JUSTIFY_CENTER);
            }
            dc.setColor(HideElements > 1? ProfileColors[1] : DigColor, Gfx.COLOR_TRANSPARENT);
            dc.drawText(X , Y, fontDseg7, timeString, Gfx.TEXT_JUSTIFY_CENTER);

    Have you a question, please give me a hint

    best regards

  • Hi, would you be able to share an example of the problem code? I can understand you may not want to share your entire project, but a code snippet involving the creation of the bufferedbitmap would be very helpful. 

  • I have one watch face online, which is based on a transparent font background. It is AnalogSwitch Sports. With SDK 3.2 it shows normaly on a VA3 or fenix5/6:

    to safe energy the static elements are only write on watch face start or change settings to a buffered bitmap with palette of some colors. The right half circle is based not on a complete bitmap, then I can't change the color with settings, it is based on a custom font with all tiles of this half circle. So I can draw the buffered bitmap every minute and don't create the picture from tiles every minute.

    This is working since many years.

    With SDK 4.x it shows now:

    All tiles have loose the transparent background. I can't update the watchface anymore to support more new devices.

    thanks 2aCD