     hexes
 
 
-#  FIXME (Used by the deprecated redraw method)
-#  get_dim: () ->
-#    dim = [63,87] # (temporarily hard code these values)
-#    dim
-
-#  get_piece_xy_offset: () ->
-#    dx = -14 # (temporarily hard code these values)
-#    dy = 0
-#    dxy = [dx,dy]
-#    dxy
-
-
 
 class PiecePattern
 

    @piece_mask_context = @img.getContext('2d')


  draw_piece_pattern: () -> # TODO Fix this and the HexBox refactor is complete.
    @img.width = @hex_box.width
    @img.height = @hex_box.height
    @hexes = @piece.hexes
    @hex_draw.set_context("piece_mask")





    xx = 6
    xx = 0
    if @piece.box.high_hex_adjust == true then hx_adjust = -9 else hx_adjust = 0
    for hx in @hexes
      aa = hx[0] - @piece.box.anchor_hex[0] + 1
      bb = hx[1] - @piece.box.anchor_hex[1] + 1

      if @piece.box.anchor_hex[0] % 2 == 1
        yy = 9
      else
        if hx[0]%2 == 1
          yy = 18
        else
          yy = 0
      yy = yy + hx_adjust
      @fill_hex_ab_xy(aa,bb,xx,yy,3)


###############################################################################
#  draw_pattern: () -> # TODO Fix this and the HexBox refactor is complete.
#    @img.width = @piece.box.width
#    @img.height = @piece.box.height
#    @hexes = @piece.hexes
#    @hex_draw.set_context("piece_mask")
#    xx = 6
#    if @piece.box.high_hex_adjust == true then hx_adjust = -9 else hx_adjust = 0
#    for hx in @hexes
#      aa = hx[0] - @piece.box.anchor_hex[0] + 1
#      bb = hx[1] - @piece.box.anchor_hex[1] + 1

#      if @piece.box.anchor_hex[0] % 2 == 1
#        yy = 9
#      else
#        if hx[0]%2 == 1
#          yy = 18
#        else
#          yy = 0
#      yy = yy + hx_adjust
#      @fill_hex_ab_xy(aa,bb,xx,yy,3)
###############################################################################


  fill_hex_ab_xy: (a,b,x,y,c_no) -> # TODO Fix this and the HexBox refactor is complete.
    xx = x+(a-1)*14
    yy = y+(b-1)*20
    yy = yy-9 if (a%2 == 0)
    @hex_draw.fill_hex_xy(xx,yy,c_no)


## FIXME Saving this method from a discontinued class as an example because the redraw works correctly.
#  draw_piece:  (a,b) ->
#    @pc_img = document.getElementById("piece")
#    if @grid_model.in_range(a,b)

    @context = @puzzle_view.get_drawing_context(mode)


  get_hex_xy: (a,b) ->
    x = a*14 + @dx
    y = (2*b + a%2)*10 + @dy
    xy = [x,y]
    return xy


  fill_hex_ab: (a,b,c_no) ->
    xy = @get_hex_xy(a,b)
    @fill_hex_xy(xy[0],xy[1],c_no)


  fill_hex_xy: (x,y,c_no) ->
    @context.fillStyle = @colors[c_no]
    @context.beginPath()
    @context.moveTo(x+5,y)
