WP2LaTeX sources.
Revision | 1daa6fe8182820cc2da45103fcdb48576f83e477 (tree) |
---|---|
Zeit | 2022-11-25 18:05:52 |
Autor | Fojtik |
Commiter | Fojtik |
Make SUN RAS format to be default for .ras extension.
@@ -286,6 +286,22 @@ | ||
286 | 286 | #endif |
287 | 287 | |
288 | 288 | |
289 | +#ifdef SupportRAS_SUN | |
290 | + ImplementReader(RAS_SUN, ".RAS") | |
291 | + #if SupportRAS_SUN>=4 || SupportRAS_SUN==2 | |
292 | + LoadPictureRAS_SUN, | |
293 | + #else | |
294 | + NULL, | |
295 | + #endif | |
296 | + #if SupportRAS_SUN>=3 | |
297 | + SavePictureRAS_SUN, | |
298 | + #else | |
299 | + NULL, | |
300 | + #endif | |
301 | + "SUN"); | |
302 | +#endif | |
303 | + | |
304 | + | |
289 | 305 | #ifdef SupportRAS |
290 | 306 | ImplementReader(RAS,".RAS") |
291 | 307 | #if SupportRAS>=4 || SupportRAS==2 |
@@ -302,22 +318,6 @@ | ||
302 | 318 | #endif |
303 | 319 | |
304 | 320 | |
305 | -#ifdef SupportRAS_SUN | |
306 | - ImplementReader(RAS_SUN, ".RAS") | |
307 | - #if SupportRAS_SUN>=4 || SupportRAS_SUN==2 | |
308 | - LoadPictureRAS_SUN, | |
309 | - #else | |
310 | - NULL, | |
311 | - #endif | |
312 | - #if SupportRAS_SUN>=3 | |
313 | - SavePictureRAS_SUN, | |
314 | - #else | |
315 | - NULL, | |
316 | - #endif | |
317 | - "SUN"); | |
318 | -#endif | |
319 | - | |
320 | - | |
321 | 321 | #ifdef SupportRAW |
322 | 322 | ImplementReader(RAW,".RAW") |
323 | 323 | //#if SupportRAW>=4 || SupportRAW==2 |
@@ -3500,6 +3500,20 @@ | ||
3500 | 3500 | |
3501 | 3501 | |
3502 | 3502 | #if SupportOKO>=4 || SupportOKO==2 |
3503 | + | |
3504 | +inline long LoadOkoHeader(FILE *f, OkoHeader &HDR) | |
3505 | +{ | |
3506 | +#if defined(__PackedStructures__) | |
3507 | + return(fread(&SU,1,sizeof(SU),f)); | |
3508 | +#else | |
3509 | + return(loadstruct(f,"a80wwwwwwwwa416", | |
3510 | + &HDR.identific, &HDR.ver, &HDR.modif, | |
3511 | + &HDR.Histogram, &HDR.Text, &HDR.rows, &HDR.cols, &HDR.levels, | |
3512 | + &HDR.identif, &HDR.dummy)); | |
3513 | +#endif | |
3514 | +} | |
3515 | + | |
3516 | + | |
3503 | 3517 | Image LoadPictureOKO(const char *Name) |
3504 | 3518 | { |
3505 | 3519 | FILE *f; |
@@ -3511,7 +3525,7 @@ | ||
3511 | 3525 | |
3512 | 3526 | if((f=fopen(Name,"rb"))==NULL) return(Img); |
3513 | 3527 | |
3514 | - if(fread(&Header,sizeof(Header),1,f)!=1) goto ENDPROC; | |
3528 | + if(LoadOkoHeader(f, Header) != 512) goto ENDPROC; | |
3515 | 3529 | if(strncmp(Header.identific,"OBR2 Image File",15)) goto ENDPROC; |
3516 | 3530 | |
3517 | 3531 | if(Header.levels==0) goto ENDPROC; //wrong image |
@@ -3538,6 +3552,20 @@ | ||
3538 | 3552 | |
3539 | 3553 | |
3540 | 3554 | #if SupportOKO>=3 |
3555 | + | |
3556 | +inline long SaveOkoHeader(FILE *f, const OkoHeader &HDR) | |
3557 | +{ | |
3558 | +#if defined(__PackedStructures__) | |
3559 | + return(fwrite(&SU,1,sizeof(SU),f)); | |
3560 | +#else | |
3561 | + return(savestruct(f,"a80wwwwwwwwa416", | |
3562 | + HDR.identific, HDR.ver, HDR.modif, | |
3563 | + HDR.Histogram, HDR.Text, HDR.rows, HDR.cols, HDR.levels, | |
3564 | + HDR.identif, HDR.dummy)); | |
3565 | +#endif | |
3566 | +} | |
3567 | + | |
3568 | + | |
3541 | 3569 | int SavePictureOKO(const char *Name, const Image &Img) |
3542 | 3570 | { |
3543 | 3571 | FILE *f; |
@@ -3571,7 +3599,7 @@ | ||
3571 | 3599 | |
3572 | 3600 | if((f=fopen(Name,"wb"))==NULL) return(-1); |
3573 | 3601 | |
3574 | - if(fwrite(&Header,sizeof(Header),1,f)!=1) goto FINISH; | |
3602 | + if(SaveOkoHeader(f,Header) != 512) goto FINISH; | |
3575 | 3603 | |
3576 | 3604 | for(i=0;i<Header.cols;i++) |
3577 | 3605 | { |