GlistEngine
Loading...
Searching...
No Matches
gImage.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ENGINE_GRAPHICS_GIMAGE_H_
18#define ENGINE_GRAPHICS_GIMAGE_H_
19
20#include "gTexture.h"
21
22
34class gImage : public gTexture {
35public:
37 gImage(int w, int h, int format = GL_RGBA);
38 gImage(const gImage& other);
39 gImage(gImage&& other) noexcept;
40 gImage& operator=(const gImage& other);
41 gImage& operator=(gImage&& other) noexcept;
42 virtual ~gImage();
43
62 unsigned int load(const std::string& fullPath);
63
91 unsigned int loadImage(const std::string& imagePath);
92
93 unsigned int loadImageFromURL(const std::string& imageUrl);
94 unsigned int loadImageFromURL(const std::string& imageUrl, bool cutUrlParameters);
95
114 void loadData(const std::string& fullPath);
115
139 void loadImageData(const std::string& imagePath);
140
144 unsigned int useData();
145
152 void setImageData(unsigned char* imageData);
153
154 void setImageData(unsigned char* imageData, int width, int height, int componentNum, bool isMutable = false, bool isStbImage = false);
155
160 unsigned char* getImageData();
161
168 void setImageDataHDR(float* imageData);
169
170 void setImageDataHDR(float* imageData, int width, int height, int componentNum, bool isMutable = false, bool isStbImage = false);
171
177
181 void clearData();
182
190 void save(std::string fullpath);
191 void saveImage(std::string fileName);
199 bool checkPixelPerfectCollision(gImage* otherImage, float imgposX, float imgposY, float otherimgposX, float otherimgposY);
200
201 std::string getImageUrl();
202 static std::string generateDownloadedImagePath(std::string imageType = "png");
203 unsigned int loadMaskImage(const std::string& maskImagePath);
204
205protected:
206 void copyFrom(const gImage& other) noexcept;
207 void swap(gImage& other) noexcept;
208
209private:
210 bool loadedfromurl;
211 std::string imageurl;
212 static int downloadno;
213};
214
215#endif /* ENGINE_GRAPHICS_GIMAGE_H_ */
Definition gImage.h:34
std::string getImageUrl()
void setImageData(unsigned char *imageData)
gImage(int w, int h, int format=GL_RGBA)
void clearData()
float * getImageDataHDR()
void setImageData(unsigned char *imageData, int width, int height, int componentNum, bool isMutable=false, bool isStbImage=false)
void setImageDataHDR(float *imageData, int width, int height, int componentNum, bool isMutable=false, bool isStbImage=false)
void loadImageData(const std::string &imagePath)
void save(std::string fullpath)
static std::string generateDownloadedImagePath(std::string imageType="png")
unsigned int loadImage(const std::string &imagePath)
void swap(gImage &other) noexcept
unsigned int loadMaskImage(const std::string &maskImagePath)
unsigned int useData()
bool checkPixelPerfectCollision(gImage *otherImage, float imgposX, float imgposY, float otherimgposX, float otherimgposY)
void saveImage(std::string fileName)
gImage(const gImage &other)
unsigned int load(const std::string &fullPath)
gImage & operator=(const gImage &other)
gImage & operator=(gImage &&other) noexcept
virtual ~gImage()
unsigned int loadImageFromURL(const std::string &imageUrl, bool cutUrlParameters)
void copyFrom(const gImage &other) noexcept
unsigned int loadImageFromURL(const std::string &imageUrl)
void loadData(const std::string &fullPath)
void setImageDataHDR(float *imageData)
gImage(gImage &&other) noexcept
unsigned char * getImageData()
Definition gTexture.h:17
bool isMutable()
unsigned int format
Definition gTexture.h:147
int width
Definition gTexture.h:150
int height
Definition gTexture.h:150
std::string fullpath
Definition gTexture.h:146