Groups | Blog | Home
all groups > dotnet drawing api > october 2003 >

dotnet drawing api : Drawing fast Pixel by pixel in a full untrusted security


Crirus
10/6/2003 9:03:55 AM
I want to make a embeded activeX to use on IE as host.
How to draw a big image generated on client machine pixel by pixel?

The main ideea:
I havea 513x513 array of values....I draw a sort of map using that values
for different colors..so I have a realistic lanscape.
I want to zoom about 60 times that map...and the zoomed area to be drawn on
full screen. I want to draw it smoth not a square of 60 pixels x 60 pixels
with one color, because I can see blocks and it's not good.
There is a way to interpoate the colors between rectangles to show a smoth
zoom?

Crirus

Bob Powell [MVP]
10/6/2003 3:15:47 PM
However you do this, it won't be fast if you want to get a good
interpolation. Such a technique would require calculating the effective
distance of the zoomed pixel from its 9 surrounding original neigbors and
chosing the actual value using a weighted average.

If you zoom in 60 tmes, this makes each pixel in the original 3600 pixels on
screen. To do a weighted average on those would be a wee bit time
consuming...

Also, it will always look fuzzy.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm



[quoted text, click to view]

Crirus
10/8/2003 11:21:24 AM
Well, not 60 times that way..I meant a pixel will be 60 pixels in the new
map...
moreover, the new map will not be drawn entirely at once, only a small part,
about 20x60 or less, dependin on screen resolution
So the main loops will be no more than 20 or so... that way the speed issue
is solved.
The problem is that I need to redraw the map as realistic as I can. By now,
I didnt took in the point of view the ideea of tiles hand-designed, I still
hope I can generate on the fly sme terrain colors god enough



[quoted text, click to view]

Bob Powell [MVP]
10/8/2003 12:40:31 PM
You might be able to get away with drawing the tiles using a path gradient
of four points (or five to close the figure).

You can set up an array of colours, one for each point using the
InterpolationColors property and the PathGradientBrush will interpolate
between the nodes.

Set the center colour to the colour of the current tile and the four corners
to the colours of the diagonally adjacent tiles.

I don't know how fast this would be in your application though. It's a bit
computationally intense.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm



[quoted text, click to view]

AddThis Social Bookmark Button