new file format with versioning and layer opacity
This commit is contained in:
43
src/canvas.h
43
src/canvas.h
@@ -42,6 +42,49 @@ public:
|
||||
void destroy();
|
||||
};
|
||||
|
||||
struct PPIThumb
|
||||
{
|
||||
int width = 128;
|
||||
int height = 128;
|
||||
int comp = 4;
|
||||
bool valid() const
|
||||
{
|
||||
return (width == 128 && height == 128 && comp == 4);
|
||||
}
|
||||
};
|
||||
|
||||
struct PPIDocVersion
|
||||
{
|
||||
int major = 0;
|
||||
int minor = 1;
|
||||
};
|
||||
|
||||
struct PPISoftVersion
|
||||
{
|
||||
int major = g_version_major;
|
||||
int minor = g_version_minor;
|
||||
int fix = g_version_fix;
|
||||
int build = g_version_build;
|
||||
};
|
||||
|
||||
struct PPIHeader
|
||||
{
|
||||
char magic[4]{ 'P', 'P', 'I', 0 };
|
||||
PPIDocVersion doc_version;
|
||||
PPISoftVersion soft_version;
|
||||
PPIThumb thumb_header;
|
||||
bool valid()
|
||||
{
|
||||
if (strcmp(magic, "PPI") != 0)
|
||||
return false;
|
||||
if (doc_version.major != 0 || doc_version.minor != 1)
|
||||
return false;
|
||||
if (!thumb_header.valid())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class Canvas
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user