/********************************************************************/ /* Copyright (c) 2017 System fugen G.K. and Yuzi Mizuno */ /* All rights reserved. */ /********************************************************************/ #ifndef _MGImage_HH_ #define _MGImage_HH_ #include "mg/MGCL.h" #include "mgGL/Pixel.h" #include #include #include //class MGOfstream; //class MGIfstream; /** @addtogroup DisplayHandling * @{ */ ///MGImage defines bit map image data. ///MGImage defines the attributes of Image. ///MGImage's behavior is just like std::auto_ptr<>. ///That is , newed area of m_image is transfered if copied, of assined. class MG_DLL_DECLR MGImage{ public: MGImage():m_width(0), m_height(0),m_image(0){;}; ///Garbage image data constructor. MGImage(int wdth, int hght); ///Copy constructor. image2.m_image's ownership is transfered to this. MGImage(const MGImage& image2); ///Extract a part of image2. MGImage( const MGImage& image2,///& ranges// Ranges(j,i1,i2) are input. ); //全てのpixelについて、alphaはそのままでinputされた色に変更する。 //inputされた色のalphaは無視される。 void fill_color_NoChangeAlpha( const MGPixel& pdata ); ///(j, i1,i2) で指定された全てのピクセルについて、 //alphaはそのままでinputされた色に変更する。 void fill_color_NoChangeAlpha( const MGPixel& pdata, int j, int i1, int i2 ); //Copy all the pixels of image2 into this. //This image's width and height are not changed. And part of this and image2 //are copied into this. void copy_color( const MGImage& image2//Source image data. ); //Test if any one of the four pixels of (i,j) to (i+1,j+1) is non zero or not. //i must be < width()-1, and j must be < hieght()-1. //If any one of them is nonzero, return true. bool includeNonZeroAlpha(int i, int j)const; //Copy all the pixels of ranges in image2 into this. //In ranges, range(j,i1,i2) are stored. //Let m=ranges.size(), then m=3n(always a mutiple of 3) where n is the number of ranges. //Let (j,i1,i2)=(ranges[3*k],ranges[3*k+1], ranges[3*k+2]) for k=0,...,n-1, //then PixelData(i,j) for i=i1,...i2 is one range for the height j of this mesh. void copy_color( const MGImage& image2,///& ranges///< Ranges(j,i1,i2) are input. ///