473,320 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Setting Pixel Colors Programmatically in VB 2005

In VB 2005ave a I have a picture control ("pix") on which I want to set each
pixel color according to a variable, X, that has been calculated (I'm
drawing fractals from the Mandelbrot Set). I use the statement:

pix.SetPixel(i, j, myColor)

where i and j are the coordinates of the pixel and myColor is a variable of
type Color. Now X has a maximum value that it can attain (call it LimitX)
and I want the color of a given pixel to be some function of the value of X
for that pixel as a percentage of LimitX. For example, I could calculate
int(csng(X / LimitX) * 255) and use that value as the red, green and blue
components of myColor. My problem is I don't know how to set the RGB
components of myColor. I've tried using the FromArgb method but without
success.

Ideally I would like the user to be able to select two colors (call them A
and B) and then let myColor be in the range A to B based on value of X.

Can someone talk about setting pixel colors programatically ... or direct me
to an article that talks about it?

Thanks very much.


Jan 29 '06 #1
1 1526
fripper wrote:
In VB 2005ave a I have a picture control ("pix") on which I want to set each
pixel color according to a variable, X, that has been calculated (I'm
drawing fractals from the Mandelbrot Set). I use the statement:

pix.SetPixel(i, j, myColor)

where i and j are the coordinates of the pixel and myColor is a variable of
type Color. Now X has a maximum value that it can attain (call it LimitX)
and I want the color of a given pixel to be some function of the value of X
for that pixel as a percentage of LimitX. For example, I could calculate
int(csng(X / LimitX) * 255) and use that value as the red, green and blue
components of myColor. My problem is I don't know how to set the RGB
components of myColor. I've tried using the FromArgb method but without
success.

Ideally I would like the user to be able to select two colors (call them A
and B) and then let myColor be in the range A to B based on value of X.

Can someone talk about setting pixel colors programatically ... or direct me
to an article that talks about it?

Thanks very much.


I don't know much about it but you can use the GetPixel and SetPixel
methods of a bitmap object. Might be able to do what you want w/ it

Chris
Jan 29 '06 #2

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

Similar topics

1
by: pavel.kosina | last post by:
I would need to get at canvas pixel color under certain moving widget or better (= faster?) colors/"types" of underlying static widgets that are of polygon shape (not rectangle). How to arrange...
6
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black...
10
by: unknown | last post by:
some one can give me a portable source codes that color a pixel? (env *nix) -- unknown
1
by: James Dean | last post by:
I get the following message when i try to set a pixel in the bitmap.......whats wrong and how can i fix it....... "Additional information: SetPixel is not supported for images with indexed pixel...
7
by: TomHL | last post by:
hello, - I have a Bitmap Object named: bmp1 - I already have the numerical values of:red,blue and green colors + I have the X and Y cordinates. How do I set the pixel value via safe code on...
2
by: fripper | last post by:
I want to generate a graphic in a picture box control where the color of each pixel is determined by particular values calculated for each pixel. These values are manipulated in such a way that I...
2
by: fripper | last post by:
I am using VB 2005 and want to generate a graphic in a picture box control where the color of each pixel is determined by particular values calculated for each pixel. These values are manipulated...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
7
by: =?Utf-8?B?UmVraGE=?= | last post by:
Hi, I am trying to change the font color for the items in a dropdownlist control at run time using ASP.NET 2.0. DropDownList1.Items.Attributes.Add("style", "color:red"); But when I run the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.