KSquare Utilities
ImageIO.h
Go to the documentation of this file.
1 /* ImageIO.cpp -- O/S Independent routines to load and save Raster Images.
2  * Copyright (C) 1994-2011 Kurt Kramer
3  * For conditions of distribution and use, see copyright notice in KKB.h
4  */
5 
6 #ifndef _IMAGEIO_
7 #define _IMAGEIO_
8 
9 #include "KKStr.h"
10 
11 
12 namespace KKB
13 {
14  /**
15  *@file ImageIO.h
16  *@brief Methods for reading and writing Images.
17  */
18 
19 
20  #ifndef _RASTER_
21  class Raster;
22  typedef Raster* RasterPtr;
23  #endif
24 
25 
26  void DisplayImage (const Raster& raster,
27  const KKStr& title
28  );
29 
30  void DisplayImage (const Raster& image);
31 
32 
33  RasterPtr ReadImage (const KKStr& imageFileName);
34 
35 
36  bool SupportedImageFileFormat (const KKStr& imageFileName);
37 
38 
39  void SaveImage (const Raster& image,
40  const KKStr& imageFileName
41  );
42 
43  void SaveImageInverted (Raster& raster,
44  const KKStr& imageFileName
45  );
46 
47 
48  /**
49  *@brief Saves image as BMP file using 4 bit compressed gray-scale where Background = 255 and foreground = 0
50  *@details If image is color will convert to gray-scale 1st.
51  * Palette will be set to 0 = 255, 1 = 238, 2 = 221, 3 = 204... 255 = 0.
52  */
53  void SaveImageGrayscaleInverted4Bit (const Raster& image,
54  const KKStr& _fileName
55  );
56 
57 
58  /**
59  *@brief Saves image as BMP using compressed gray-scale where Background = 255 and foreground = 0
60  *@details If image is color will convert to gray-scale 1st.
61  * Palette will be set to 0 = 255, 1 = 254, 2 = 253, ... 255 = 0.
62  */
63  void SaveImageGrayscaleInverted8Bit (const Raster& image,
64  const KKStr& _fileName
65  );
66 
67 } /* namespace KKB; */
68 
69 #endif
A class that is used by to represent a single image in memory.
Definition: Raster.h:108
bool SupportedImageFileFormat(const KKStr &imageFileName)
Definition: ImageIO.cpp:948
RasterPtr ReadImage(const KKStr &imageFileName)
Definition: ImageIO.cpp:188
void DisplayImage(const Raster &raster, const KKStr &title)
Definition: ImageIO.cpp:99
KKTHread * KKTHreadPtr
void SaveImageGrayscaleInverted4Bit(const Raster &image, const KKStr &_fileName)
Saves image as BMP file using 4 bit compressed gray-scale where Background = 255 and foreground = 0...
Definition: ImageIO.cpp:874
void SaveImage(const Raster &image, const KKStr &imageFileName)
Definition: ImageIO.cpp:617
void SaveImageGrayscaleInverted8Bit(const Raster &image, const KKStr &_fileName)
Saves image as BMP using compressed gray-scale where Background = 255 and foreground = 0...
Definition: ImageIO.cpp:914
void SaveImageInverted(Raster &raster, const KKStr &imageFileName)
Definition: ImageIO.cpp:841
static KKStr Concat(const std::vector< std::string > &values)
Concatenates the list of &#39;std::string&#39; strings.
Definition: KKStr.cpp:1082
void DisplayImage(const Raster &image)
Definition: ImageIO.cpp:81