Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Create an image in code

$
0
0

I would like to know how to create an image in code.

For example A blue field X by X pixels with a red line and some text. I have a goal of adding a splash to an actual image similar to how the sports channels have a stripe and some words. Right now I am focusing on the basics of adding elements to a new blank image.

This type of image with transparencies overlay is a related goal.

The very basics of this can be done trivially in regular .net like this:
...
Bitmap flag = new Bitmap(200, 100);
Graphics flagGraphics = Graphics.FromImage(flag);
int red = 0;
int white = 11;
while (white <= 100) {
flagGraphics.FillRectangle(Brushes.Red, 0, red, 200,10);
flagGraphics.FillRectangle(Brushes.White, 0, white, 200, 10);
red += 20;
white += 20;
}
...

I have spent a lot of time on other things that have had a simple answer if I had asked first. Hoping this is like that.

My thanks in advance


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>