Exemplo n.º 1
0
        /// <summary>
        ///     Creates the triangle mosaic.
        /// </summary>
        /// <param name="blockSize">Size of the block.</param>
        public void CreateTriangleMosaic(int blockSize)
        {
            foreach (var index in this.getBlockStartingPoints(blockSize))
            {
                var indexMapperData =
                    IndexMapper.Triangle(index, blockSize, (int)this.ImageWidth, (int)this.ImageHeight);
                for (var collectionIndex = 0; collectionIndex < indexMapperData.Count; collectionIndex++)
                {
                    IndexMapper.ConvertEachIndexToMatchOffset(indexMapperData[collectionIndex], 4);
                }

                var left  = indexMapperData[0];
                var right = indexMapperData[1];

                if (left.Length > 0)
                {
                    Painter.FillWithAverageColor(this.SourcePixels, left);
                }

                if (right.Length > 0)
                {
                    Painter.FillWithAverageColor(this.SourcePixels, right);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Creates the solid block mosaic with the specified block sizes
 /// </summary>
 /// <param name="blockSize"> the block size to use</param>
 public void CreateSquareMosaic(int blockSize)
 {
     foreach (var index in this.getBlockStartingPoints(blockSize))
     {
         var indexes = IndexMapper.Box(index, blockSize, (int)this.ImageWidth, (int)this.ImageHeight);
         IndexMapper.ConvertEachIndexToMatchOffset(indexes, 4);
         Painter.FillWithAverageColor(this.SourcePixels, indexes);
     }
 }