summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gregbook/rpng-x.c4
-rw-r--r--contrib/gregbook/rpng2-x.c4
-rw-r--r--contrib/pngminus/png2pnm.c2
-rw-r--r--contrib/visupng/PngFile.c114
-rw-r--r--contrib/visupng/PngFile.h2
-rw-r--r--contrib/visupng/VisualPng.c40
-rw-r--r--contrib/visupng/resource.h2
7 files changed, 84 insertions, 84 deletions
diff --git a/contrib/gregbook/rpng-x.c b/contrib/gregbook/rpng-x.c
index 0a9817029..b9e43071a 100644
--- a/contrib/gregbook/rpng-x.c
+++ b/contrib/gregbook/rpng-x.c
@@ -252,8 +252,8 @@ int main(int argc, char **argv)
else {
bgstr = *argv;
if (strlen(bgstr) != 7 || bgstr[0] != '#')
- ++error;
- else
+ ++error;
+ else
have_bg = TRUE;
}
} else {
diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c
index eea95fbd4..0c8ddeba2 100644
--- a/contrib/gregbook/rpng2-x.c
+++ b/contrib/gregbook/rpng2-x.c
@@ -496,12 +496,12 @@ int main(int argc, char **argv)
"\t\t transparent images; overrides -bgcolor\n",
num_bgpat-1);
#ifdef FEATURE_LOOP
- fprintf(stderr,
+ fprintf(stderr,
" -loop\tloops through background images after initial display\n"
"\t\t is complete (depends on -bgpat)\n"
" sec \tseconds to display each background image (default = 2)\n");
#endif
- fprintf(stderr,
+ fprintf(stderr,
" dur \tduration in microseconds to wait after displaying each\n"
"\t\t row (for demo purposes)\n"
" -timing\tenables delay for every block read, to simulate modem\n"
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index 326f1443a..b1b9fd3ea 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -403,7 +403,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (bit_depth == 16){
dep_16 = (long) *pix_ptr++;
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
- }
+ }
else
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
}
diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c
index db0219e35..e741319e2 100644
--- a/contrib/visupng/PngFile.c
+++ b/contrib/visupng/PngFile.c
@@ -152,29 +152,29 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
Try
{
-
+
// initialize the png structure
-
+
#ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile);
#else
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
#endif
-
+
png_set_sig_bytes(png_ptr, 8);
-
+
// read all PNG info up to image data
-
+
png_read_info(png_ptr, info_ptr);
-
+
// get width, height, bit-depth and color-type
-
+
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL);
-
+
// expand images of all color-type and bit-depth to 3x8 bit RGB images
// let the library process things like alpha, transparency, background
-
+
if (iBitDepth == 16)
png_set_strip_16(png_ptr);
if (iColorType == PNG_COLOR_TYPE_PALETTE)
@@ -186,7 +186,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
if (iColorType == PNG_COLOR_TYPE_GRAY ||
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
-
+
// set the background color to draw transparent and alpha images over.
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
{
@@ -199,30 +199,30 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
{
pBkgColor = NULL;
}
-
+
// if required set gamma conversion
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
png_set_gamma(png_ptr, (double) 2.2, dGamma);
-
+
// after the transformations have been registered update info_ptr data
-
+
png_read_update_info(png_ptr, info_ptr);
-
+
// get again width, height and the new bit-depth and color-type
-
+
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
&iColorType, NULL, NULL, NULL);
-
-
+
+
// row_bytes is the width x number of channels
-
+
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
ulChannels = png_get_channels(png_ptr, info_ptr);
-
+
*piChannels = ulChannels;
-
+
// now we can allocate memory to store the image
-
+
if (pbImageData)
{
free (pbImageData);
@@ -234,33 +234,33 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
png_error(png_ptr, "Visual PNG: out of memory");
}
*ppbImageData = pbImageData;
-
+
// and allocate memory for an array of row-pointers
-
+
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
* sizeof(png_bytep))) == NULL)
{
png_error(png_ptr, "Visual PNG: out of memory");
}
-
+
// set the individual row-pointers to point at the correct offsets
-
+
for (i = 0; i < (*piHeight); i++)
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
-
+
// now we can go ahead and just read the whole image
-
+
png_read_image(png_ptr, ppbRowPointers);
-
+
// read the additional chunks in the PNG file (not really needed)
-
+
png_read_end(png_ptr, NULL);
-
+
// and we're done
-
+
free (ppbRowPointers);
ppbRowPointers = NULL;
-
+
// yepp, done
}
@@ -269,7 +269,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
*ppbImageData = pbImageData = NULL;
-
+
if(ppbRowPointers)
free (ppbRowPointers);
@@ -323,58 +323,58 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
Try
{
// initialize the png structure
-
+
#ifdef PNG_STDIO_SUPPORTED
png_init_io(png_ptr, pfFile);
#else
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
#endif
-
+
// we're going to write a very simple 3x8 bit RGB image
-
+
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
-
+
// write the file header information
-
+
png_write_info(png_ptr, info_ptr);
-
+
// swap the BGR pixels in the DiData structure to RGB
-
+
png_set_bgr(png_ptr);
-
+
// row_bytes is the width x number of channels
-
+
ulRowBytes = iWidth * ciChannels;
-
+
// we can allocate memory for an array of row-pointers
-
+
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
Throw "Visualpng: Out of memory";
-
+
// set the individual row-pointers to point at the correct offsets
-
+
for (i = 0; i < iHeight; i++)
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
-
+
// write out the entire image data in one call
-
+
png_write_image (png_ptr, ppbRowPointers);
-
+
// write the additional chunks to the PNG file (not really needed)
-
+
png_write_end(png_ptr, info_ptr);
-
+
// and we're done
-
+
free (ppbRowPointers);
ppbRowPointers = NULL;
-
+
// clean up after the write, and free any memory allocated
-
+
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
-
+
// yepp, done
}
@@ -389,9 +389,9 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
return FALSE;
}
-
+
fclose (pfFile);
-
+
return TRUE;
}
diff --git a/contrib/visupng/PngFile.h b/contrib/visupng/PngFile.h
index dc6bbb409..c9d383655 100644
--- a/contrib/visupng/PngFile.h
+++ b/contrib/visupng/PngFile.h
@@ -17,7 +17,7 @@ void PngFileInitialize (HWND hwnd) ;
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
-BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
+BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
int iWidth, int iHeight, png_color BkgColor);
diff --git a/contrib/visupng/VisualPng.c b/contrib/visupng/VisualPng.c
index 2018999a0..cb8ad7f3a 100644
--- a/contrib/visupng/VisualPng.c
+++ b/contrib/visupng/VisualPng.c
@@ -302,23 +302,23 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
{
if (strcmp (szImgPathName, "") == 0)
return 0;
-
+
// load the image from file
-
+
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
return 0;
-
+
// invalidate the client area for later update
-
+
InvalidateRect (hwnd, NULL, TRUE);
-
+
// display the PNG into the DIBitmap
-
+
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
}
-
+
return 0;
case IDM_FILE_PREVIOUS:
@@ -328,22 +328,22 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
szImgPathName, NULL))
{
-
+
if (strcmp (szImgPathName, "") == 0)
return 0;
-
+
// load the image from file
-
+
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
&cyImgSize, &cImgChannels, &bkgColor))
return 0;
-
+
// invalidate the client area for later update
-
+
InvalidateRect (hwnd, NULL, TRUE);
-
+
// display the PNG into the DIBitmap
-
+
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
}
@@ -619,29 +619,29 @@ BOOL SearchPngList (
if (FileCount > 0)
{
// get previous entry
-
+
if (pstrPrevName != NULL)
{
if (*pFileIndex > 0)
*pFileIndex -= 1;
else
*pFileIndex = FileCount - 1;
-
+
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
}
-
+
// get next entry
-
+
if (pstrNextName != NULL)
{
if (*pFileIndex < FileCount - 1)
*pFileIndex += 1;
else
*pFileIndex = 0;
-
+
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
}
-
+
return TRUE;
}
else
diff --git a/contrib/visupng/resource.h b/contrib/visupng/resource.h
index 611dd035f..b62176d1d 100644
--- a/contrib/visupng/resource.h
+++ b/contrib/visupng/resource.h
@@ -12,7 +12,7 @@
#define IDM_HELP_ABOUT 40008
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113