func_zlib_compress2.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. .. _func_zlib_compress2:
  2. =========
  3. compress2
  4. =========
  5. compress2 - Compress data at a specified level.
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. ?win32 Or ptr32
  10. Function compress2:Int( dest:Byte Ptr, dest_len:UInt Var, source:Byte Ptr, source_len:UInt, level:Int )
  11. ?ptr64 And Not win32
  12. Function compress2:Int( dest:Byte Ptr, dest_len:ULong Var, source:Byte Ptr, source_len:ULong, level:Int )
  13. ?
  14. Attempts to compress ``source_len`` bytes of data in the buffer ``source``, placing the result in the buffer ``dest``, at the
  15. level described by ``level``. The level supplied should be a value between 0 and 9.
  16. A level of 1 requests the highest speed, while a level of 9 requests the highest compression. A level of 0 indicates
  17. that no compression should be used, and the output shall be the same as the input.
  18. On entry, ``dest_len`` should point to a value describing the size of the ``dest`` buffer. The application should
  19. ensure that this value be at least ``(source_len * 1.001) + 12``. On successful exit, the variable referenced by
  20. ``dest_len`` will be updated to hold the length of compressed data in dest.
  21. Parameters
  22. ==========
  23. * ``dest`` - The destination buffer.
  24. * ``dest_len`` - The size of the destination buffer. On exit, will hold the actual size of the compressed data.
  25. * ``source`` - The source buffer.
  26. * ``source_len`` - The size of the source data.
  27. * ``level`` - The required compression level, 0 to 9, where 0 is none, 9 is maximum.
  28. Return Values
  29. =============
  30. On success, returns 0. Otherwise a value to indicate the error.
  31. Examples
  32. ========
  33. See Also
  34. ========
  35. :ref:`func_zlib_compress`