you need in converter from jpeg to pdb. it possible if you learn pdb
format. i have utilite for converting any bin file to pdb
(max size 50K). but you must have installed framework on your computer.

ZC> Ok thanks
ZC> But, How do I create .PDB file?

ZC> Because, this code is a decode (in Palm). I need a program or code to
ZC> run in PC for transform JPG to PDB file.

ZC> How can I do?
ZC> Thanks

ZC> -----Mensaje original-----
ZC> De: [EMAIL PROTECTED]
ZC> [mailto:[EMAIL PROTECTED] En nombre de tut.by
ZC> Enviado el: Jueves, 02 de Diciembre de 2004 12:07 p.m.
ZC> Para: Palm Developer Forum
ZC> Asunto: Re: jpg...

ZC> #include "prefix.h"
ZC> #include "sys_types.h"
ZC> #include "jpeglib.h"
ZC> #include "jmemsrc.h"


ZC> UInt32 JpegDecompressCallback( unsigned char* buf, UInt32 size );

ZC> struct jpeg_decompress_struct gJpegDecompressInfo;
ZC> struct jpeg_error_mgr gJpegErrorMgr;


ZC> //----------------------------------------------------------------------
ZC> -------
ZC> // Name        : Decode
ZC> // Parameters  : jpeg file
ZC> // Return      : 
ZC> // Description : 
ZC> //----------------------------------------------------------------------
ZC> -------

ZC> BitmapType* CJpegDecoder::Decode( MemHandle JpegH )
ZC> {

ZC>  JSAMPROW row_pointer[ 1 ];
ZC>  UInt8* row;
ZC>  UInt8* ustrDecompressedRow = ( UInt8* )MemPtrNew( 640 * 3 );
ZC>  Int16 intX;
ZC>  RGBColorType RGBColor;
  
ZC>  // Create the error object
ZC>  gJpegDecompressInfo.err = jpeg_std_error( &gJpegErrorMgr );
 
ZC>  // Create the decompress object
ZC>  jpeg_CreateDecompress( &gJpegDecompressInfo, JPEG_LIB_VERSION,
ZC>                         ( size_t )sizeof(struct jpeg_decompress_struct )
ZC> );
 
ZC>  // Specify the JPEG source call back
ZC>  jpeg_mem_src( &gJpegDecompressInfo, JpegDecompressCallback );
 
ZC>  UInt32 dwLength = MemHandleSize( JpegH );
ZC>  gJpegDecompressInfo.src->next_input_byte = ( JOCTET*
ZC> )gJpegDecompressInfo.mem->alloc_large( (j_common_ptr)
ZC> &gJpegDecompressInfo,
ZC>                                        JPOOL_IMAGE, dwLength );
ZC>  UInt8* arrData = ( UInt8* )MemHandleLock( JpegH );
ZC>  memcpy( ( void* )gJpegDecompressInfo.src->next_input_byte, arrData,
ZC> dwLength );
ZC>  MemHandleUnlock( JpegH );
ZC>  gJpegDecompressInfo.src->bytes_in_buffer = dwLength;
ZC>  // Read the JPEG Header
 
ZC>  jpeg_read_header( &gJpegDecompressInfo, true );
 
 
ZC>  // Thoses settings are ste by default by jdlib_read_header but it
ZC>  //is nice to see what we can change
ZC>  gJpegDecompressInfo.out_color_space = JCS_RGB;
ZC>  gJpegDecompressInfo.dct_method = JDCT_ISLOW;
ZC>  gJpegDecompressInfo.do_fancy_upsampling = true;
ZC>  gJpegDecompressInfo.do_block_smoothing = true;
ZC>  gJpegDecompressInfo.scale_num = 1;
ZC>  gJpegDecompressInfo.scale_denom = 1; // Permitted values are: 1, 2, 4
ZC>                                       //and 8 for scales of: 1/1, 1/2,
ZC>                                       //1/4 and 1/8
ZC>  gJpegDecompressInfo.buffered_image = false;    
ZC>  jpeg_start_decompress( &gJpegDecompressInfo );
 
 
ZC>  Boolean enableColorP = true;
 
 
ZC>  UInt32 widthP = 160;
ZC>  UInt32 heightP = 160;
ZC>  UInt32 depthP = 16;
ZC>  UInt16 error = 0;
 
ZC>  BitmapType* retBitmap = BmpCreate( gJpegDecompressInfo.output_width -
ZC> 1,
ZC>                                     gJpegDecompressInfo.output_height -
ZC> 1,
ZC>                                     16, NULL, &error );
ZC>  WinHandle wH = WinCreateBitmapWindow( retBitmap, &error );
 
ZC>  WinHandle OldH = WinSetDrawWindow( wH );
                        
ZC>  widthP = gJpegDecompressInfo.output_width - 1;
ZC>  heightP = gJpegDecompressInfo.output_height - 1;
 
 
ZC>  Int16 intY1 = gJpegDecompressInfo.output_scanline ;
ZC>  while( gJpegDecompressInfo.output_scanline 
ZC>         < gJpegDecompressInfo.output_height )
ZC>  {
ZC>   row_pointer[ 0 ] = ( unsigned char* )ustrDecompressedRow; //rowbuf
  
ZC>   // Decompress an output line
ZC>   jpeg_read_scanlines( &gJpegDecompressInfo, row_pointer, 1 );
  
ZC>   row = ( UInt8* )row_pointer[ 0 ];
ZC>   // Display the decompressed line (example only)
ZC>   Int16 intX1 = 0;
ZC>   for( intX = 0; intX < gJpegDecompressInfo.output_width; intX++ )
ZC>   {
ZC>    RGBColor.r = row[ intX * 3 ];
ZC>    RGBColor.g = row[ intX * 3 + 1 ];
ZC>    RGBColor.b = row[ intX * 3 + 2 ];
   
ZC>    WinPushDrawState();
ZC>    WinSetForeColorRGB( &RGBColor, NULL );
ZC>    WinDrawPixel( intX1++, intY1 );
ZC>    WinPopDrawState();
   
ZC>   }
  
ZC>   intY1++;
  
ZC>  };
 
ZC>  RectangleType rect;
ZC>  rect.topLeft.x = 0;
ZC>  rect.topLeft.y = 0;
ZC>  rect.extent.x = widthP;
ZC>  rect.extent.y = heightP;

 
ZC>  MemPtrFree( ustrDecompressedRow );
  
ZC>  WinDeleteWindow( wH, true );
ZC>  WinSetDrawWindow( OldH );

 
ZC>  jpeg_finish_decompress( &gJpegDecompressInfo );
 
ZC>  jpeg_destroy_decompress( &gJpegDecompressInfo );
 
  
ZC>  return retBitmap;
ZC> }



ZC> UInt32 JpegDecompressCallback( unsigned char* buf, UInt32 size )
ZC> {
ZC>  return size;
ZC> }




ZC> the sources of jpeg decoder places on
ZC> Metrowerks\CodeWarrior\(CodeWarrior Examples)\Palm OS\Handspring SDK
ZC> Examples\Imaginator\Src

ZC> include next files to your project
ZC> jutil.c
ZC> jcomapi.c
ZC> jdapistd.c
ZC> jdcoefct.c
ZC> jdcolor.c
ZC> jdhuff.c
ZC> jddctmgr.c
ZC> jdinput.c
ZC> jdapimin.c
ZC> jdmainct.c
ZC> jerror.c
ZC> jdsample.c
ZC> jmemmgr.c
ZC> jdmaster.c
ZC> jdmerge.c
ZC> jdmarker.c
ZC> jdphuff.c
ZC> jdpostct.c
ZC> jdtrans.c
ZC> jfdctfst.c
ZC> jfdctint.c
ZC> jidctflt.c
ZC> jidctfst.c
ZC> jidctint.c
ZC> jidctred.c
ZC> jmempalm.c
ZC> jmemsrc.c
ZC> prefix.h
ZC> jconfig.h
ZC> jdct.h
ZC> jdhuff.h
ZC> jppalmPrv.h
ZC> jerror.h
ZC> jinclude.h
ZC> jmemsrc.h
ZC> jmemsys.h
ZC> jmorecfg.h
ZC> jpegint.h
ZC> jpeglib.h
ZC> jpeglib_old.h
ZC> jversion.h




ZC>> Hello!
ZC>> I try show JPG images in my application.
ZC>> I used jpeglib, but I don't understand to how do I make a file
ZC> streams
ZC>> (JPEG).

ZC>> In this page: http://www.nyctergatis.com/jpeglib/ say "Support for
ZC> JPEG
ZC>> data in memory, in file streams (a way to store data in Palm OS
ZC>> databases with an API similar to file systems) and in VFS (the
ZC> virtual
ZC>> file system used by Palm OS for memory expansion modules) has been
ZC> added
ZC>> to make the use of the library as easy as possible for Palm OS
ZC>> developers."

ZC>> How do I make this class file?
ZC>> I have a simple .JPG, How do I transform this file in file strams?

ZC>> Thanks!




ZC> -- 
ZC> Best regards,
ZC>  tut.by                            mailto:[EMAIL PROTECTED]


ZC> -- 
ZC> For information on using the Palm Developer Forums, or to unsubscribe,
ZC> please see http://www.palmos.com/dev/support/forums/




-- 
Best regards,
 tut.by                            mailto:[EMAIL PROTECTED]


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to