Loading the RAW or PNG screen dump into VB

Posted by: Fastrack

Loading the RAW or PNG screen dump into VB - 04/02/2002 12:06

Has anyone tried loading either of these 2 formats into Visual Basic?

I'm creating a remote control app in VB and want to use the screen dump from Mark Lords Hijack.

I may have to switch to MFC to code this, but I'd prefer VB

Thanks in advance.
Posted by: number6

Re: Loading the RAW or PNG screen dump into VB - 04/02/2002 21:16

What about using the Internet Explorer control that comes with VB on your form and then pasting some HTML code into the control which has a reference to the file (on the empeg, or local hard disk or whatever).

Only problem with that is that the Windows Internet Explorer control doesn't like being resized while its got stuff in it to display.

I've used the Internet Explorer control in VB before to show a quick and dirty XML tree view - simply point the control at the XML file and you're done.

Posted by: hybrid8

Re: Loading the RAW or PNG screen dump into VB - 04/02/2002 22:44

He's already doing the IE thing. Problem is it blows for displaying images quickly and efficiently. It makes my mouse flash like some piece of crap non-interrupt-driven software cursor.

Best solution is to do your own thing with the raw image. So any code to help out in this respect will probably get Fastrack a long way. I don't have any VB code of any kind lying around. I used to have links to C sources for both parsing different formats as well as some generalized display routines.

I'd imagine that there should be some other existing support in VB for blitting a region from one area of memory to the display.

Bruno
Posted by: number6

Re: Loading the RAW or PNG screen dump into VB - 04/02/2002 23:35

Check out DesignerControls.com - they have a cool image library, which will work with PNG format for sure.

Oops, they've sold out to Atalasoft.com - visit their home page for information on IMGX 5.
Posted by: wfaulk

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 00:03

No. But the raw format is remarkably simple to parse. It's a non-compressed bitmap where each pixel is represented by 4 bits. Black == 0. Dark Grey == 1. Light Grey == 2. White == 3 or 15 (it's supposed to be just 3, but I've found some 15s lying around -- go figure).
Posted by: mlord

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 00:12

Yeah, software can use the "unused" bits as it pleases, and it's quite common to see 4-bit values for the 2-bit pixels.

Note that the .png format is about half the size, and almost as easy to parse. It has 4 pixels per byte instead of two, and there's the odd byte here and there to skip over.

-ml
Posted by: hybrid8

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 00:32

The parsing I'm sure is the easy part. The obstacle I see for Fastrack is the display. He wants something that's going to be a lot more efficient than going through IE calls.

Bruno
Posted by: number6

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 03:15

Thats why the IMGX5 library is so good - it allows VB programmers to graphics stuff at C++ speed [both coding and execution].

Only problem is that its not a freebie - we have IMGX4 at work for our software and its great from VB.


The other alternative is to start fiddling with device contexts and all that stuff,

The best idea is to look at using a picturebox control in VB and 'decode' the PNG into it using PSET - won't be particularly elegant code, but I'd bet it would work better than IE.

There are also VB controls out there that can natively load PNG files into a picturebox control - from there its 'on the screen' more efficiently than with IE.
Posted by: Fastrack

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 05:50

Wow quite a few responses The image control sounds cool, but I don't want to spend money on my Empeg Control software.. hehe

I did find source to load a PNG file, and it worked fairly well but there was no way to scale the image. (And 128x32 is is not enough when running at 1280x1024).

Thanks for all the help, I guess I'll keep looking around for examples. Hehe

I've never done anything with images (Except loading a simple BMP into a picture box)
Posted by: hybrid8

Re: Loading the RAW or PNG screen dump into VB - 05/02/2002 11:54

Look for seperate scaling code. Doing a 2x should be really simple stuff even without finding any examples.

Another alternative (though I don't know how well you'd get to it in VB ) is to make a small OpenGL context and throw the image on as a texture. Then you could scale to your heart's content and make use of all sorts of goodies like bilinear filtering.

Bruno