1

is there a way to draw on the screen using my finger

i'm creating a Blackberry-10 application like draw something as a school assignment

SocoM
  • 332
  • 4
  • 19

2 Answers2

3

If you have Qt Quick 2.0 available, you can make use the Canvas object in QML. The following sample shows how to draw a red line whenever there is a onPressed / onPositionChanged event:

import QtQuick 2.0
Rectangle {
    property int startX;
    property int startY;
    property int finishX;
    property int finishY;
    Canvas {
        anchors.fill: parent
        onPaint: {
          var ctx = getContext("2d");   
          ctx.fillStyle = "black";
          ctx.fillRect(0, 0, width, height);
          ctx.strokeStyle = "red";
          ctx.lineWidth = 1;
          ctx.beginPath();
          ctx.moveTo(startX, startY);
          ctx.lineTo(finishX, finishY);
          ctx.stroke();
          ctx.closePath();
        }
        MouseArea {
            anchors.fill: parent
            onPressed: {
                startX = mouseX;
                startY = mouseY;
            }
            onPositionChanged: {
                finishX = mouseX;
                finishY = mouseY;
                parent.requestPaint();
            }
        }
    }
}
Stephen Quan
  • 21,481
  • 4
  • 88
  • 75
0

Sorry but you are planning to use what a BB10 because I didn't understood the question.

Try this solution from the SDK documentation.

gsmida
  • 357
  • 1
  • 5
  • 15