dc.drawBitmap2

I've been trying to figure out how to use the optional parameters in this function. I use it witout worries tintcolor, but I couldn't use bitmapX bitmapY to try to select part of the image to draw.

Can anyone show me a working call to this function using these parameters? Documentation is extremely brief at this point.

Thanks in advance

  • posting your code might help

  • It's no about my code. Everything I try produces a runtime error, except with 0s on bitmapX and bitmapY.

    Documentation isn't really helping, but I guess I can have a big image and draw it starting in different positions using these parameters, but I don't really know how it works.

    Can you explain the meaning and use of these?

  • I just did a test for drawBitmap2

    Resources Drawables

    <bitmap id="heart30" automaticPalette="false" filename="Herz30t.png" scaleX="30" scaleY="26" />

    View.mc  Initialize

    myHeart30 = WatchUi.loadResource(Rez.Drawables.heart30);

    View onUpdate

            // draw full heart:
            dc.drawBitmap(200, 30, myHeart30);
    
            if ( Graphics.Dc has :drawBitmap2 ) {       // works only for "modern" devices
                // draw part of heart:    
                dc.drawBitmap2(200, 70, myHeart30, {
                    :bitmapX => 7,
                    :bitmapY => 2,
                    :bitmapWidth => 15,
                    :bitmapHeight => 23,
                } );
            }    
            
    

    That works fine in simulator for Edge 1040.

    Download Heart Bitmap

  • Ok. Will try to mimic your example.

    I'm not using scaleX, scaleY on my bitmap declaration. It doesn't make sense, but in programming every detail can make a difference!

    Thanks. Will comment if it works

  • I'm not using scaleX, scaleY on my bitmap declaration. It doesn't make sense

    ...for you... Wink

    Works also without scaling!

    (My example is part of a datafield where I adapted the size of heart to fit better into the layout)