More detail on binary to XPCOM

Shaun Savage <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
HI

I would like to play with the data inside a image loaded from the 
network.  an example is
<img src="foo.gif"><img src="bar.png">

document.images[0] is foo.gif
document.images[1] is bar.png

I then want to see the data for the images

in idl file

interface xxxxx : nsISupports
{

     string checkIt( in ????? *img);    ***** question 1
     newimg makeIt(in ????? *oldimg );  ***** question 3
}

so from JS
    var str;
    str = comp.checkIt(document.images[i]);
    var oldimg = new Image();
    var newimg = makeIt( oldimg );



then from the XPCOM
NS?IMP    xxxxx::CheckIt(?????? * img, char * _retval)
{

       realimg = getreal( img )    ***** question 2
       switch (realimg.type ) {
       case PNG:
            pixelmap = png2pixmap(realimg);

            break;
       case GIF:
            pixelmap = gif2pixmap(realimg);
            break;
       default:
       }

       *_retval = checkpixmap(pixelmap)
}

1>  First I need to know how to setup the idl file to accept 
(nsIDOMHTMLImageElement), if that is the right type ???

2>  next I need to know how to get to the data from the ImageElement.
	I am assuming the type passed in is only a handle for the image, 	and I 
need to get the real image out of cache.


3>  The last thing is how do I return a Image from XPCOM

Shaun
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.