Hi yakobom,

> and  I'm trying to get the image when
> reaching OnStopDecode.
> [...]
> I'm converting a piece of code from older Mozilla, where we
> used gfxIImageFrame::GetImageData.

Ok, cool - so instead of "EnsureCleanFrame", I think you want to use "imgIContainer::CopyFrame" to create a gfxImageSurface, and then you want to call "Data()" on the resulting surface.

References:
http://mxr.mozilla.org/mozilla-central/source/modules/libpr0n/public/imgIContainer.idl#173
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxImageSurface.h#48

~Daniel


On 03/08/2011 08:00 PM, Moshe Yakobovich wrote:
Hi Daniel,
Thanks for the quick and detailed response.
What I'm trying to do is simple - get the raw image of a given URL.

My class implements imgIDecoderObser, yes. I call LoadImage on an
instance of the class, and  I'm trying to get the image when
reaching OnStopDecode. It works for JPG only, as mentioned.
I'm converting a piece of code from older Mozilla, where we
used gfxIImageFrame::GetImageData.
I will be happy to hear any suggestions.

yakobom

On Tue, Mar 8, 2011 at 8:27 AM, Daniel Holbert <[email protected]
<mailto:[email protected]>> wrote:

     > I retrieve the image from the
     > imgIRequest using imgIContainer::EnsureCleanFrame.

    I don't think that function does what you think it does.

    A quick MXR search[1] shows that it's only called once in Mozilla
    code -- from inside the JPEG decoder -- so unless you're
    implementing something like a JPEG decoder, you probably don't want
    that function. :)

    Do you have an imgIDecoderObserver implementation in your
    application? I think you'll need one of those, in order to get
    notifications about when the image has finished loading & decoding.
      See in particular OnStartContainer and OnStopDecode.  For a sample
    implementation of those methods, see nsImageListener (which just
    forwards the methods along to identically-named methods in
    nsImageFrame). [2]

    Joe or bholley could probably offer the best help here, but first I
    think they'd need more information about what you're trying to
    achieve.  I'm CC'ing them, but it'd help if you could post back in a
    bit more detail about what you're trying to do and what you've got
    so far.

    Good luck,
    ~Daniel

    [1]
    http://mxr.mozilla.org/mozilla-central/search?string=EnsureCleanFrame

    [2]
    
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsImageFrame.h#75
    
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsImageFrame.cpp#2047



    On 03/08/2011 06:51 PM, yakobom wrote:

        Hi,
        I hope this is the right place to get some answers on this issue.
        In my embedding application (Windows, C++) I'm using
        imgILoader::LoadImage to fetch images. I retrieve the image from the
        imgIRequest using imgIContainer::EnsureCleanFrame. The problem is
        that
        I can only get JPG images, PNG ones come out black.
        Any ideas?

        I would appreciate any help, this is quite urgent.
        Thanks,
        yakobom
        _______________________________________________
        dev-tech-layout mailing list
        [email protected]
        <mailto:[email protected]>
        https://lists.mozilla.org/listinfo/dev-tech-layout


_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to