<commit_before>﻿namespace Mappy.Util.ImageSampling
{
    using System.Drawing;

    public class NearestNeighbourWrapper : IPixelImage
    {
        private readonly IPixelImage source;

        public NearestNeighbourWrapper(IPixelImage source, int width, int height)
        {
            this.source = source;
            this.Width = width;
            this.Height = height;
        }

        public int Width { get; private set; }

        public int Height { get; private set; }

        public Color this[int x, int y]
        {
            get
            {
                int imageX = (int)((x / (float)this.Width) * this.source.Width);
                int imageY = (int)((y / (float)this.Height) * this.source.Height);
                return this.source[imageX, imageY];
            }
        }
    }
}<commit_msg>Fix small offset in low quality minimap image<commit_after>﻿namespace Mappy.Util.ImageSampling
{
    using System.Drawing;

    public class NearestNeighbourWrapper : IPixelImage
    {
        private readonly IPixelImage source;

        public NearestNeighbourWrapper(IPixelImage source, int width, int height)
        {
            this.source = source;
            this.Width = width;
            this.Height = height;
        }

        public int Width { get; private set; }

        public int Height { get; private set; }

        public Color this[int x, int y]
        {
            get
            {
                // sample at the centre of each pixel
                float ax = x + 0.5f;
                float ay = y + 0.5f;

                int imageX = (int)((ax / this.Width) * this.source.Width);
                int imageY = (int)((ay / this.Height) * this.source.Height);
                return this.source[imageX, imageY];
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.09106052193225986, 'fraction_numerical': 0.002220988339811216, 'mean_word_length': 1.5853658536585367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4817823', 'n_tokens_mistral': 509, 'n_tokens_neox': 485, 'n_words': 136}