diff options
author | Alexander Lyons Harkness <me@bearbin.net> | 2017-12-23 13:49:08 +0100 |
---|---|---|
committer | Alexander Lyons Harkness <me@bearbin.net> | 2017-12-24 15:23:23 +0100 |
commit | 1926181cb7c8570fe57ec1b39d4241b9dd156333 (patch) | |
tree | 8ac9c6f24285846fa3f97f0a4ade9b0f9996f295 /Tools/AnvilStats/ImageComposingCallback.h | |
parent | Fixed item ID raw rabbit (#4103) (diff) | |
download | cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.gz cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.bz2 cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.lz cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.xz cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.tar.zst cuberite-1926181cb7c8570fe57ec1b39d4241b9dd156333.zip |
Diffstat (limited to '')
-rw-r--r-- | Tools/AnvilStats/ImageComposingCallback.h | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/Tools/AnvilStats/ImageComposingCallback.h b/Tools/AnvilStats/ImageComposingCallback.h index 2936361d6..916e61d92 100644 --- a/Tools/AnvilStats/ImageComposingCallback.h +++ b/Tools/AnvilStats/ImageComposingCallback.h @@ -32,74 +32,70 @@ public: IMAGE_HEIGHT = 32 * 16, PIXEL_COUNT = IMAGE_WIDTH * IMAGE_HEIGHT, ///< Total pixel count of the image data } ; - + cImageComposingCallback(const AString & a_FileNamePrefix); virtual ~cImageComposingCallback(); // cCallback overrides: virtual bool OnNewRegion(int a_RegionX, int a_RegionZ) override; virtual void OnRegionFinished(int a_RegionX, int a_RegionZ) override; - + // New introduced overridable functions: - - /// Called when a file is about to be saved, to generate the filename + + /** Called when a file is about to be saved, to generate the filename */ virtual AString GetFileName(int a_RegionX, int a_RegionZ); - - /// Called before the file is saved + + /** Called before the file is saved */ virtual void OnBeforeImageSaved(int a_RegionX, int a_RegionZ, const AString & a_FileName) {} - - /// Called after the image is saved to a file + + /** Called after the image is saved to a file */ virtual void OnAfterImageSaved(int a_RegionX, int a_RegionZ, const AString & a_FileName) {} - - /// Called when a new region is beginning, to erase the image data + + /** Called when a new region is beginning, to erase the image data */ virtual void OnEraseImage(void); - + // Functions for manipulating the image: - - /// Erases the entire image with the specified color + + /** Erases the entire image with the specified color */ void EraseImage(int a_Color); - - /// Erases the specified chunk's portion of the image with the specified color. Note that chunk coords are relative to the current region + + /** Erases the specified chunk's portion of the image with the specified color. Note that chunk coords are relative to the current region */ void EraseChunk(int a_Color, int a_RelChunkX, int a_RelChunkZ); - - /// Returns the current region X coord + + /** Returns the current region X coord */ int GetCurrentRegionX(void) const { return m_CurrentRegionX; } - - /// Returns the current region Z coord + + /** Returns the current region Z coord */ int GetCurrentRegionZ(void) const { return m_CurrentRegionZ; } - - /// Sets the pixel at the specified UV coords to the specified color + + /** Sets the pixel at the specified UV coords to the specified color */ void SetPixel(int a_RelU, int a_RelV, int a_Color); - - /// Returns the color of the pixel at the specified UV coords; -1 if outside + + /** Returns the color of the pixel at the specified UV coords; -1 if outside */ int GetPixel(int a_RelU, int a_RelV); - - /// Sets a row of pixels. a_Pixels is expected to be a_CountU pixels wide. a_RelUStart + a_CountU is assumed less than image width + + /** Sets a row of pixels. a_Pixels is expected to be a_CountU pixels wide. a_RelUStart + a_CountU is assumed less than image width */ void SetPixelURow(int a_RelUStart, int a_RelV, int a_CountU, int * a_Pixels); - + /** "Shades" the given color based on the shade amount given Shade amount 0 .. 63 shades the color from black to a_Color. Shade amount 64 .. 127 shades the color from a_Color to white. All other shade amounts have undefined results. */ static int ShadeColor(int a_Color, int a_Shade); - - /// Mixes the two colors in the specified ratio; a_Ratio is between 0 and 256, 0 returning a_Src + + /** Mixes the two colors in the specified ratio; a_Ratio is between 0 and 256, 0 returning a_Src */ static int MixColor(int a_Src, int a_Dest, int a_Ratio); - + protected: - /// Prefix for the filenames, when generated by the default GetFileName() function + /** Prefix for the filenames, when generated by the default GetFileName() function */ AString m_FileNamePrefix; - - /// Coords of the currently processed region + + /** Coords of the currently processed region */ int m_CurrentRegionX, m_CurrentRegionZ; - - /// Raw image data; 1 MiB worth of data, therefore unsuitable for stack allocation. [u + IMAGE_WIDTH * v] + + /** Raw image data; 1 MiB worth of data, therefore unsuitable for stack allocation. [u + IMAGE_WIDTH * v] */ int * m_ImageData; - + void SaveImage(const AString & a_FileName); } ; - - - - |