PDA

Click to See Complete Forum and Search --> : DirectDraw (need to Zoom, Replace Color, etc)


kb244
Jan 29th, 2001, 07:33 AM
I have downloaded the DX8 Partial SDK for VB

The first tutorial I could probaly use for the zoom (although all it does is resize the picture to the form's size)

I need to do three things (ordered by priority)

1) Be able to replace a color instantly (like change all green pixels to red [I do mean exact RGB value])
2) Be able to zoom and pan an image (100%, 200%, etc)
3) be able to select a region to zoom in on (or just have that selected region look for now)

Any help is appreciated.

HarryW
Jan 29th, 2001, 11:49 AM
Well (1) is easy in a 256-colour palettised mode, otherwise as far as I'm aware you'll have to do a search-and-replace through your whole surface.

For (2) and (3), zooming and panning is no problem, you can define a source and destination rect when you blit regions of surfaces, and if they are different sizes a call to IDirectDraw::Blt (or BltFast I think) will stretch the image to the correct size. If you don't want it to go blocky at high levels of zoom you could work out a forward-map onto a real coordinate system and calculate each pixel's RGB value from the proportions of your mapped pixels that cover it and their RGB values.

That probably makes no sense but as usual I've been awake for far too long so it's no big surprise. Went to a lecture today where the guy spent an hour explaining what recursion was. Well I did need the sleep I suppose.

Hope it helped a bit. I only know DDraw in C++ btw. Oh yeah and you're probably asking this because you want to use DirectX Graphics which isn't DDraw, but never mind, it took me until I'm typing this to realise and I can't be bothered to delete it ;) Think I'll stop there.

kb244
Jan 29th, 2001, 12:14 PM
Well I pretty much knew what you already said, the problem is I need source code, I need least some kind of reference as to what function do I call.

kb244
Jan 29th, 2001, 12:16 PM
I Basically just need a way in VB, where if I have an image such as Jpg or Gif, that I can change a color to a different color (etc all that I described above) but it has to be really fast, and my guess was to use DirectX (DirectDraw for 2D)