JD2022-TU1/main/extern/Camcam/LIBS/Input/PSD.cpp

59 lines
No EOL
1 KiB
C++

#include "TRACK.h"
#include "MEDIA.h"
#include "PSD\MyPSD.h"
u32 PSD_LOAD(MAP *RefMap,char *Filename)
{
MyPSD::CPSD psd;
int nErrorCode = psd.Load(Filename);
if ( 0 == nErrorCode ) // No errors were found
{
int nWidth, nHeight; // for Width & Height in pixels
psd.Dimensions(nWidth, nHeight);
RefMap->SetSize(nWidth, nHeight, 1);
return 0;
}
return 1;
}
class PSD_Grabber:public INPUT_IO
{
public:
int INIT (class WORLD*){return 0;};
int FRAME (void);
int END (void){return 0;};
IOTYPE GetType() {return IOtype_PSD;};
};
int PSD_Grabber::FRAME()
{
if (ulFileAsbeenTouched)
{
PSD_LOAD(&Image,(char*)MediaName);
ulFileAsbeenTouched = 0;
return 1;
}
return 0;
}
INPUT_IO *PSD_CREATE(char *Filename)
{
INPUT_IO *Ret;
u32 Fl;
u8 *Fi;
Ret = (INPUT_IO *)new(PSD_Grabber);
strcpy((char*)Ret->MediaName,Filename);
Fl = PSD_LOAD(&Ret->Image,Filename);
if (Fl)
{
delete Ret;
return ERROR_CREATE("PSD file\nunloaddable!");
}
Ret->dTotalTime = 0;
Ret->dAvgFramePerSecond = 30.0;
return Ret;
}