コード例 #1
0
        public StardewBitmap GetBoundedImage(Rectangle rBounds)
        {
            StardewBitmap imPort = new StardewBitmap(rBounds.Width, rBounds.Height);

            imPort.DrawImage(this, new Rectangle(0, 0, rBounds.Width, rBounds.Height), rBounds);

            return(imPort);
        }
コード例 #2
0
        public StardewBitmap GetBoundedImage(int iWidth, int iHeight, int iImageIndex)
        {
            int iRow = 0;
            int iCol = 0;

            int iCols = SourceImage.Width / iWidth;

            if (iImageIndex > -1)
            {
                iRow = iImageIndex / iCols;
                iCol = iImageIndex % iCols;
            }

            StardewBitmap imPort = new StardewBitmap(iWidth, iHeight);

            imPort.DrawImage(this, new Rectangle(0, 0, iWidth, iHeight), new Rectangle(iWidth * iCol, iRow * iHeight, iWidth, iHeight));

            return(imPort);
        }