edges.rb
def make_mockup(canvas, index, frame)
        (row, col) = index.divmod(@mockup_sample_cols)
        width = @pixel_size * 3
        height = @pixel_size * 3
        x = col * width
        y = row * height

        idlog = []
        neighbors = EdgeGrid.new(1 + col * 3, 1 + row * 3)
        neighbors.fill_int(index)
        neighbors.values.each_index do |i|
            if neighbors.is_edge_index_center?(i)
                compose_tile(canvas, neighbors, frame, x + @pixel_size, y + @pixel_size, idlog)
            else
                if neighbors.values[i]
                    color = @dirt_color #dirt
                else
                    color = @mockup_ocean_color
                end
                coord = neighbors.coord_for_edge_index(i)
                nx = coord.x * @pixel_size
                ny = coord.y * @pixel_size
                canvas.rect(nx, ny, nx + @pixel_size, ny + @pixel_size, color, color)
            end
        end
        # puts neighbors.to_s

        identity = idlog.join("|")

        existing_variant_key = @variants.index(identity)
        if existing_variant_key == nil
            @variants.push(identity)
            @variant_neighborhoods.push(neighbors)
            @variant_map[index] = 1000 + (@variants.size - 1)
            canvas.rect(x, y, x + width - 1, y + height - 1, ChunkyPNG::Color.rgb(255, 0, 0), ChunkyPNG::Color::TRANSPARENT)
        else
            @variant_map[index] = existing_variant_key
            canvas.rect(x, y, x + width - 1, y + height - 1, ChunkyPNG::Color::BLACK, ChunkyPNG::Color.rgba(0, 0, 0, 64))
        end
    end
# each mockup is a 3x3 tile space, so you can mark up the neighbors
each mockup is a 3x3 tile space, so you can mark up the neighbors
each mockup is a 3x3 tile space so you can mark up the neighbors
def make_mockup(canvas, index, frame)
        (row, col) = index.divmod(@mockup_sample_cols)
        width = @pixel_size * 3
        height = @pixel_size * 3
        x = col * width
        y = row * height
        idlog = []
        neighbors = EdgeGrid.new(1 + col * 3, 1 + row * 3)
        neighbors.fill_int(index)
        neighbors.values.each_index do |i|
            if neighbors.is_edge_index_center?(i)
                compose_tile(canvas, neighbors, frame, x + @pixel_size, y + @pixel_size, idlog)
            else
                if neighbors.values[i]
                    color = @dirt_color 
                else
                    color = @mockup_ocean_color
                end
                coord = neighbors.coord_for_edge_index(i)
                nx = coord.x * @pixel_size
                ny = coord.y * @pixel_size
                canvas.rect(nx, ny, nx + @pixel_size, ny + @pixel_size, color, color)
            end
        end
        identity = idlog.join("|")
        existing_variant_key = @variants.index(identity)
        if existing_variant_key == nil
            @variants.push(identity)
            @variant_neighborhoods.push(neighbors)
            @variant_map[index] = 1000 + (@variants.size - 1)
            canvas.rect(x, y, x + width - 1, y + height - 1, ChunkyPNG::Color.rgb(255, 0, 0), ChunkyPNG::Color::TRANSPARENT)
        else
            @variant_map[index] = existing_variant_key
            canvas.rect(x, y, x + width - 1, y + height - 1, ChunkyPNG::Color::BLACK, ChunkyPNG::Color.rgba(0, 0, 0, 64))
        end
    end
def make_mockup ( canvas , index , frame ) ( row , col ) = index . divmod ( @mockup_sample_cols ) width = @pixel_size * 3 height = @pixel_size * 3 x = col * width y = row * height idlog = [ ] neighbors = EdgeGrid . new ( 1 + col * 3 , 1 + row * 3 ) neighbors . fill_int ( index ) neighbors . values . each_index do | i | if neighbors . is_edge_index_center? ( i ) compose_tile ( canvas , neighbors , frame , x + @pixel_size , y + @pixel_size , idlog ) else if neighbors . values [ i ] color = @dirt_color else color = @mockup_ocean_color end coord = neighbors . coord_for_edge_index ( i ) nx = coord . x * @pixel_size ny = coord . y * @pixel_size canvas . rect ( nx , ny , nx + @pixel_size , ny + @pixel_size , color , color ) end end identity = idlog . join ( "|" ) existing_variant_key = @variants . index ( identity ) if existing_variant_key == nil @variants . push ( identity ) @variant_neighborhoods . push ( neighbors ) @variant_map [ index ] = 1000 + ( @variants . size - 1 ) canvas . rect ( x , y , x + width - 1 , y + height - 1 , ChunkyPNG :: Color . rgb ( 255 , 0 , 0 ) , ChunkyPNG :: Color :: TRANSPARENT ) else @variant_map [ index ] = existing_variant_key canvas . rect ( x , y , x + width - 1 , y + height - 1 , ChunkyPNG :: Color :: BLACK , ChunkyPNG :: Color . rgba ( 0 , 0 , 0 , 64 ) ) end end
each mockup is a 3x3 tile space, so you can mark up the neighbors
each mockup is a 3x3 tile space so you can mark up the neighbors
#dirt # puts neighbors.to_s
canvas
index
frame