1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
PictSelection*
Imported::CreatePictureFromAny (const char* path, State* state,const char *t ,
const double rapport, const char* opt_str)
{
const char *typ;
if (t)
{
typ=t;
}
else
{
typ=strrchr(path,'.');
}
if (!(typ==nil || *typ != '.'))
{
if (ViewPort::IsAViewPortFile(path))
{
return ViewPort::InsertFile(path);
}
else if (!_stricmp (typ, ".bmp"))
{
return CreatePictureFromBMP(path, state);
}
else if (!_stricmp (typ, ".tif") || !_stricmp (typ, ".tiff"))
{
return CreatePictureFromTIFF(path, state->GetGraphicGS(), true);
}
else if (!_stricmp (typ, ".pv"))
{
/*********/
/* prima */
/*********/
PictSelection* pict = CreatePictureFromImportComponent(path, state);// First try import component
if (pict)
return pict;
else
return CreatePictureFromPV(path, state);// Then try rasterization
}
else if (!_stricmp (typ, ".ps") || !_stricmp (typ, ".eps") ||
!_stricmp (typ, ".ai") || !_stricmp (typ, ".pdf") || !_stricmp (typ, ".psi"))
{
return CreatePictureFromPostScript(path, state);
}
else if (!_stricmp (typ, ".mdl"))
{
return CreatePictureFromModaris(path, state, nil );
}
// else if (!_stricmp (typ, ".pst"))
// {
// return CreatePictureFromImportComponent(path, state);
// }
// C'est la ou se pose le probleme
else if (ImportDllIsKnownFormat((BSTR) path) == S_OK)
{
DesignImport* pImport = new DesignImport(state);
char* opt_str="-p-r-d-f-t";
double rapport = 0.0;
int seam_line=1;
int special_text=1;
int sptxt_fixed_size=1;
if (ImportDllReadFile((BSTR)path, pImport, 0.0,false,rapport, opt_str,special_text,sptxt_fixed_size,seam_line) != S_OK)
{
delete pImport;
return NULL;
}
else
{
PictSelection* slpict = pImport->GetPictSelection();
// cleaning useless object
pImport->Clean();
slpict->Deplier();
delete pImport;
return slpict;
}
}
else
return CreatePictureFromImportComponent(path, state);
}
return nil;
} |
Partager