The purpose of this function is to take a bitmap and return a bitmap of double the height, with two of the images stacked on top of each other.
Expand|Select|Wrap|Line Numbers
- private Bitmap ProcessBitmap(Bitmap sourceBitmap)
- {
- int w = sourceBitmap.Width;
- int h = sourceBitmap.Height;
- int targetHeight = (h*2);
- Bitmap targetBitmap = new Bitmap(w, targetHeight);
- Rectangle sourceRect = new Rectangle(0, 0, w, h);
- Graphics sourceGraphics;
- sourceGraphics = Graphics.FromImage(sourceBitmap);
- Graphics targetGraphics;
- targetGraphics = Graphics.FromImage(targetBitmap);
- // Begin implementation code
- targetGraphics.DrawImage(sourceBitmap, 0, 0);
- targetGraphics.DrawImage(sourceBitmap, 0, h);
- Bitmap returnBitmap = new Bitmap(w, targetHeight, targetGraphics);
- targetGraphics.Dispose();
- return returnBitmap;
- }