Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <string>
- #include <fstream>
- class File {
- public:
- // storing file header data
- struct Header {
- char idLength;
- char colorMapType;
- char dataTypeCode;
- short colorMapOrigin;
- short colorMapLength;
- char colorMapDepth;
- short xOrigin;
- short yOrigin;
- short width;
- short height;
- char bitsPerPixel;
- char imageDescriptor;
- };
- // storing pixel data
- struct Pixel {
- unsigned char blue;
- unsigned char green;
- unsigned char red;
- };
- // constructor and destructor
- File(std::string fileName);
- ~File();
- // define essential functions
- bool ReadFile(std::string fileName);
- bool WriteFile(std::string fileName);
- Header readHeader(std::ifstream& file);
- void writeHeader(Header header, std::ofstream& file);
- Pixel** readPixelArray(std::ifstream& file, int width, int height);
- void writePixelArray(Pixel** pixelArray, std::ofstream& file);
- Header getHeader();
- private:
- Header header;
- Pixel** pixelArray;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement