Original Post
Hi, could somebody help me with this?
I''m trying to load 24 bit bit-maps into a 16 bit
surface. My surface is 128X128 and so is my image.
I''v droped all the header stuff since I know the width and
height before hand. When I blit the surface onto the screen
I get weird virticle lines in my image.
here''s the source ->
int loadbmp(int h,int w,FILE *file,LPDIRECTDRAWSURFACE7 lpdds){
int c=0,r=0,g=0,b=0,x=0,y=0,y2=0,*buffer,index=0;
char *tempbuf;
if(file==NULL)
return(0);
fseek (file, 54, SEEK_SET);
tempbuf = (char *)malloc(w*h*3);
fread(tempbuf,1,h*w*3,file);
fclose (file);
lpdds->Lock(NULL,&ddsd,
DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,NULL);
int lpitch=(int)(ddsd.lPitch >> 1);
buffer = (int *)ddsd.lpSurface;
for (y=h-1,y2=0; y>0-1; y--,y2++)
for (x=0; x> 3;
g = tempbuf[index+1] >> 3;
r = tempbuf[index+2] >> 3;
if(bitcode=0)
c=bit555(r,g,b);
else
c=bit565(r,g,b);
buffer[(x+y*w) >> 1]=c;
}//end loop
lpdds->Unlock(NULL);
free(tempbuf);
return(1);
}
I would appreciate any help.
thanks, Klaus