creating bitmap wih more colors than 16?

L

Lars Netzel

Hi

I have the following code (never mind the actually logic in this, I know it
sucks) which is very basic and a first try to create some kind of graph but
I'm stuck on the quality it seems like the gradient brush only uses 16
colors and it's not looking good at all.

How Can I make the gradient really smooth?

------------------------------------

Dim height As Integer = 10

Dim bmpImage As New Bitmap(500, 500)

Dim MyGraphics As Graphics

MyGraphics = Graphics.FromImage(bmpImage)

MyGraphics.Clear(Color.White)

Dim myBrush As LinearGradientBrush = New LinearGradientBrush(New
Rectangle(0, 0, 100, 10), Color.White, Color.Red,
LinearGradientMode.Horizontal)

For I As Integer = 0 To height Step 1

MyGraphics.FillRectangle(myBrush, New Rectangle(5 + height, (I * height) +
height, 100 + (I * 2), 5))

MyGraphics.DrawRectangle(New Pen(Color.Black), New Rectangle(5 + height, (I
* height) + height, 100 + (I * 2), 5))

Next

MyGraphics.Flush()

Response.ContentType = "image/jpeg"

bmpImage.Save(Response.OutputStream, ImageFormat.Jpeg)

------------------------------------------------------------------------------------



best regards/

Lars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top