I ve create this function (it s in pascal, but it s same in c)

///////////// displayJPG /////////////
function displayJPG(name:String;x,y:UInt16):boolean;
procedure 
BmpSetTransparentValue(bitmapP:BitmapPtr;transparentValue:UInt32); 
inline($7406,SYSTRAP,HIGH_DENSITY_TRAP);
{$i pnojpeglib.pas}
var
 AppJpgRefnum:UInt16;
 globals:globalsType;
 time:String;
 data:Pointer;
 path:String;
 vfsslot:UInt32;
 dirslot:UInt32;
 idvfs:UInt16;
 BitmapP:BitmapPtr;
 BitmapV3P:BitmapPtrV3;
 BitmapV3V1P:record
  case integer of
   1:(bitmapv1:BitmapPtr);
   2:(bitmapv3:BitmapPtrV3);
  end;
 //end;
 rgb:RGBColorType;
 
 error:Err;
  
begin
   displayJPG:=false;
   
   rgb.index:=0;
   rgb.r:=255;
   rgb.g:=255;
   rgb.b:=255;

   vfsslot:=vfsIteratorStart;
   VFSVolumeEnumerate(idvfs,vfsslot);
   
   AppJpgRefnum:=0;
   error:=SysLibFind('pnoJpegLib',AppJpgRefnum);
   FtrGet(CurAppCreator,0,globals.p);
 
   
path:='/PALM/Programs/kLauncher/Skins/'+globals.g^.prefs.SkinName+'/'+name;

   if error=($0500 or 10) then
    Error:=sysLibLoad(pnoJpegLibType,pnoJpegLibCreator,AppJpgRefnum);
   if error=0 then begin
    error:=pnoJpegOpen(AppJpgRefnum);
    if error=0 then begin
     pnoJpeg2Create(AppJpgRefnum,data);
     if error=0 then begin
      vfsslot:=vfsIteratorStart;
      error:=1;
      while (vfsslot<>vfsIteratorStop) AND (error<>0) do begin
       VFSVolumeEnumerate(idvfs,vfsslot);
       error:=pnoJpeg2LoadFromVFS(AppJpgRefnum,data,idvfs,path);
      end;
      if error=0 then begin
       BitmapV3V1P.bitmapv1:=MemPtrNew(sizeof(BitmapTypeV3));
       error:=pnoJpeg2Read(AppJpgRefnum,data,BitmapV3V1P.bitmapv1);
       if error=0 then begin
        
pnoJpeg2Bmp2DoubleDensity(AppJpgRefnum,BitmapV3V1P.bitmapv1,BitmapV3V1P.bitmapv3);
        BmpSetTransparentValue(BitmapV3V1P.bitmapv1,RgbTo565(rgb));
        WinDrawBitmap(BitmapV3V1P.bitmapv1,x,y);
        displayJPG:=true;
        MemPtrFree(BitmapV3V1P.bitmapv1);
       end;
      end;
      pnoJpeg2Free(AppJpgRefnum,data);
     end;
     pnoJpegClose(AppJpgRefnum);
    end;
    SysLibRemove(AppJpgRefnum);
   end;
   
end;

I explain too how to use pnojpeglib with pp on my site.

...... Original Message .......
On Tue, 29 May 2007 21:35:00 +0200 ""Tam Hanna"" <[EMAIL PROTECTED]> wrote:
>Dear Guys and Gals,
>I use the pnoJpeg2Lib to decompress 320x320px jpeg images on a Palm Treo 680. 
>Decompression 
works well, but drawing the bitmap to a window produces very weird results.
>
>The handheld draws only the top quarter of the bitmap. I have tried playing 
>around with the 
window and bitmap coordinate systems to no avail - could anyone point me in the 
right direction?
>
>Best regards and thank you
>Tam Hanna
>
>
>-- 
>For information on using the ACCESS Developer Forums, or to unsubscribe, 
>please see 
http://www.access-company.com/developers/forums/
___
Benoit HERVIER
http://www.khertan.net
Sent from my Palm

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to