 
     @piece = puzzle_piece
     @puzzle = @piece.puzzle
-#    @img = @puzzle.puzzle_view.piece_mask
-    @img = document.createElement('canvas')
-    @img.id = "piece-mask"
+    @img = @piece.p_mask.img
+#    @img = document.createElement('canvas')
+#    @img.id = "piece-mask"
     @img.width = @piece.box.width
     @img.height = @piece.box.height
-    @piece_image_context = @img.getContext("2d")
+    @piece_image_context = @img.getContext('2d')
+
+
 
 
 # FIXME Nothing references this method yet.

    @hexes = @get_hexes()
    @box.set_box_dimensions()
    @p_mask.draw_pattern()


  get_hexes: () ->

    alert("get_drawing_context:  mode = "+mode)
    switch mode
      when "canvas" then context = @context_canvas
      when "piece_mask"
        alert("Using gdc with 'piece_mask'")
        if @puzzle.piece
          context = @puzzle.piece.p_mask.img.getContext('2d')
        else
          alert("@puzzle.piece == null")
    return context


