Hi, I know how to darw using SetPixel but I'm wondering is there a faster way to A) Set indivudal pixels such as SetPixel does. B) To constantly redraw a given rectangle of the dialog (or form) Also is there an equilivant to the VB picture box in assembly, I don't necessarly need bitmap support just a given section of the program with its own hdc (or is that hwnd) Any and all help is appreciated.
Posted on 2001-02-24 13:15:00 by Zadkiel
Geeeze, ANYTHING other then SetPixel is gonna be faster, but I think you already know that. Try looking at MoveToEx, LineTo, DrawEdge (a new personal fav), and how to set the color with CreatePenIndirect and SelectObject.
Posted on 2001-02-24 13:49:00 by Ernie
Thanks ernie I looked up those function my win32 help file and I'd say they'll be helpful. In fact I came acrss another one: Polyline which should be very useful. I was wondering is there a function for filling a rectangle with pixels from an array. Lets say I want to fill a 100 * 80 rectangle can I just pass a point to a 24000 byte array to windows and just let it read the values off it as RGB values. If windows can't do that, whats the best/fastest way I should do it? Thaks again.
Posted on 2001-02-24 16:32:00 by Zadkiel
Zadkiel, Give SetDIBits and SetDIBitsToDevice a try, they can read an array of palette colors or RGB values and draw them on a DIB or device context (iirc, SetDIBitsToDevice can draw at a specified rectangle in the DC). Hope this helps, Thomas
Posted on 2001-02-24 16:47:00 by Thomas
Thanks Thomas, I've been checking out those commands and I'll probably end up using those. One final question though: Is there a way to get direct access to the memory location for a hdc? I personaly prefer draw to an object as I would do with DirectX i.e starting with a pointer to the f/b buffer and then simply using mov statement to set the pixels in a 1D array.
Posted on 2001-02-26 15:30:00 by Zadkiel
win32 programmer's reference:
CreateDIBSection The CreateDIBSection function creates a device-independent bitmap (DIB) that applications can write to directly. The function gives you a pointer to the location of the bitmap's bit values. You can supply a handle to a file mapping object that the function will use to create the bitmap, or you can let the operating system allocate the memory for the bitmap.
Posted on 2001-02-26 16:49:00 by Thomas
Sorry about that, I hadn't quite grasped what exactly it ment, but thats cleared it up. Thanks
Posted on 2001-02-26 18:20:00 by Zadkiel