コード例 #1
0
ファイル: MCTexCon.cs プロジェクト: nhering/MCTexCon
 private void AddImageToTexBlock(TexBlock block)
 {
     try
     {
         int         xCoord    = block.coord.x * this._blockSize;
         int         yCoord    = block.coord.y * this._blockSize;
         Rectangle   cloneRect = new Rectangle(xCoord, yCoord, this._blockSize, this._blockSize);
         PixelFormat format    = this._imageIn.PixelFormat;
         block.image = this._transformImageIn.Clone(cloneRect, format);
     }
     catch (Exception e)
     {
         throw;
     }
 }
コード例 #2
0
ファイル: MCTexCon.cs プロジェクト: nhering/MCTexCon
        private void MapImageOntoImageOut(TexBlock block)
        {
            try
            {
                var xOffset = block.coord.x * this._blockSize;
                var yOffset = block.coord.y * this._blockSize;

                for (int x = 0; x < block.image.Width; x++)
                {
                    for (int y = 0; y < block.image.Height; y++)
                    {
                        Color pxl      = block.image.GetPixel(x, y);
                        Color newColor = Color.FromArgb(pxl.A, pxl.R, pxl.G, pxl.B);
                        this._transformImageOut.SetPixel(x + xOffset, y + yOffset, newColor);
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
コード例 #3
0
ファイル: MCTexCon.cs プロジェクト: nhering/MCTexCon
        private void TranslateMapInImagesToMapOutImages()
        {
            try
            {
                foreach (TexBlock inBlock in this._mapIn.texBlocks)
                {
                    TexBlock outBlock = this._mapOut.texBlocks.FirstOrDefault(b => b.name == inBlock.name);
                    //TODO: Roadmap item: We may want a method that gets all the unused
                    //      coordinates in the _mapOut.textBlocks and drop this in the first location there
                    //      if the outBLock doesn't exist in the _mapOut.textBlocks. For now we'll just
                    //      ignore ones that can't be mapped.
                    if (outBlock == null)
                    {
                        continue;
                    }

                    outBlock.image = inBlock.image;
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }