Annonces Google
Serveur IRC
Serveur : irc.portlane.se
Canal : #AmigaNG
Activité du Site

Pages vues depuis 25/07/2007 : 25 336 225

  • Nb. de membres 187
  • Nb. d'articles 1 270
  • Nb. de forums 19
  • Nb. de sujets 20
  • Nb. de critiques 24

Top 10  Statistiques

Index du forum »»  Création-Développement »» Les datatypes me rendent dingue

Les datatypes me rendent dingue#1951

2Contributeur(s)
thellierzzd10h
3 Modérateur(s)
K-LElwoodcorto
thellier thelliericon_post

AAAARGHHH j'arrive toujours pas à sauver une bitmap avec les datatypes


DoDTMethod donne result à 1 et le fichier iff est vide (taille 0)

J'avais aussi essayé un


result=DoDTMethod(dto,NULL,NULL,DTM_WRITE,NULL,fp,DTWM_IFF,NULL);


juste après le chargement par datatype d'un jpg et làa ça marche


Voilà le code
Avec quelques spécificités (qui marchent ailleurs dans ma microbe3d.library):
MyDoMethodA car j'utilise pas libamiga
BmReadPixelArray : séparée pour éviter l'erreur gcc "missing registers"
MMfree/MMalloc: sont mes fonctions d'allocation mémoires tracées


/*==================================================================================*/
inline ULONG MyDoMethodA(Object * obj,Msg msg)
{
ULONG result=0;
Class * cl;

if(obj==NULL)
return(result);
cl = OCLASS(obj);

if(cl==NULL)
return(result);

result =CallHookPkt(&cl->cl_Dispatcher,obj,msg);
return(result);
}
/*==================================================================================*/
void BmReadPixelArray(UBYTE *buf,void *rast,ULONG width,ULONG height)
{
ReadPixelArray(buf,0,0,(width*24/8),rast,0,0,width,height,RECTFMT_RGB);
}
/*==================================================================================*/
void SaveBitmap(Scene3D *S,UBYTE *filename)
{
Object *dto=NULL;
UBYTE *buf=NULL;
BPTR fp=NULL;
struct BitMap *bm;
struct pdtBlitPixelArray bpa;
APTR bitMapHandle;
ULONG width,height;
ULONG result;

bm=S->bufferrastport.BitMap;
Libprintf("SaveBitmap bm %ld \n",bm);

bitMapHandle = LockBitMapTags(bm, LBMI_WIDTH, (ULONG)&width, LBMI_HEIGHT, (ULONG)&height,TAG_END);
if(!bitMapHandle) goto panic;
UnLockBitMap(bitMapHandle);

dto = NewDTObject(NULL, DTA_SourceType,DTST_RAM, DTA_GroupID,GID_PICTURE, TAG_DONE);
if(!dto) goto panic;

buf = MMmalloc(24/8*width*height,"buf");
if(!buf) goto panic;

BmReadPixelArray(buf,&S->bufferrastport,width,height);

result=SetDTAttrs (dto, NULL, NULL,
DTA_ObjName, (ULONG)"Microbe3D grab",
DTA_NominalHoriz, width,
DTA_NominalVert, height,
PDTA_SourceMode, PMODE_V43,
TAG_DONE);
if(result) goto panic;

bpa.MethodID = PDTM_WRITEPIXELARRAY;
bpa.pbpa_PixelData = buf;
bpa.pbpa_PixelFormat = PBPAFMT_RGB;
bpa.pbpa_PixelArrayMod = width*24/8;
bpa.pbpa_Left = 0;
bpa.pbpa_Top = 0;
bpa.pbpa_Height = height;
bpa.pbpa_Width = width;
result=MyDoMethodA(dto,(Msg)&bpa);
if(result) goto panic;

result=DoDTMethod(dto,NULL,NULL,DTM_CLEARSELECTED,NULL);
if(result) goto panic;

fp=Open(filename,MODE_NEWFILE);
if(!fp) goto panic;
result=DoDTMethod(dto,NULL,NULL,DTM_WRITE,NULL,fp,DTWM_IFF,NULL);
Libprintf(" result:%ld for buf %ld %ldX%ld (bm %ld dto %ld fp %ld)\n",result,buf,width,height,bm,dto,fp);
panic:
if(fp) Close(fp);
if(dto) DisposeDTObject(dto);
if(buf) MMfree(buf);
}
/*==================================================================================*/

zzd10h zzd10hicon_post
D'après Amigans, tu as résolu ton problème, n'est-ce pas ?
thellier thelliericon_post

Oui tout à fait avec le bon picture.datatype (45.17 celui du 3.9) ça marche en OS3 & 4


Le source qui réponds au problème "sauver une bitmap Amiga avec les datatypes" est là en bas


http://www.amigans.net/modules/xforum/viewtopic.php?forum=26&topic_id=6681&post_id=93316#forumpost93316



Alain

zzd10h zzd10hicon_post
Merci pour le partage !
Petites Annonces

0 annonce(s) publiée(s)

Consulter

AmigaOS 4.1

Laissez-vous tenter par
AmigaOS 4.1
AmiTheme

AmiTheme