Hi Amigans, I need a fast help to resolve a issue about 8 bit (256 colors) images. The following snippet code works ok with 24 bit images but fails to load 8 bit ones. I don't need to load 15/16 bit pictures. The image is displayed but with less colors. I grabbed code from Thomas examples
Anyway I have anoter issue to resolve.. How I can add chunks inside iff file I have to write? In "datatypeclass.h" include file I read, among others, following defines
So did you set this to TRUE to make it work? Or the other way round?
As to saving with custom chunks, there is no way to do this with datatypes. You could possibly save to a temp file then append your custom chnks to that file (updating the FORM size to match). That way you'd only jave to worry about saving your custom data and you could let picture.datatype handle the image saving.
Anyway IFF could be better supported because it's still a good standard to write data and represents one of the amiga good peculiarities.
I hope there will be written some high level calls to use datatypes in a more easy way in next OS releases. i.e. SaveWinBitmap or LoadBitmapWin functions call with some useful arguments to pass in
the only information I could find is in the file "Class.c" in the directory "Examples/AHI/Low-level/PTdatatype" of the AmigaOS4 SDK.
DTA_ObjName and DTA_UserData is used there. The question is, if the data is written into file, when you save it with the ILBM datatype.
X-5000 PPC 5020/2 GHZ, Fractal Define XL R2-Tower, OS 4.1 final update 2, 4 GB, Radeon HD 7770, ESI Juli@ XTe A1222, OS 4.1 SAM 460ex/1,15 GHZ, OS 4.1 final, 2 GB, Radeon HD 6450 Amiga 4000D/040 25 Mhz, OS 3.9 BB2, 272 MB, X-Surf, 250 MB ZIP
Depending on the datatypes class in question those attributes may be filled in when the object is opened.
Quote:
I hope there will be written some high level calls to use datatypes in a more easy way in next OS releases. i.e. SaveWinBitmap or LoadBitmapWin functions call with some useful arguments to pass in
Datatypes is already fairly high level in that is doesn't care what image type you load as long as there is datatype for it.
Depending what you are doing with you images bitmap.image might be a solution for higher level image loading.
There is also IIntuition->ObtainBitMapSourceA and ObtainBitMapInstanceA
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)
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); }