Don't know is this the right group, but I have the following problem.
I am trying to retrieve images bitmaps when user click on image in mozilla.
Currently the code that implements this is as follow (getter_AddRefs
omitted):
nsresult XXX::MouseUp(nsIDOMEvent* aMouseEvent) {
aMouseEvent->GetTarget(getter_AddRefs(pDOMEventTarget));
pDOMHTMLImageElement = do_QueryInterface(pDOMEventTarget);
pDocShell = do_GetInterface(pWebBrowser);
pDocShell->GetPresContext(pPresContext);
pPresContext->GetImageGroup(pImageGroup);
pDOMHTMLImageElement->GetSrc(URL);
pszURL = URL.ToNewCString();
pImageRequest = pImageGroup->GetImage(pszURL,0,0,0,0,0);
pImage = pImageRequest->GetImage();
pVoid = pImage->GetBits();
pBMP = (LPBITMAPINFOHEADER) pImage->GetBitInfo();
}
Now two problems occures in this code:
a) sometimes pBMP contains garbage
b) sometimes pBMP report bitmap as 24bit but actual bitmap returned by
GetBits() is 32bit
c) some images (transparent GIFs) are *always* containing zeroes in
GetBits()
Can anyone tell me what I am doing wrong?
--
--
Regards,
Waleri