our_dick/include/egn/image.hpp

60 lines
1.5 KiB
C++

/**
This file is a part of our_dick
Copyright (C) 2020-2022 rexy712
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OUR_DICK_ENGINE_IMAGE_HPP
#define OUR_DICK_ENGINE_IMAGE_HPP
#include <string>
namespace egn{
//class handling image loading from files
class image
{
private:
int m_width;
int m_height;
int m_channels; //color channels
unsigned char* m_data;
public:
//read in image data from 'file', trying to load with 'req_chan' number of channels.
image(const char* file, bool flip = false, int req_chan = 0);
image(const image&);
image(image&&);
~image(void);
image& operator=(const image&);
image& operator=(image&&);
//check if m_data is a null pointer
operator bool(void)const;
bool valid(void)const;
int get_width(void)const;
int get_height(void)const;
int get_channels(void)const;
const unsigned char* data(void)const;
unsigned char* data(void);
};
}
#endif