Just popping in
Joined: 2018/3/1 21:08 Last Login
: Today 17:03
From italy
Group:
Registered Users
|
@broadblues
I have modified code to try to implement custom chunks as suggested by Edgar, iff file is saved but opening it with an editor does not show presence of desired informations (custom chunks)
Here is my code, please look at followinf line
SetDTAttrs (o,NULL,NULL,DTA_Data,"***dino***",DTA_ObjAuthor,"***pippo***",DTA_ObjCopyright,"***pluto***",TAG_END);
it should do the trick and I added some different tags just to test, but nothing hoped happens.
Maybe it's a not fully finished impementation of iff datatype library.
/*----------------------------------------------------------------------------*/ /* Save the inner contents of a GZZ window as IFF picture using datatypes */ /*----------------------------------------------------------------------------*/ int32 savewindow (char *name,struct Window *win) { struct BitMap *bm; Object *o; struct BitMapHeader *bmhd; UBYTE *cmap; ULONG *cregs; long i; long w,h,d; long ncols; BPTR fhand; struct ViewPort *vp; int32 Error;
Error = TRUE;
if (bm = gzzarea (win)) { w = win->GZZWidth; h = win->GZZHeight; d = GetBitMapAttr (bm,BMA_DEPTH);
ncols = (d > 8 ? 0 : 1 << d);
vp = ViewPortAddress (win); if (o = NewDTObject (NULL, DTA_SourceType,DTST_RAM, DTA_GroupID,GID_PICTURE, PDTA_BitMap,bm, PDTA_ModeID,GetVPModeID(vp), (ncols ? PDTA_NumColors : PDTA_DestMode),(ncols ? ncols : PMODE_V43), TAG_END)) {
/* **** */ SetDTAttrs (o,NULL,NULL,DTA_Data,"***dino***",DTA_ObjAuthor,"***pippo***",DTA_ObjCopyright,"***pluto***",TAG_END); //SetDTAttrs (o,NULL,NULL,DTA_ObjCopyright,©RIGHT_CHUNK,DTA_ObjAuthor,&USERNAME_CHUNK,TAG_END);
GetDTAttrs (o,PDTA_BitMapHeader,&bmhd,TAG_END);
bmhd->bmh_Width = w; bmhd->bmh_Height = h; bmhd->bmh_Depth = d; bmhd->bmh_XAspect = 22; bmhd->bmh_YAspect = 22; bmhd->bmh_PageWidth = (w <= 320 ? 320 : w <= 640 ? 640 : w <= 1024 ? 1024 : w <= 1280 ? 1280 : 1600); bmhd->bmh_PageHeight = bmhd->bmh_PageWidth * 3 / 4;
if (ncols) { GetDTAttrs (o,PDTA_ColorRegisters,&cmap,PDTA_CRegs,&cregs,TAG_END); GetRGB32 (vp->ColorMap,0,ncols,cregs); for (i = 3*ncols; i; i--) *cmap++ = (*cregs++) >> 24; }
if (fhand = Open (name,MODE_NEWFILE)) { i = DoDTMethod (o,NULL,NULL,DTM_WRITE,NULL,fhand,DTWM_IFF,NULL); Close (fhand); if (i) Error = FALSE; else Delete (name); }
DisposeDTObject (o); } else FreeBitMap (bm); }
return Error; }
|