Here is the code. It has a few hackish optimizations i'll explain now.

1. It is meant co compile as both arm and 68k. This exact one file.
arm resource it should make should be called 'ARMC',1. to call it, you
just call gifExport() in 68k, and it will check for arm processor and
if need be call the arm version of itself.
2. if you use something other than CodeWarrior, you'll probably need
to change the lines that say "#if defined(__thumb) || defined(__arm)"
to be whatever defines GCC can use to differentiace whether it is
comiling code for 68k or ARM/Thumb
3. input data is raw 16-bit pixel data in little-endian format. (easy
way to make it - create an offscreen window in "nativeFormat" format
4. to save memory space when looking for the colortable to use, the
effective color depth of the source image is reduced to 15 bits from
16 (RGB555), this makes is possible to only need a 64K block instead
of 128. In reality this will not cause any visible problems
5. there is no dithering. The app will find the most commonly used
colors, and use a palette big enough to hold them, up to 256 total.
All other colots wil be approximated with the closest color that is in
the palette.
6. For now the code displays progress by drawing form with id 1001,
and writing progress percentage on it, you can remove this if you wish
7. The code does its own buffering to make card access fast (bigger
writes=much faster). You may change the size of the Write buffer by
varying WRITE_BUFFER_SIZE define. The code also does the gif framing
using maximum-size blocks of data - 255 bytes each, If for some reason
you feel compelled to use smaller blocks (no idea why....), reduce the
size of IMG_PUSHER_BUFFER_SZ define. Do not increase it over 255,
however, as this will produce incompiant gif files which will likely
never work.
8. For now the data is written to card, pass in a open emapty
writeable file handle as the first param. If you want to write
elsewhere, change the type of the "f" param, and the type of the
"file" param in WriteBuffer structure, and write a new wbFlush
function.
9. the code will write a comment into the gif file if you want. any
text of less than 255 characters. pass in NULL to not do this
10. the code returns a boolean, which is true on success. the last
param passed in will be set a pointer to a string describing error if
return value is false. you do not need to free this string, as it will
be in the code resource.
11. you may disable the ARM functionality easily, but that is left as
an excersize for the reader
12. the asm code for ARM just setu R10 so that the arm code has
read-only globals support. in gcc how to do this might differ. i have
provided a precompiler ARM code for this also. (you still need the 68k
code to call it :)


the one and only entry point to this is: Boolean gifExport(FileRef
f,UInt16* data,UInt32 inWidth,UInt32 inHeight,const char*
comment,const char** errStr);



hope this helps you
the source file is here: http://www.palmpowerups.com/priv/gifExport.c
precompiles arm code chunk is here:
http://www.palmpowerups.com/priv/gifExport.ARMC0001.bin


hope this helps you. if you need any help, tell me





On 7/21/08, Edward Jones <[EMAIL PROTECTED]> wrote:
> Dmitry, that would be great if you could post the source for this as it may
> well be just what I am looking for!
>
>
>  Regards
>
>  Edward Jones
>
>
>  Dmitry Grinberg wrote:
>
> > Hello,
> >
> > If anyone is interested I wrote code to create gif images on palm.
> > Created images are uncompressed(thus does not infringe on any patents)
> > static GIF87a images, cool for saving screenshots or whatever you
> > need. It's pretty fast. If anyone wants it, I can post the code here.
> > It runs pretty fast, even in 68k.
> >
> > --
> > Dmitry
> >
> >
>
>  --
>  For information on using the ACCESS Developer Forums, or to unsubscribe,
> please see http://www.access-company.com/developers/forums/
>


-- 
----
Best Regards,
Dmitry Grinberg
(847) 226 9295

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

Reply via email to