 |
Gorgon Game Engine
|
Go to the documentation of this file.
6 namespace Gorgon {
namespace Resource {
24 static Null *
LoadResource(std::weak_ptr<File> file, std::shared_ptr<Reader> reader,
unsigned long size);
29 virtual void save(
Writer &writer)
const override;
This class stores animations as a part of itself so that it can be moved around as a value rather tha...
Definition: Storage.h:21
void SetMask(A_ *value)
Sets the mask provider, ownership semantics will not be changed.
Definition: MaskedObject.h:198
constexpr Type PNG
PNG compression.
Definition: GID.h:126
constexpr Type File
File.
Definition: GID.h:84
std::enable_if< decltype(gorgon__enum_tr_loc(T_()))::isupgradedenum, std::string >::type From(const T_ &e)
Definition: Enum.h:303
Graphics::ColorMode GetMode() const
Returns the color mode of the image.
Definition: Image.h:1311
static EmptyImage & Instance()
Returns the instance for empty image. Only one instance is enough.
Definition: EmptyImage.h:50
basic_Image< Byte > Image
Definition: Image.h:1364
constexpr Type Image_Props
Image properties.
Definition: GID.h:151
constexpr Type Image_Data
Uncompressed image data.
Definition: GID.h:155
ColorMode
Color modes for images.
Definition: Color.h:16
std::ostream & GetStream()
This should be last resort, use if the actual stream is needed.
Definition: Writer.h:96
basic_TextureAnimationProvider< Bitmap, basic_TextureAnimation, basic_AnimationFrame< Bitmap > > BitmapAnimationProvider
Definition: TextureAnimation.h:520
constexpr Type Null
Null resource.
Definition: GID.h:105
PNG Png
A ready to use PNG class.
Definition: PNG.cpp:304
A_ * GetBase() const
Returns the base component. Could return nullptr.
Definition: MaskedObject.h:180
bool isloaded
Whether this image resource is loaded or not.
Definition: Image.h:95
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: Image.cpp:210
ColorMode mode
Color mode of the texture, necessary to choose correct texture.
Definition: Texture.h:198
unsigned long entrypoint
Entry point of this resource within the physical file.
Definition: Image.h:89
@ VersionMismatch
Version in the file is not recognized.
Definition: Reader.h:31
void SaveAnimation(Writer &writer, const Graphics::RectangularAnimationProvider &object)
Saves a given generic rectangular animation as resource.
Definition: Resource.cpp:22
@ Invalid
This is used to mark invalid color data.
void WriteChunkHeader(GID::Type type, unsigned long size)
Writes the header of a chunk.
Definition: Writer.h:364
static void SaveThis(Writer &writer, const Graphics::Bitmap &bmp, GID::Type type=GID::Image)
This function can be used to save a bitmap as image resource without modifying it.
Definition: Image.cpp:171
Byte * RawData()
Returns the raw data pointer.
Definition: Image.h:211
void ChangeMode(Graphics::ColorMode value)
Changes the color mode of the image.
Definition: Image.h:1317
T_ Height
Height of this size object.
Definition: Size.h:261
void save(Writer &writer) const override
Definition: Image.cpp:141
virtual GID::Type GetGID() const override
01010000h, (System, Folder)
Definition: Null.h:21
constexpr Type MaskedObject
Definition: GID.h:242
void Encode(const Containers::Image &input, std::ostream &output, bool replace_colormode=false)
Encodes a given input.
Definition: PNG.h:163
constexpr Type Image
Image resource.
Definition: GID.h:149
Marker WriteObjectStart(const Base &base)
Writes the start of an object. Should have a matching WriteEnd with the returned marker.
Definition: File.cpp:211
Graphics::ColorMode GetMode() const override
Returns the color mode of the image.
Definition: Bitmap.h:422
void WriteChunkSize(unsigned long value)
Writes chunk size to the stream.
Definition: Writer.h:319
IMaskedObjectProvider & MoveOutProvider() override
This function moves this animation provider into a new provider.
Definition: MaskedObject.cpp:199
virtual void save(Writer &writer) const override
Definition: Null.cpp:5
constexpr Type Image_Cmp_Data
Compressed image data.
Definition: GID.h:157
Containers::Image * data
Container for the image data, could be null indicating its discarded.
Definition: Bitmap.h:767
static void SaveThis(Writer &writer, const Graphics::IMaskedObjectProvider &provider)
Definition: MaskedObject.cpp:141
void ASSERT_FALSE(const std::string &message, int skip=1, int depth=4)
Definition: Assert.h:192
constexpr Type Image_Cmp_Props
Image compression properties.
Definition: GID.h:153
virtual Graphics::RectangularAnimationStorage animmoveout() override
Definition: MaskedObject.cpp:195
void save(Writer &writer) const override
Definition: MaskedObject.cpp:122
unsigned long GetTotalSize() const
Total size of this image in number units.
Definition: Image.h:1306
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
This class represents a 2D geometric size.
Definition: Size.h:23
Marker WriteChunkStart(GID::Type type)
Writes the start of a chunk. Should have a matching WriteEnd.
Definition: Writer.h:351
bool HasData() const
Checks if this image resource has a data attached to it.
Definition: Bitmap.h:163
#define ASSERT(expression, message,...)
Replaces regular assert to allow messages and backtrace.
Definition: Assert.h:161
Collection is a container for reference typed objects.
Definition: Collection.h:21
Graphics::Bitmap MoveOutAsBitmap()
Moves the data out of resource system. Use Prepare and Discard before moving to avoid data duplicatio...
Definition: Image.cpp:204
void WriteArray(const T_ *data, unsigned long size)
Writes an array to the file.
Definition: Writer.h:288
constexpr Type None
Empty, different from Null resource.
Definition: GID.h:81
This object contains an bitmap image.
Definition: Bitmap.h:25
constexpr Type Animation
Definition: GID.h:187
This class is the base for all Gorgon Resources.
Definition: Base.h:20
This object creates a masked object from two graphics object.
Definition: MaskedObject.h:109
bool Load()
Loads the image from the disk. This function requires image to be tied to a resource file.
Definition: Image.cpp:29
GID::Type compression
Compression mode.
Definition: Image.h:85
basic_MaskedObjectProvider< RectangularAnimationProvider > MaskedObjectProvider
Definition: MaskedObject.h:342
std::shared_ptr< Reader > reader
Used to handle late loading.
Definition: Image.h:92
long GetCount() const
Returns number of elements.
Definition: Collection.h:236
Geometry::Size GetSize() const override
Returns the size of this image resource.
Definition: Bitmap.h:436
This class allows resource objects to save their data to a stream.
Definition: Writer.h:59
static MaskedObject * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a masked object resource from the file.
Definition: MaskedObject.cpp:37
A_ * GetMask() const
Returns the mask component. Could return nullptr.
Definition: MaskedObject.h:185
This class represents a loading error.
Definition: Reader.h:16
void WriteEnd(Marker &marker)
This function performs writes necessary to end a chunk that is represented by the marker.
Definition: Writer.h:373
Gorgon::Animation::basic_Storage< RectangularAnimationProvider > RectangularAnimationStorage
Definition: Animations.h:374
T_ Area() const
Returns the exact area of the rectangle has the size of this object.
Definition: Size.h:240
basic_MaskedObjectProvider< BitmapAnimationProvider > MaskedBitmapAnimationProvider
Definition: MaskedObject.h:345
void WriteInt32(long value)
Writes a 32-bit integer to the stream.
Definition: Writer.h:149
For ease of use in resource system.
Definition: MaskedObject.h:10
void Decode(std::istream &input, Containers::Image &output)
Decodes the given PNG data.
Definition: PNG.h:186
T_ Width
Width of this size object.
Definition: Size.h:258
This is a null resource, it can be used in places where a resource is required but it is not wanted.
Definition: Null.h:17
void loaded()
Definition: Image.cpp:22
This is a masked object resource.
Definition: MaskedObject.h:15
void WriteBool(bool value)
Writes a boolean value. In resource 1.0, booleans are stored as 32bit integers.
Definition: Writer.h:220
Type to store GID information.
Definition: GID.h:23
Containers::Collection< Base > children
Child objects that this resource object have.
Definition: Base.h:162
void WriteEnum32(E_ value)
Writes an enumeration as 32-bit integer to the stream.
Definition: Writer.h:140
void SetBase(A_ *value)
Sets the base provider, ownership semantics will not be changed.
Definition: MaskedObject.h:190
MaskedObject()
Creates a new empty masked object.
Definition: MaskedObject.h:42
static Image * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a image resource from the given file.
Definition: Image.cpp:9
void Destroy()
Definition: Bitmap.h:125
void WriteGID(GID::Type value)
Writes a GID to the given stream.
Definition: Writer.h:303
static void SaveThis(Writer &writer)
Definition: Null.cpp:14
Geometry::Size size
Size of the texture.
Definition: Texture.h:195
Containers::Image & GetData() const
Returns the data attached to this bitmap. If no data is present, this function throws.
Definition: Bitmap.h:168
static Null * LoadResource(std::weak_ptr< File > file, std::shared_ptr< Reader > reader, unsigned long size)
This function loads a line resource from the file.
Definition: Null.cpp:10
This resource contains images.
Definition: Image.h:23
Geometry::Size GetSize() const
Returns the size of the image.
Definition: Image.h:1291
bool load(std::shared_ptr< Reader > reader, unsigned long size, bool forceload)
Loads the image from the data stream.
Definition: Image.cpp:48
@ Unknown
An unknown error occurred.
Definition: Reader.h:22