You can use Gimp or Photoshop. Scan in the pencil drawing and darken it using Curves (in Gimp - idk about Photoshop). Then use Color to Alpha to make the white region become transparent. Invert the color, so everything is white. Select all and cut. Then create a black mask. Paste onto the mask. Now you can color a gradient anywhere on the layer and it will be filtered out by the mask in the shape of the drawing. Of course, you may want to do some cleaning of the image before you get started.