How to roate dc.drawText at 45 degrees

Is it possible to rotate dc.drawText at 45 degrees?

the date of my watch is at 45 degress and my numbers are 90. is it possible to rotate the numbers?

if tried to rotate the font but when its double digits the are not aligned.

  • But that shouldn't impact the background process unless you try to load it there.

  • To get it to display correctly, you had to draw each digit but itself, with a different x and y, correct?

  • got it working. but yes i dont know why i use so much mem. i could give you the source code so you can se why it uses so munch mem

  • What does your drawables.xml look like?

    What do you do in your background?

  • im displaying heartrate, steps, battery and floors climed in onupdate.

    drawables is like this

    <drawables>
    <bitmap id="LauncherIcon" filename="launcher_icon.png" />
    <bitmap id="Background" filename="backgroundNy.png">
    <palette disableTransparency="true">
    <color>000000</color>
    <color>FFFFFF</color>
    <color>AAAAAA</color>
    <color>2f2f2f</color>
    </palette>
    </bitmap>
    </drawables>

    the png file is 44.2kb

  • This shouldn't impact the size of your background process.

  • hmm og heres my onupdate and initialize

    function initialize() {
    WatchFace.initialize();
    middleX = 120;//$.gDeviceSettings.screenWidth/2;
    middleY = 120;//$.gDeviceSettings.screenHeight/2;
    deviceStyle = $.gDeviceSettings.screenShape;
    retrieveSettings(); // retrieve the user's settings for this watch face
    font1 = Ui.loadResource(verdana50);
    font2 = Ui.loadResource(sawade20);
    fsyms = Ui.loadResource(typicons22);
    }

    function onUpdate(dc) {
    // if the settings are flagged as having changed (which is set in the AppBase object),
    // then retrieve the settings again
    if ($.gSettingsChanged) {
    $.gSettingsChanged = false;
    retrieveSettings();
    }

    // handle allocation or deallocation of the off-screen buffers, as required, based on any changes
    // to settings and/or time issues rendering
    if (Toybox.Graphics has :BufferedBitmap) {
    if (cDisplaySecondHand == 2 && $.gPartialUpdatesAllowed && dcOffscreenBuffer == null) {
    // if configured for always on, and it's allowed and the buffer is null then the
    // user may have switched so allocate the required buffers
    allocateOffscreenBuffer(dc);
    } else if (cDisplaySecondHand < 2 || !$.gPartialUpdatesAllowed) {
    // clear any DC clipping and deallocate the off-screen buffers if they are not
    // (or are no longer) needed
    dc.clearClip();
    deallocateOffscreenBuffer();
    }
    }

    // get local time
    var timeNow = Time.now();
    var localTimeInfo = Time.Gregorian.info(timeNow, Time.FORMAT_MEDIUM);
    clockTime = localTimeInfo;

    // set the day of week and day of month strings
    var dayOfMonthStr = localTimeInfo.day.format("%2d");

    // set the targetDc object to use for rendering; if doing the always on second hand then
    // we want to ensure that we update the offscreen buffer, since we have an updated minute
    // hand (and potentially the hour hand also)
    var targetDc;
    if (dcOffscreenBuffer != null && $.gPartialUpdatesAllowed) {
    dc.clearClip();
    dcCurClip = null;
    targetDc = dcOffscreenBuffer.getDc();
    } else {
    targetDc = dc;
    }

    // clear the screen
    targetDc.setColor( Gfx.COLOR_TRANSPARENT, Gfx.COLOR_BLACK );
    targetDc.clear();

    // draw the background
    targetDc.drawBitmap(0,0,resBackground);


    // draw the date bar with day of week/month

    GetBattery(targetDc);
    GetHeartRate(targetDc);
    GetSteps(targetDc);
    GetFloors(targetDc);
    GetSymbols(targetDc);
    ShowDates(targetDc, dayOfMonthStr);

    // draw the background and hands
    drawBackground(dc);

    drawHands(dc, 120, 120, clockTime);

    if (updateSeconds || ($.gPartialUpdatesAllowed && dcOffscreenBuffer != null)) {
    // draw the second hand, if configured
    //drawAnalog(dc);
    //drawSecondHand(dc, 120, 120, clockTime);
    DrawSec(dc);
    drawHandCenter(dc, 120, 120, true);
    } else {
    // otherwise, just draw the center rings
    drawHandCenter(dc, 120, 120, false);
    }
    }

  • So you don't have a background service.  Where are you seeing you're out of memory for "background"?

  • from the eclipse program

    Error: Out Of Memory Error
    Details: Failed loading application.

    and sometimes when i try to use polygons it says 

    BUILD: ERROR: PRG generated exceeds the memory limit of 'background' applications for device id 'marqadventurer': 40292 bytes.

  • Are you using the (:background) annotation in your code?

    What are you seeing for memory in view memory in the sim?

    Do you have the background permission set when you don't need it?