User Tag List

Page 3 of 3 FirstFirst 1 2 3
Results 21 to 27 of 27

Thread: ExportImage bug

  1. #21
    No Products Registered

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

    Re: ExportImage bug

    I would recommend looking into GDI+. Adding support for it would make saving and loading images a ton easier and it would give the cSurface class a lot more graphics capabilities. It might cause some issues but the DLL I have on my computer is from 2001 so I can imagine that it wouldn't be too much to ask for users to download the redistributable if they have problems (And that would only be for machines running Windows 98..)

    We could distribute the DLL in a patch and people could provide a version in their product installers just to ensure people have it..

    I don't see that using techology just because it works without anything extra in Windows 98 is worth the loss in functionality and the increased hassle. With the release of Windows Vista we need to adapt "new" technologies if the product is to survive. Sometimes that means needing to have people using Windows 98 and Windows 2000 get a DLL (that most if not all already have as a ton of applications use GDI+) but with the release of Windows Vista I think it would be a good idea.

    EDIT: Also I checked in depth and DevIL can be used in commercial projects... So a combo of both DevIL and GDI+ should allow for much great flexibility when it comes to images. Between the two there is support to export png, gif, tga, jpg, bmp, ect.

  2. #22
    Clickteam Clickteam

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

    Re: ExportImage bug

    About your code, something like that should work (I say "should" because I haven't tried to compile it) :

    Code:
    short WINAPI DLLExport actSaveImage(LPRDATA rdPtr, long param1, long param2)
    {
    	fprh	rhPtr = rdPtr->rHo.hoAdRunHeader;
    	CImageFilterMgr* pImgMgr = rhPtr->rh4.rh4Mv->mvImgFilterMgr;
    	DWORD mFilter=NULL;
    	//pImgMgr=pImgMgr->CreateInstance();
    #if defined(VITALIZE)
    	return 0;
    #else
    	if(rdPtr->runSurface!= NULL)
    	{
    		mFilter=FindFilter(rdPtr,pImgMgr,(LPCSTR)param1);
    
    		CImageFilter pFilter(pImgMgr);
    		pFilter.UseSpecificFilterID(mFilter);
    		if ( !pFilter.CanSave() )
    			mFilter = FILTERID_BMP;
    
    		cSurface* pSf = rdPtr->runSurface;
    		if ( pSf->HasAlpha() && mFilter != FILTERID_PNG && mFilter != FILTERID_TGA )
    		{
    			LPSURFACE pProto = NULL;
    			GetSurfacePrototype(&pProto, 24, ST_MEMORYWITHDC, SD_DIB) )
    			pSf = new cSurface();
    			pSf->Create(rdPtr->swidth,rdPtr->sheight,pProto);
    			rdPtr->runSurface->Blit(*pSf,0,0,BMODE_OPAQUE,BOP_COPY,0,0);
    		}
    
    		ExportImage(pImgMgr,(LPCSTR)param1,pSf,mFilter);
    
    		if ( pSf != rdPtr->runSurface )
    			delete pSf;
    	}
    
    	return 0;
    #endif
    }
    Also, possible problem in the FindFilter function: in the string class is the operator '==' case sensitive? if so there is a problem, you should convert the input string to low case.

  3. #23
    No Products Registered

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

    Re: ExportImage bug

    I will test the code tommorow. Only thing is, doesn't testing mFilter for FILTERID_PNG and FILTERID_TGA after testing to see if it can save and if not setting it to FILTERID_BMP kind of moot? Obviously if the two filters can't save images then CanSave returns false and mFilter isn't TGA or PNG anymore...

    Also you are right about the FindFilter problem and I already knew about it. For testing purposes I have only been using lowercase file extensions though.

    Thanks.

  4. #24
    Clickteam Clickteam

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

    Re: ExportImage bug

    Obviously if the two filters can't save images then CanSave returns false and mFilter isn't TGA or PNG anymore...
    No, TGA and PNG can save image files. This test is just to avoid images with alpha channels to be saved with filters that don't support alpha channels, until the bug is fixed.

  5. #25
    No Products Registered

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

    Re: ExportImage bug

    Quote Originally Posted by Yves
    Yes, the GIF and TGA filters can't save pictures
    Quote Originally Posted by Yves
    No, TGA and PNG can save image files
    Ok so TGA can both save and not save pictures?

    I misunderstood the code because I thought that TGA pictures couldn't be saved O_o. Sorry about that.

  6. #26
    Clickteam Clickteam

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

    Re: ExportImage bug

    Ah LOL, you are right, sorry... TGA can't save files. Replace this line by if ( pSf->HasAlpha() && mFilter != FILTERID_PNG ).

  7. #27
    No Products Registered

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

    Re: ExportImage bug

    It's ok ^^. Just wanted to be sure.

    Thanks.

Page 3 of 3 FirstFirst 1 2 3

Posting Permissions

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