本文整理汇总了C++中pm_message函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_message函数的具体用法?C++ pm_message怎么用?C++ pm_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: skipExtraBytes
static void
skipExtraBytes( FILE * const ifP,
int const extraskip) {
/*--------------------------------------------------------------------------
This function exists for backward compatibility. Its purpose is to
manually delete the MacBinary header.
We check the MacHeader version number, but just issue a warning if the
value is invalid.
---------------------------------------------------------------------------*/
unsigned int re;
unsigned char * const rBuff = malloc(MAX (extraskip, MACP_HEAD_LEN));
if( rBuff == NULL )
pm_error("Out of memory.");
re = fread ( rBuff, 1, extraskip, ifP);
if (re < extraskip)
pm_error("EOF/error while reading off initial %u bytes"
"specified by -extraskip.", extraskip);
re = fread ( rBuff, MACP_HEAD_LEN, 1, ifP);
if (re < 1)
pm_error("EOF/error while reading MacPaint header.");
/* Check the MacPaint version number. Dismiss error. */
if (validateMacPaintVersion( rBuff, 0 ) == TRUE)
pm_message("Input file starts with valid MacPaint header.");
else
pm_message(" - Ignoring invalid version number.");
free( rBuff );
}
示例2: warnOutOfFrame
static void
warnOutOfFrame(int const originLeft,
int const originTop,
int const overCols,
int const overRows,
int const underCols,
int const underRows) {
if (originLeft >= underCols)
pm_message("WARNING: the overlay is entirely off the right edge "
"of the underlying image. "
"It will not be visible in the result. The horizontal "
"overlay position you selected is %d, "
"and the underlying image "
"is only %d pixels wide.", originLeft, underCols );
else if (originLeft + overCols <= 0)
pm_message("WARNING: the overlay is entirely off the left edge "
"of the underlying image. "
"It will not be visible in the result. The horizontal "
"overlay position you selected is %d and the overlay is "
"only %d pixels wide.", originLeft, overCols);
else if (originTop >= underRows)
pm_message("WARNING: the overlay is entirely off the bottom edge "
"of the underlying image. "
"It will not be visible in the result. The vertical "
"overlay position you selected is %d, "
"and the underlying image "
"is only %d pixels high.", originTop, underRows );
else if (originTop + overRows <= 0)
pm_message("WARNING: the overlay is entirely off the top edge "
"of the underlying image. "
"It will not be visible in the result. The vertical "
"overlay position you selected is %d and the overlay is "
"only %d pixels high.", originTop, overRows);
}
示例3: cleanupFeederProcess
static void
cleanupFeederProcess(pid_t const feederPid) {
int status;
waitpid(feederPid, &status, 0);
if (WIFSIGNALED(status)) {
if (WTERMSIG(status) == SIGPIPE)
pm_message("WARNING: "
"Standard Input feeder process was terminated by a "
"SIGPIPE signal because the shell command closed its "
"Standard Input before the Standard Input feeder was "
"through feeding it.");
else
pm_message("WARNING: "
"Standard Input feeder was terminated by a Signal %d.",
WTERMSIG(status));
}
else if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0)
pm_message("WARNING: "
"Standard Input feeder process ended abnormally. "
"exit status = %d", WEXITSTATUS(status));
} else
pm_message("WARNING: "
"Unrecognized process completion status from "
"Standard Input feeder: %d", status);
}
示例4: computeDepth
static void
computeDepth(xelval const input_maxval,
unsigned int * const bitspersampleP,
unsigned int * const ps_maxvalP) {
/*----------------------------------------------------------------------------
Figure out how many bits will represent each sample in the Postscript
program, and the maxval of the Postscript program samples. The maxval
is just the maximum value allowable in the number of bits.
-----------------------------------------------------------------------------*/
unsigned int const bitsRequiredByMaxval = pm_maxvaltobits(input_maxval);
if (bitsRequiredByMaxval <= 1)
*bitspersampleP = 1;
else if (bitsRequiredByMaxval > 1 && bitsRequiredByMaxval <= 4)
*bitspersampleP = 4;
else
*bitspersampleP = 8;
if (*bitspersampleP < bitsRequiredByMaxval)
pm_message("Maxval of input requires %u bit samples for full "
"resolution, but we are using the Postscript maximum "
"of %u", bitsRequiredByMaxval, *bitspersampleP);
*ps_maxvalP = pm_bitstomaxval(*bitspersampleP);
if (verbose)
pm_message("Input maxval is %u. Postscript raster will have "
"%u bits per sample, so maxval = %u",
input_maxval, *bitspersampleP, *ps_maxvalP);
}
示例5: writeMS_Ico
static void
writeMS_Ico(MS_Ico const MSIconData,
const char * const outFname) {
int x,y;
ofp = pm_openw(outFname);
writeU2(MSIconData->reserved);
writeU2(MSIconData->type);
writeU2(MSIconData->count);
for (x=0;x<MSIconData->count;x++) writeIC_Entry(MSIconData->entries[x]);
for (x=0;x<MSIconData->count;x++) {
writeIC_InfoHeader(MSIconData->entries[x]->ih);
for (y=0;y<(MSIconData->entries[x]->color_count);y++) {
writeIC_Color(MSIconData->entries[x]->colors[y]);
}
if (verbose) pm_message("writing xor bitmap");
writeBitmap(MSIconData->entries[x]->xorBitmapOut,
MSIconData->entries[x]->xBytesXor,
MSIconData->entries[x]->height);
if (verbose) pm_message("writing and bitmap");
writeBitmap(MSIconData->entries[x]->andBitmapOut,
MSIconData->entries[x]->xBytesAnd,
MSIconData->entries[x]->height);
}
fclose(ofp);
}
示例6: showVersion
static void
showVersion(void) {
pm_message( "Using libnetpbm from Netpbm Version: %s", NETPBM_VERSION );
#if defined(COMPILE_TIME) && defined(COMPILED_BY)
pm_message( "Compiled %s by user \"%s\"",
COMPILE_TIME, COMPILED_BY );
#endif
#ifdef BSD
pm_message( "BSD defined" );
#endif /*BSD*/
#ifdef SYSV
#ifdef VMS
pm_message( "VMS & SYSV defined" );
#else
pm_message( "SYSV defined" );
#endif
#endif /*SYSV*/
#ifdef MSDOS
pm_message( "MSDOS defined" );
#endif /*MSDOS*/
#ifdef AMIGA
pm_message( "AMIGA defined" );
#endif /* AMIGA */
{
const char * rgbdef;
pm_message( "RGB_ENV='%s'", RGBENV );
rgbdef = getenv(RGBENV);
if( rgbdef )
pm_message( "RGBENV= '%s' (env vbl set to '%s')",
RGBENV, rgbdef );
else
pm_message( "RGBENV= '%s' (env vbl is unset)", RGBENV);
}
}
示例7: convertImages
static void
convertImages(FILE * const ofP,
struct cmdlineInfo const cmdline,
struct jpeg_decompress_struct * const cinfoP,
struct sourceManager * const sourceManagerP) {
if (cmdline.multiple) {
unsigned int imageSequence;
for (imageSequence = 0; dsDataLeft(sourceManagerP); ++imageSequence) {
if (cmdline.verbose)
pm_message("Reading Image %u", imageSequence);
convertImage(ofP, cmdline, cinfoP);
}
} else {
if (dsDataLeft(sourceManagerP)) {
convertImage(ofP, cmdline, cinfoP);
} else
pm_error("Input stream is empty");
}
if (dsPrematureEof(sourceManagerP)) {
if (cmdline.repair)
pm_message("Premature EOF on input; repaired by padding end "
"of image.");
else
pm_error("Premature EOF on input. Use -repair to salvage.");
}
}
示例8: dumpPfmHeader
static void
dumpPfmHeader(struct pfmHeader const pfmHeader) {
pm_message("width: %u, height: %u", pfmHeader.width, pfmHeader.height);
pm_message("color: %s", pfmHeader.color ? "YES" : "NO");
pm_message("endian: %s",
pfmHeader.endian == ENDIAN_BIG ? "BIG" : "LITTLE");
pm_message("scale factor: %f", pfmHeader.scaleFactor);
}
示例9: recursefindpack
static void
recursefindpack(Rectangle * const current,
Coord const currentsz,
Coord * const best,
unsigned int const minarea,
unsigned int * const maxareaP,
unsigned int const depth,
unsigned int const n,
unsigned int const xinc,
unsigned int const yinc,
unsigned int const quality,
unsigned int const qfactor) {
if (depth == n) {
if (currentsz.x * currentsz.y < *maxareaP) {
unsigned int i;
for (i = 0; i < n; ++i)
best[i] = current[i].ul;
*maxareaP = currentsz.x * currentsz.y;
}
} else {
unsigned int i;
Rectangle * const newP = ¤t[depth];
for (i = 0; ; ++i) {
for (newP->ul.x = 0, newP->ul.y = i * yinc;
newP->ul.y <= i * yinc;) {
Coord c;
c.x = MAX(lr(*newP).x, currentsz.x);
c.y = MAX(lr(*newP).y, currentsz.y);
pm_message("current = (%u.%u, %u.%u) new = (%u.%u, %u.%u)",
current[0].ul.x, current[0].size.x,
current[0].ul.y, current[0].size.y,
newP->ul.x, newP->size.x,
newP->ul.y, newP->size.y);
if (!collides(*newP, current, depth)) {
pm_message("Depth %u: Doesn't collide at i=%u", depth,i);
recursefindpack(current, c, best, minarea, maxareaP,
depth + 1, n, xinc, yinc,
quality, qfactor);
if (*maxareaP <= minarea)
return;
}
if (newP->ul.x == (i - 1) * xinc)
newP->ul.y = 0;
if (newP->ul.x < i * xinc)
newP->ul.x += xinc;
else
newP->ul.y += yinc;
}
}
}
}
示例10: makePalette
static void
makePalette(pixel ** const xorPPMarray,
int const xorCols,
int const xorRows,
pixval const xorMaxval,
IC_Palette * const paletteP,
colorhash_table * const xorChtP,
int * const colorsP,
const char ** const errorP) {
/*
* Figure out the colormap and turn it into the appropriate GIF
* colormap - this code's pretty much straight from ppmtobpm
*/
colorhist_vector xorChv;
unsigned int i;
int colors;
IC_Palette palette = createCleanPalette();
if (verbose) pm_message("computing colormap...");
xorChv = ppm_computecolorhist(xorPPMarray, xorCols, xorRows, MAXCOLORS,
&colors);
if (xorChv == NULL)
asprintfN(errorP,
"image has too many colors - try doing a 'pnmquant %d'",
MAXCOLORS);
else {
*errorP = NULL;
if (verbose) pm_message("%d colors found", colors);
if (verbose && (xorMaxval > 255))
pm_message("maxval is not 255 - automatically rescaling colors");
for (i = 0; i < colors; ++i) {
if (xorMaxval == 255) {
addColorToPalette(palette,i,
PPM_GETR(xorChv[i].color),
PPM_GETG(xorChv[i].color),
PPM_GETB(xorChv[i].color));
} else {
addColorToPalette(palette,i,
PPM_GETR(xorChv[i].color) * 255 / xorMaxval,
PPM_GETG(xorChv[i].color) * 255 / xorMaxval,
PPM_GETB(xorChv[i].color) * 255 / xorMaxval);
}
}
/* And make a hash table for fast lookup. */
*xorChtP = ppm_colorhisttocolorhash(xorChv, colors);
ppm_freecolorhist(xorChv);
*paletteP = palette;
*colorsP = colors;
}
}
示例11: analyzeColorsInRgbInput
static void
analyzeColorsInRgbInput(struct pam * const pamP,
struct cmdlineInfo const cmdline,
int const maxcolors,
tupletable * const chvP,
unsigned int * const colorsP,
bool * const grayscaleP) {
/*----------------------------------------------------------------------------
Same as analyzeColors(), except assuming input image has R/G/B tuples.
-----------------------------------------------------------------------------*/
if (cmdline.color && cmdline.truecolor) {
*chvP = NULL;
*grayscaleP = FALSE;
} else {
tupletable chv;
bool grayscale;
pm_message("computing colormap...");
chv = pnm_computetuplefreqtable2(pamP, NULL, maxcolors,
pamP->maxval,
colorsP);
if (chv == NULL) {
grayscale = FALSE;
} else {
unsigned int i;
pm_message("%u color%s found",
*colorsP, *colorsP == 1 ? "" : "s");
grayscale = TRUE; /* initial assumption */
for (i = 0; i < *colorsP && grayscale; ++i) {
if (!pnm_rgbtupleisgray(chv[i]->tuple))
grayscale = FALSE;
}
}
*grayscaleP = grayscale;
if (grayscale || cmdline.truecolor) {
*chvP = NULL;
if (chv)
pnm_freetupletable(pamP, chv);
} else {
/* He wants a colormap. But can we give it to him? */
if (chv)
*chvP = chv;
else {
pm_message("Too many colors - "
"proceeding to write a 24-bit RGB file.");
pm_message("If you want an 8-bit palette file, "
"try doing a 'pnmquant %d'.",
maxcolors);
*chvP = NULL;
}
}
}
}
示例12: drawguides
/* Draw a pair of guide boxes. */
static void
drawguides(int const guidesize,
const struct pam * const outPamP,
double const eyesep,
unsigned int const dpi,
double const depthOfField) {
int const far = separation(0, eyesep, dpi, depthOfField);
/* Space between the two guide boxes. */
int const width = outPamP->width; /* Width of the output image */
tuple *outrow; /* One row of output data */
tuple blackTuple;
int col;
pnm_createBlackTuple(outPamP, &blackTuple);
outrow = pnm_allocpamrow(outPamP);
/* Leave some blank rows before the guides. */
makeWhiteRow(outPamP, outrow);
writeRowCopies(outPamP, outrow, guidesize);
/* Draw the guides. */
if ((width - far + guidesize)/2 < 0 ||
(width + far - guidesize)/2 >= width)
pm_message("warning: the guide boxes are completely out of bounds "
"at %d DPI", dpi);
else if ((width - far - guidesize)/2 < 0 ||
(width + far + guidesize)/2 >= width)
pm_message("warning: the guide boxes are partially out of bounds "
"at %d DPI", dpi);
for (col = (width - far - guidesize)/2;
col < (width - far + guidesize)/2;
++col)
if (col >= 0 && col < width)
pnm_assigntuple(outPamP, outrow[col], blackTuple);
for (col = (width + far - guidesize)/2;
col < (width + far + guidesize)/2;
++col)
if (col >= 0 && col < width)
pnm_assigntuple(outPamP, outrow[col], blackTuple);
writeRowCopies(outPamP,outrow, guidesize);
/* Leave some blank rows after the guides. */
makeWhiteRow(outPamP, outrow);
writeRowCopies(outPamP, outrow, guidesize);
pnm_freerow(outrow);
}
示例13: tellDetails
static void
tellDetails(struct jpeg_decompress_struct const cinfo,
xelval const maxval,
int const output_type) {
print_verbose_info_about_header(cinfo);
pm_message("Input image data precision = %d bits",
cinfo.data_precision);
pm_message("Output file will have format %c%c "
"with max sample value of %d.",
(char) (output_type/256), (char) (output_type % 256),
maxval);
}
示例14: computeColorMapFromInput
static void
computeColorMapFromInput(FILE * const ifP,
bool const allColors,
int const reqColors,
enum methodForLargest const methodForLargest,
enum methodForRep const methodForRep,
int * const formatP,
struct pam * const freqPamP,
tupletable2 * const colormapP) {
/*----------------------------------------------------------------------------
Produce a colormap containing the best colors to represent the
image stream in file 'ifP'. Figure it out using the median cut
technique.
The colormap will have 'reqcolors' or fewer colors in it, unless
'allcolors' is true, in which case it will have all the colors that
are in the input.
The colormap has the same maxval as the input.
Put the colormap in newly allocated storage as a tupletable2
and return its address as *colormapP. Return the number of colors in
it as *colorsP and its maxval as *colormapMaxvalP.
Return the characteristics of the input file as
*formatP and *freqPamP. (This information is not really
relevant to our colormap mission; just a fringe benefit).
-----------------------------------------------------------------------------*/
tupletable2 colorfreqtable;
computeHistogram(ifP, formatP, freqPamP, &colorfreqtable);
if (allColors) {
*colormapP = colorfreqtable;
} else {
if (colorfreqtable.size <= reqColors) {
pm_message("Image already has few enough colors (<=%d). "
"Keeping same colors.", reqColors);
*colormapP = colorfreqtable;
} else {
pm_message("choosing %d colors...", reqColors);
mediancut(colorfreqtable, freqPamP->depth,
reqColors, methodForLargest, methodForRep,
colormapP);
pnm_freetupletable2(freqPamP, colorfreqtable);
}
}
}
示例15: makeIcrColormap
static void
makeIcrColormap(colorhist_vector const chv,
unsigned int const colorCt,
pixval const maxval,
char * const rgb) {
unsigned int i;
if (maxval > 255)
pm_message("Maxval is not 255 - automatically rescaling colors" );
for (i = 0; i < CLUTCOLORCT; ++i)
rgb[i] = 0;
for (i = 0; i < colorCt; ++i) {
unsigned int j;
j = (3 * i);
if (maxval == 255) {
rgb[j++] = PPM_GETR(chv[i].color) ;
rgb[j++] = PPM_GETG(chv[i].color) ;
rgb[j++] = PPM_GETB(chv[i].color) ;
} else {
rgb[j++] = (unsigned int) PPM_GETR(chv[i].color) * 255 / maxval;
rgb[j++] = (unsigned int) PPM_GETG(chv[i].color) * 255 / maxval;
rgb[j++] = (unsigned int) PPM_GETB(chv[i].color) * 255 / maxval;
}
}
}