F
fripper
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.
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.