rag
graphic 2d engine
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
rag::Image Class Reference

Image object. More...

#include <Image.h>

Inheritance diagram for rag::Image:
rag::Resource

Public Member Functions

 Image (const std::string &path="", int textureWrapMode=GL_CLAMP_TO_EDGE, bool deleteImageData=true, bool downloaded=false)
 Returns a functional image with size, the image is loaded in background. More...
 
virtual ~Image ()
 Default destructor.
 
virtual void loadInBackground () override
 CPU intensive load goes here.
 
virtual void loadSync () override
 The part of the loading that must be done in main thread.
 
void reload ()
 on context lost, images can be reloaded.
 
- Public Member Functions inherited from rag::Resource
void acquire ()
 Prevents the Resource to be deleted until it's release()'d.
 
void release ()
 Releases the Resource, so it can be deleted.
 

Static Public Member Functions

static ImageloadImage (const std::string &path="", int textureWrapMode=GL_CLAMP_TO_EDGE, bool deleteImageData=true, bool downloaded=false)
 Returns a functional image with size, the image is loaded in background. More...
 
static void setCompressedFolder (std::string folder)
 Adds a compressed folder. More...
 
static void clearCompressedFolders ()
 Clears all compressed folders.
 

Public Attributes

int width
 
int height
 
int pixelFormat
 
GLuint name
 
GLubyte * bytes
 
- Public Attributes inherited from rag::Resource
State state
 Current state.
 
std::string resourceName
 Resource unique name. Usually the file name.
 
int memorySize
 Size of the Resource in memory measured in bytes.
 

Static Public Attributes

static int s_memorySize = 0
 

Friends

class ImageLoaderJPG
 

Additional Inherited Members

- Public Types inherited from rag::Resource
enum  State { Enqueued = 0, LoadingInBackground, BackgroundLoaded, Ready }
 List of possible states for a Resource.
 

Detailed Description

Image object.

An image represents a 2D texture, usually readed from a specific file on disk. Images can be drawn by Bitmap instances. Image raw data can be read and/or manipulated.

Constructor & Destructor Documentation

Image::Image ( const std::string &  path = "",
int  textureWrapMode = GL_CLAMP_TO_EDGE,
bool  deleteImageData = true,
bool  downloaded = false 
)

Returns a functional image with size, the image is loaded in background.

If you want direct access to image in raw format, you need to specify deleteImageData = false, otherwise image data is deleted.

Member Function Documentation

Image * Image::loadImage ( const std::string &  path = "",
int  textureWrapMode = GL_CLAMP_TO_EDGE,
bool  deleteImageData = true,
bool  downloaded = false 
)
static

Returns a functional image with size, the image is loaded in background.

Asks resource manager for the image, create it if not exists.

void Image::setCompressedFolder ( std::string  folder)
static

Adds a compressed folder.

All pngs and jpgs loaded inside a compressed folder are converted to 16bpp images in memory.


The documentation for this class was generated from the following files: