IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29355


Ignore:
Timestamp:
Oct 7, 2010, 8:29:45 PM (16 years ago)
Author:
eugene
Message:

fix range format; fix include precedence

Location:
branches/eam_branches/ipp-20100823/psLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/psLib/src/jpeg/psImageJpeg.c

    r29309 r29355  
    4949psImageJpegOptions *psImageJpegOptionsAlloc(void)
    5050{
     51
    5152  psImageJpegOptions *options = psAlloc(sizeof(psImageJpegOptions));
    5253  psMemSetDeallocator(options, (psFreeFunc)imageJpegOptionsFree);
     
    194195}
    195196
     197bool sprint_double (char *string, double value) {
     198
     199  int Nexp = fabs(log10(fabs(value)));
     200 
     201  if (Nexp > 3) {
     202    sprintf (string, "%.1e", value);
     203  } else {
     204    sprintf (string, "%.1f", value);
     205  }
     206  return true;
     207}
     208
    196209// XXX need to update bDraw APIs to pass in/out structure and avoid the local static
    197 bool psImageJpeg(const psImageJpegOptions *options, const psImage *image, bDrawBuffer *bdbuf, const char *filename)
     210bool psImageJpeg(const psImageJpegOptions *options, const psImage *image, void *bdbuf, const char *filename)
    198211{
    199212  PS_ASSERT_PTR_NON_NULL(options, false);
     
    327340    SetRotFont ("helvetica", 8);
    328341    bDrawSetBuffer(labels);
    329     sprintf (string, "%g", options->min);
     342    sprint_double (string, options->min);
    330343    bDrawRotText(2, 2, string, 2, 0.0);
    331     sprintf (string, "%g", options->max);
     344    sprint_double (string, options->max);
    332345    bDrawRotText(dx - 2, 2, string, 0, 0.0);
    333     sprintf (string, "%g", 0.5*(options->min + options->max));
     346    sprint_double (string, 0.5*(options->min + options->max));
    334347    bDrawRotText(0.5*dx, 2, string, 1, 0.0);
    335348    psImageJpegOverlayDraw(jpegImage, labels, 0, offset);
     
    338351  if (bdbuf) {
    339352    offset = (options->showScale == PS_JPEG_SHOWSCALE_TOP) ? PS_JPEG_COLORPAD + PS_JPEG_LABELPAD : 0;
    340     psImageJpegOverlayDraw(jpegImage, bdbuf, 0, offset);
     353    psImageJpegOverlayDraw(jpegImage, (bDrawBuffer *) bdbuf, 0, offset);
    341354  }
    342355
  • branches/eam_branches/ipp-20100823/psLib/src/jpeg/psImageJpeg.h

    r29309 r29355  
    5353bool psImageJpeg(const psImageJpegOptions *options, // Color map
    5454                 const psImage *image,  // Image to write
    55                  bDrawBuffer *bdbuf,
     55                 void *bdbuf,
    5656                 const char *filename  // Filename of JPEG
    5757                 );
    5858
    59 bDrawBuffer *psImageJpegOverlayInit (const psImage *image);
     59// bDrawBuffer *psImageJpegOverlayInit (const psImage *image);
    6060
    6161/// @}
  • branches/eam_branches/ipp-20100823/psLib/src/pslib.h

    r29309 r29355  
    1717#define PS_LIB_H
    1818
    19 #include <kapa.h>
    2019#include "pslib_strict.h"
    2120
Note: See TracChangeset for help on using the changeset viewer.