setClip() to refresh text on partial update without requiring a background color

When drawing text at 1 Hz through onPartialUpdate(), it seems like a background color must be set for the text to be cleared & redrawn on the next function call. I am using Jim's example here as a reference. However, if I have a "background bitmap" on my watchface (i.e., an image being the first thing that's drawn on the watch face before any other bitmaps/text), this creates a ugly black (or whatever chosen color) background on the setClip region. Is there a way to use a transparent background for the setClip region without running into the issue of the text constantly drawing over itself?

Right now, I set a clip region, and instead of drawing a background color, I load a bitmap that only contains the "cropped" region of the background bitmap. Something like this:

    function doTime(dc, time)
    {
   		dc.setClip(157, 104, 22, 22); // set the clip region
  		//dc.setColor(0x000000, 0x000000);
  		//dc.clear(); 
  		//dc.setColor(0xFFFFFF, 0x000000);	
  		
  		var bit;// = null;
  		bit = Ui.loadResource(Rez.Drawables.bit); // bit is the background image only containing pixels starting at (157, 104), and is 22 pixels long each direction
  		dc.drawBitmap(157, 104, bit);
  		
  		dc.drawText(157, 100, 0, time, 2);  // draw text 	
    }

This method is pretty memory intensive, and my app is already pretty tight on memory (as evidenced by the fact I'm using a bitmap for the background on the watch face in the first place) so I'm wondering if there is another workaround. Maybe alpha channels in the new API version could work, but the API version required for that is unfortunately not yet supported by my FR 645M.

Any ideas?

  • You could use a buffered bitmap, maybe try the actual bitmap after the setClip, then draw the text over it.  But one thing I saw is if doTime() is used by onPartialUpdate, you don't want to do the loadResource there, as that's filesystem access, and will result in onPowerBudgetExceeded().

    No file system access in onPartialUpdate starting in CIQ 3.2 if I recall.