コード例 #1
0
        public void Draw(STR_Bitmap <T> strbmBitmap, int iXOffset, int iYOffset, int iXo, int iYo, int iW, int iH, T gen_Color)
        {
            for (int y = 0; y < strbmBitmap.miHeightPx; y++)
            {
                int iYPixelCoord = y + iYOffset;
                if (iYPixelCoord < 0 || iYPixelCoord > miHeightPx)
                {
                    continue;
                }

                for (int x = 0; x < strbmBitmap.miWidthPx; x++)
                {
                    int iXPixelCoord = x + iXOffset;
                    if (iXPixelCoord < 0 || iXPixelCoord > miWidthPx)
                    {
                        continue;
                    }
                    T gen_SourceColor = strbmBitmap.GetPixelAtCoord(x, y);

                    int iColor = (STR_Utilities.GenericCast <T, int> .Do(gen_SourceColor)) * (STR_Utilities.GenericCast <T, int> .Do(gen_Color));

                    this.SetPixelAtCoord(x, y, STR_Utilities.GenericCast <int, T> .Do(iColor));
                }
            }
        }
コード例 #2
0
 public void ScaleBlock(STR_Bitmap <T> strbmBitmap, int iScaleFactor, int iX, int iY, T gen_Color)
 {
     for (int y = 0; y < iScaleFactor; y++)
     {
         for (int x = 0; x < iScaleFactor; x++)
         {
             strbmBitmap.SetPixelAtCoord(x + iX, y + iY, gen_Color);
         }
     }
 }
コード例 #3
0
 private void DrawScaledPixel(STR_Bitmap <T> strbmBitmap, int iScaleFactor, int iX, int iY, T gen_Color)
 {
     for (int y = 0; y < iScaleFactor; y++)
     {
         for (int x = 0; x < iScaleFactor; x++)
         {
             strbmBitmap.SetPixelAtCoord(x + iX, y + iY, gen_Color);
         }
     }
 }
コード例 #4
0
        //public STR_Bitmap ( STR_Engine streEngine , int iBufferSize )
        //{
        //    miWidthPx = streEngine.Window.WidthPx;
        //    miHeightPx = streEngine.Window.HeightPx;

        //    miBufferSize = iBufferSize;

        //    m_strpb_gen_PixelBuffer = new STR_PixelBuffer_GEN<T> ( iBufferSize );
        //}

        public STR_Bitmap(STR_Bitmap <T> strbmBitmap)
        {
            miWidthPx  = strbmBitmap.miWidthPx;
            miHeightPx = strbmBitmap.miHeightPx;

            miBufferSize = strbmBitmap.miWidthPx * strbmBitmap.miHeightPx;

            if (miBufferSize != strbmBitmap.miBufferSize)
            {
                throw new Exception("ERR");    //TODO: write this message
            }

            m_strpb_gen_PixelBuffer = strbmBitmap.BufferObject;
        }
コード例 #5
0
        public STR_Bitmap <T> Scale(int iScaleFactor)
        {
            STR_Bitmap <T> strbmResult = new STR_Bitmap <T> (miWidthPx * iScaleFactor, miHeightPx * iScaleFactor);

            for (int y = 0; y < miHeightPx; y++)
            {
                for (int x = 0; x < miWidthPx; x++)
                {
                    T gen_Color = GetPixelAtCoord(x, y);
                    DrawScaledPixel(strbmResult, iScaleFactor, x, y, gen_Color);
                }
            }

            return(strbmResult);
        }
コード例 #6
0
        public void Blit(STR_Bitmap <T> strbmBitmap, int iXOffset, int iYOffset)
        {
            for (int y = 0; y < strbmBitmap.miHeightPx; y++)
            {
                int iYPixelCoord = y + iYOffset;
                if (iYPixelCoord < 0 || iYPixelCoord > miHeightPx)
                {
                    continue;
                }

                for (int x = 0; x < strbmBitmap.miWidthPx; x++)
                {
                    int iXPixelCoord = x + iXOffset;
                    if (iXPixelCoord < 0 || iXPixelCoord > miWidthPx)
                    {
                        continue;
                    }
                    T gen_SourceColor = strbmBitmap.GetPixelAtCoord(x, y);

                    this.SetPixelAtCoord(x, y, gen_SourceColor);
                }
            }
        }
コード例 #7
0
 public STR_Bitmap <T> Copy(STR_Bitmap <T> strbmSourceBitmap) => new STR_Bitmap <T> (strbmSourceBitmap);