473,653 Members | 2,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating bitmap wih more colors than 16?

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.FromIm age(bmpImage)

MyGraphics.Clea r(Color.White)

Dim myBrush As LinearGradientB rush = New LinearGradientB rush(New
Rectangle(0, 0, 100, 10), Color.White, Color.Red,
LinearGradientM ode.Horizontal)

For I As Integer = 0 To height Step 1

MyGraphics.Fill Rectangle(myBru sh, New Rectangle(5 + height, (I * height) +
height, 100 + (I * 2), 5))

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

Next

MyGraphics.Flus h()

Response.Conten tType = "image/jpeg"

bmpImage.Save(R esponse.OutputS tream, ImageFormat.Jpe g)

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

best regards/

Lars
Sep 18 '06 #1
0 1157

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1617
by: R.Wieser | last post by:
Hello All, I would like to be able to edit a .BMP-file, while retaining it's color-depth & colors. Actually, I want to cut small pieces outof one .BMP, and store it into another one. Jup, sort of a tile-editor :-) Does anyone have a small sample (or pointer to one) of howto : 1) Load & save a device-independant bitmap (DIB).
1
1666
by: john | last post by:
what operation can i performe on a bitmap, in C#, that will give the visual effect of a photo negitive? I have a bitmap on a form, and when people mouse over the bitmap, i'd like all light colors to be dark and all dark colors to be light. thanks, JOhn
8
1496
by: Robert Dufour | last post by:
I been trying to look for samplecodes on how to create a simple tif file. I found a lot of commercial and stuff but I would prefer to roll my own. I only need to put some formatted text in a tif file so it can be faxed out. Does anyone now where I could find some sample source code. It can`t be all that big a secret :-) Regards, Bob
12
3349
by: active | last post by:
I've been looking on the Internet for a way to convert a DIB to a Bitmap without success. Now I'm wondering if that is the approach I should be taking. All I want to do is display the DIB or draw it into a Bitmap. Is there a graphics method that can help?
5
3333
by: active | last post by:
I need to know how many colors in the color table are actually used. Do I need to use Windows API? I been searching the Bitmap doc and can't find a property that would help. Is there a way other than Windows API to get that information?
6
2458
by: \Frank\ | last post by:
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one that, for example, comes from the clipboard with CF_BITMAP. I'm guessing that a CompatableBitmap is an array of indices that point to the colors in a Palette of the display driver. So if I get a bitmap via CF_BITMAP I need to also get a Palette off the clipboard and realize it then display the bitmap. I believe "Realize it" means to put it into the display driver.
2
3858
by: Piotrekk | last post by:
Hi I have a problem. I open bitmap file, load it to memory decrease color palette by proceeding Euclidean distance. As a result i have image reduced to - for example 18 colors. Once i save it - Bitmap.Save(filename) reopen and check color of every pixel it seems that there are over 41000 of different pixel colors. I need to save it in such a way that there will be exactly 18 colors in a file. It seems i have problem with it... Can...
2
2597
by: Peter Oliphant | last post by:
I want to create a new Bitmap which is a portion of an existing Bitmap. For example, if I have a Bitmap that is 100x100 in size I might want to create a new Bitmap that is equivalent to the one located at (x,y)=(10,20) (upper-left hand corner) and is 50x50 in size of the source Bitmap. A sub-Bitmap if you will, sort of the equivalent to sub-strings for a source string. I don't think this works, but something like: Bitmap^ src_bm = ...
9
6555
by: colin | last post by:
Hi, I have all the components of a .bmp file in memory wich i need to write to a .bmp file, (or other convenient image file) ie i have 256 color pallete of RGBquads and array of 8bit pixels, I can create a System.Drawing.Bitmap and it allows me to set the witdh,height,bpp, and even the pixel data, but it doesnt seem to let me set the color palette, the palette property field is read/write but requires a...
0
8283
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8704
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5620
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4147
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.