User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 27

Thread: ExportImage bug

  1. #1
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ExportImage bug

    It seems that the ExportImage function in the SDK has a bug. If I try to save with say the jpeg image filter and if the surface has an alpha channel, then the image will not be saved.

    I know the filter works because I can save to the format if the surface does not contain an alpha channel, but as soon as I add an alpha channel, the image does not get saved.

    If ExportImage can not be fixed then perhaps there should be a way to determine if a specific filter can handle alpha channels and if not then I could take action to remove the alpha channel from a temp surface and save that.

    Thanks.

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,081
    Mentioned
    122 Post(s)
    Tagged
    2 Thread(s)

    Re: ExportImage bug

    Odd... I don't see anything in the source code that would prevent the routine to work in this case. I'll take a look.

    PS: the only filters that support alpha channels are PNG and TGA.

  3. #3
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    I know this, but if I try to save a surface that has an alpha channel to a format that doesn't support them, then I expect the alpha channel to just not be saved..

  4. #4
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,081
    Mentioned
    122 Post(s)
    Tagged
    2 Thread(s)

    Re: ExportImage bug

    Yes, I said I didn't see anything that could cause this in the routine, so I'll try to take a look with a debugger to see what happens when I can find 5 minutes free.

  5. #5
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    Thanks. It might be a problem with the save method of the image filter class as well.

    Once this is fixed I can release my new Overlay extension .

  6. #6
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module

    Join Date
    Sep 2006
    Location
    Norway
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    vortex, wasnt it only BMP and PNG that would save when we tested?
    Jean Villy Edberg

  7. #7
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    Yeah. The reason that I think the bug is in the save method of the image filter class is because ExportImage returns false when it can't create the image (I know this to be true) and true when it can.

    In the code for ExportImage we see:

    [pre]
    if ( !pFilter.CanSave() )
    return FALSE;
    [/pre]

    and that might also be a cause of the problem. Perhaps the code for CanSave is flawed, or in this line:

    [pre]
    int error = pFilter.Save(pFileName, pbuf, nWidth, nHeight, nDepth, pSaveSf->GetPitch(), (LPLOGPALETTE)pSaveSf->GetPalette(), pAlpha, nAlphaPitch);
    [/pre]

    EDIT: hmm seems that the error that it returns is an Unsupported depth one. Apparently nDepth gets set to 32 because the surface has alpha channel ,and then the filter doesn't support this depth so it just throws an error.

  8. #8
    No Products Registered

    Join Date
    Jun 2006
    Location
    Texas
    Posts
    1,002
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    Any luck fixing this? I would like to get this project out the door so I can start working on others.

    Thanks.

  9. #9
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: ExportImage bug

    Maybe when you get an error, you can try to use the same filter without alphachannel ? and if the saveimage failed again, you throw an error...

  10. #10
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    13,081
    Mentioned
    122 Post(s)
    Tagged
    2 Thread(s)

    Re: ExportImage bug

    Any luck fixing this?
    I can't fix it before the next build is released, in a few weeks.

    In the meantime I suggest that if the surface has an alphachannel and the filter ID is not the PNG or TGA filter ID, you clone the surface to a new surface without alpha channel.

    Yves.

Page 1 of 3 1 2 3 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •