mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Merge pull request #1354 from ONLYOFFICE/feature/graphics-pict
Feature/graphics pict
This commit is contained in:
@ -37,6 +37,7 @@
|
||||
#define CXIMAGE_SUPPORT_PGX 1
|
||||
#define CXIMAGE_SUPPORT_PNM 1
|
||||
#define CXIMAGE_SUPPORT_RAS 1
|
||||
#define CXIMAGE_SUPPORT_PIC 1
|
||||
|
||||
#define CXIMAGE_SUPPORT_JBG 0 // GPL'd see ../jbig/copying.txt & ../jbig/patents.htm
|
||||
|
||||
|
||||
@ -130,10 +130,13 @@ CXIMAGE_FORMAT_RAW = 19,
|
||||
#if CXIMAGE_SUPPORT_PSD
|
||||
CXIMAGE_FORMAT_PSD = 20,
|
||||
#endif
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
CXIMAGE_FORMAR_PIC = 25,
|
||||
#endif
|
||||
CMAX_IMAGE_FORMATS = CXIMAGE_SUPPORT_BMP + CXIMAGE_SUPPORT_GIF + CXIMAGE_SUPPORT_JPG +
|
||||
CXIMAGE_SUPPORT_PNG + CXIMAGE_SUPPORT_MNG + CXIMAGE_SUPPORT_ICO +
|
||||
CXIMAGE_SUPPORT_TIF + CXIMAGE_SUPPORT_TGA + CXIMAGE_SUPPORT_PCX +
|
||||
CXIMAGE_SUPPORT_WBMP+ CXIMAGE_SUPPORT_WMF +
|
||||
CXIMAGE_SUPPORT_WBMP+ CXIMAGE_SUPPORT_WMF + CXIMAGE_SUPPORT_PIC +
|
||||
CXIMAGE_SUPPORT_JBG + CXIMAGE_SUPPORT_JP2 + CXIMAGE_SUPPORT_JPC +
|
||||
CXIMAGE_SUPPORT_PGX + CXIMAGE_SUPPORT_PNM + CXIMAGE_SUPPORT_RAS +
|
||||
CXIMAGE_SUPPORT_SKA + CXIMAGE_SUPPORT_RAW + CXIMAGE_SUPPORT_PSD + 1
|
||||
|
||||
@ -41,7 +41,7 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
$$PWD/../../graphics/Image.cpp \
|
||||
$$PWD/../../raster/BgraFrame.cpp \
|
||||
$$PWD/../../raster/ImageFileFormatChecker.cpp
|
||||
$$PWD/../../raster/ImageFileFormatChecker.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jpeg/wrtarga.c \
|
||||
@ -273,6 +273,10 @@ SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/Jp2/Reader.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/JBig2/source/JBig2File.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/PICFile.cpp \
|
||||
$$LIB_GRAPHICS_PRI_PATH/raster/PICT/pic.cpp
|
||||
|
||||
SOURCES += \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_cm.c \
|
||||
$$LIB_GRAPHICS_PRI_PATH/cximage/jasper/base/jas_debug.c \
|
||||
|
||||
26
DesktopEditor/graphics/tests/TestPICT/TestPICT.pro
Normal file
26
DesktopEditor/graphics/tests/TestPICT/TestPICT.pro
Normal file
@ -0,0 +1,26 @@
|
||||
#CONFIG += c++11 cmdline
|
||||
|
||||
#SOURCES += \
|
||||
QT -= core
|
||||
|
||||
QT -= gui
|
||||
|
||||
TARGET = test
|
||||
CONFIG += console
|
||||
TEMPLATE = app
|
||||
|
||||
CORE_ROOT_DIR = $$PWD/../../../..
|
||||
PWD_ROOT_DIR = $$PWD
|
||||
include($$CORE_ROOT_DIR/Common/base.pri)
|
||||
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
|
||||
|
||||
ADD_DEPENDENCY(kernel, graphics, UnicodeConverter)
|
||||
|
||||
GRAPHICS_AGG_PATH = $$PWD/../../../agg-2.4
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$GRAPHICS_AGG_PATH/include
|
||||
|
||||
SOURCES += main.cpp
|
||||
|
||||
DESTDIR = $$PWD_ROOT_DIR/build/$$CORE_BUILDS_PLATFORM_PREFIX/$$CORE_BUILDS_CONFIGURATION_PREFIX
|
||||
11
DesktopEditor/graphics/tests/TestPICT/main.cpp
Normal file
11
DesktopEditor/graphics/tests/TestPICT/main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <codecvt>
|
||||
|
||||
#include "../../pro/Graphics.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Aggplus::CImage Cimg(std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(argv[1]));
|
||||
Cimg.SaveFile(std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(argv[2]), 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -40,6 +40,10 @@
|
||||
#include "JBig2/source/JBig2File.h"
|
||||
#endif
|
||||
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
#include "PICT/PICFile.h"
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#define BGRA_FRAME_CXIMAGE_MAX_MEMORY 67108864 // 256Mb (*4 channel)
|
||||
|
||||
@ -439,6 +443,14 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
if (CXIMAGE_FORMAR_PIC == m_nFileType)
|
||||
{
|
||||
PICT::CPictFile PIC;
|
||||
return PIC.Open(this, strFileName, !m_bIsRGBA);
|
||||
}
|
||||
#endif
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.OpenFile(strFileName))
|
||||
return false;
|
||||
@ -514,6 +526,14 @@ bool CBgraFrame::Decode(BYTE* pBuffer, int nSize, unsigned int nFileType)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CXIMAGE_SUPPORT_PIC
|
||||
if (CXIMAGE_FORMAR_PIC == m_nFileType)
|
||||
{
|
||||
PICT::CPictFile PIC;
|
||||
return PIC.Open(this, pBuffer, nSize, !m_bIsRGBA);
|
||||
}
|
||||
#endif
|
||||
|
||||
CxImage img;
|
||||
|
||||
if (!img.Decode(pBuffer, nSize, m_nFileType))
|
||||
|
||||
@ -412,6 +412,26 @@ bool CImageFileFormatChecker::isIpodFile(BYTE* pBuffer,DWORD dwBytes)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CImageFileFormatChecker::isPicFile(BYTE *pBuffer, DWORD dwBytes)
|
||||
{
|
||||
if (dwBytes < 12)
|
||||
return false;
|
||||
|
||||
if (memcmp(pBuffer, "PICT", 4) == 0)
|
||||
return true;
|
||||
|
||||
if (memcmp(pBuffer + 10, "\000\021\002\377\014\000", 6) == 0)
|
||||
return true;
|
||||
|
||||
if (dwBytes < 528)
|
||||
return false;
|
||||
|
||||
if (memcmp(pBuffer + 522, "\000\021\002\377\014\000", 6) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
|
||||
{
|
||||
@ -530,6 +550,10 @@ bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
|
||||
}
|
||||
else if (isPicFile(buffer, sizeRead))
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_PIC;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
delete [] buffer;
|
||||
|
||||
@ -641,7 +665,11 @@ bool CImageFileFormatChecker::isImageFile(BYTE* buffer, DWORD sizeRead)
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_UNKNOWN;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
if (isPicFile(buffer, sizeRead))
|
||||
{
|
||||
eFileType = _CXIMAGE_FORMAT_PIC;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
if (eFileType) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ enum __ENUM_CXIMAGE_FORMATS
|
||||
_CXIMAGE_FORMAT_WB = 22,
|
||||
_CXIMAGE_FORMAT_SVM = 23,
|
||||
_CXIMAGE_FORMAT_SVG = 24,
|
||||
_CXIMAGE_FORMAT_PIC = 25,
|
||||
};
|
||||
|
||||
class GRAPHICS_DECL CImageFileFormatChecker
|
||||
@ -109,6 +110,7 @@ public:
|
||||
bool isPgxFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isSvgFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isRawFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
bool isPicFile(BYTE* pBuffer,DWORD dwBytes);
|
||||
|
||||
std::wstring DetectFormatByData(BYTE *Data, int DataSize);
|
||||
|
||||
|
||||
106
DesktopEditor/raster/PICT/PICFile.cpp
Normal file
106
DesktopEditor/raster/PICT/PICFile.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
#include "PICFile.h"
|
||||
#include "pic.h"
|
||||
|
||||
#include "../../common/File.h"
|
||||
|
||||
namespace PICT {
|
||||
|
||||
bool ImageToFrame(ImagePICT* pImage, CBgraFrame* pFrame, bool isRGBA) {
|
||||
int nWidth = pImage->m_nWidth;
|
||||
int nHeight = pImage->m_nHeight;
|
||||
int BufferSize = 4 * nWidth * nHeight;
|
||||
|
||||
if (BufferSize < 1)
|
||||
return false;
|
||||
|
||||
pFrame->put_Height(nHeight);
|
||||
pFrame->put_Width(nWidth);
|
||||
pFrame->put_Stride(4 * nWidth);
|
||||
|
||||
BYTE* pData = new BYTE[BufferSize];
|
||||
|
||||
if (!pData)
|
||||
return false;
|
||||
|
||||
pFrame->put_Data(pData);
|
||||
|
||||
unsigned char* pBufferPtr = (unsigned char*)pData;
|
||||
|
||||
unsigned int indR = isRGBA ? 2 : 0;
|
||||
unsigned int indG = 1;
|
||||
unsigned int indB = isRGBA ? 0 : 2;
|
||||
|
||||
for (int i = 0; i < pImage->m_nHeight; i++)
|
||||
{
|
||||
unsigned char* q = pImage->ppixels + pImage->number_channels * (i * pImage->m_nWidth);
|
||||
for (int j = 0; j < pImage->m_nWidth; j++)
|
||||
{
|
||||
pBufferPtr[indR] = *(q + 2);
|
||||
pBufferPtr[indG] = *(q + 1);
|
||||
pBufferPtr[indB] = *q;
|
||||
pBufferPtr[3] = *(q + 3);
|
||||
q += 4;
|
||||
pBufferPtr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool CPictFile::Open(CBgraFrame *pFrame, const std::wstring &strFileName, bool isRGBA) {
|
||||
ImagePICT* pImage = new ImagePICT;
|
||||
|
||||
AquireImage(pImage);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.OpenFile(strFileName))
|
||||
return false;
|
||||
|
||||
if (DecodePICT(oFile.GetFileNative(), pImage))
|
||||
{
|
||||
bool status = ImageToFrame(pImage, pFrame, isRGBA);
|
||||
DestroyImage(pImage);
|
||||
oFile.CloseFile();
|
||||
|
||||
return status;
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImage(pImage);
|
||||
oFile.CloseFile();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CPictFile::Open(CBgraFrame *pFrame, BYTE *pBuffer, int nSize, bool isRGBA) {
|
||||
ImagePICT* pImage = new ImagePICT;
|
||||
|
||||
AquireImage(pImage);
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.CreateTempFile())
|
||||
return false;
|
||||
|
||||
oFile.WriteFile(pBuffer, nSize);
|
||||
oFile.SetPosition(0);
|
||||
|
||||
if (DecodePICT(oFile.GetFileNative(), pImage))
|
||||
{
|
||||
bool status = ImageToFrame(pImage, pFrame, isRGBA);
|
||||
DestroyImage(pImage);
|
||||
oFile.CloseFile();
|
||||
|
||||
return status;
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyImage(pImage);
|
||||
oFile.CloseFile();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
DesktopEditor/raster/PICT/PICFile.h
Normal file
14
DesktopEditor/raster/PICT/PICFile.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef PICFILE_H
|
||||
#define PICFILE_H
|
||||
|
||||
#include "../BgraFrame.h"
|
||||
|
||||
namespace PICT {
|
||||
class GRAPHICS_DECL CPictFile {
|
||||
public:
|
||||
bool Open(CBgraFrame* pFrame, const std::wstring& strFileName, bool isRGBA);
|
||||
bool Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, bool isRGBA);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PICFILE_H
|
||||
3314
DesktopEditor/raster/PICT/pic.cpp
Normal file
3314
DesktopEditor/raster/PICT/pic.cpp
Normal file
File diff suppressed because it is too large
Load Diff
441
DesktopEditor/raster/PICT/pic.h
Normal file
441
DesktopEditor/raster/PICT/pic.h
Normal file
@ -0,0 +1,441 @@
|
||||
#ifndef PIC_H
|
||||
#define PIC_H
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <cstddef>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef long long ssize_t ;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedType,
|
||||
BilevelType,
|
||||
GrayscaleType,
|
||||
GrayscaleAlphaType,
|
||||
PaletteType,
|
||||
PaletteAlphaType,
|
||||
TrueColorType,
|
||||
TrueColorAlphaType,
|
||||
ColorSeparationType,
|
||||
ColorSeparationAlphaType,
|
||||
OptimizeType,
|
||||
PaletteBilevelAlphaType
|
||||
} ImageType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char
|
||||
*path;
|
||||
|
||||
unsigned char
|
||||
*datum;
|
||||
|
||||
size_t
|
||||
length,
|
||||
signature;
|
||||
|
||||
char
|
||||
*name;
|
||||
} StringInfo;
|
||||
|
||||
typedef struct _NodeInfo
|
||||
{
|
||||
void
|
||||
*key;
|
||||
|
||||
void
|
||||
*value;
|
||||
|
||||
struct _NodeInfo
|
||||
*left,
|
||||
*right;
|
||||
} NodeInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
NodeInfo
|
||||
*root;
|
||||
|
||||
int
|
||||
(*compare)(const void *,const void *);
|
||||
|
||||
int
|
||||
balance;
|
||||
|
||||
void
|
||||
*key,
|
||||
*next;
|
||||
|
||||
size_t
|
||||
nodes;
|
||||
|
||||
size_t
|
||||
signature;
|
||||
} SplayTreeInfo;
|
||||
|
||||
typedef struct _PrimaryInfo
|
||||
{
|
||||
double
|
||||
x,
|
||||
y,
|
||||
z;
|
||||
} PrimaryInfo;
|
||||
|
||||
typedef struct _ChromaticityInfo
|
||||
{
|
||||
PrimaryInfo
|
||||
red_primary,
|
||||
green_primary,
|
||||
blue_primary,
|
||||
white_point;
|
||||
} ChromaticityInfo;
|
||||
|
||||
typedef struct _PICTCode
|
||||
{
|
||||
const char
|
||||
*name;
|
||||
|
||||
ssize_t
|
||||
length;
|
||||
|
||||
const char
|
||||
*description;
|
||||
} PICTCode;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short
|
||||
top,
|
||||
left,
|
||||
bottom,
|
||||
right;
|
||||
} PICTrectangle;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short
|
||||
version,
|
||||
pack_type;
|
||||
|
||||
size_t
|
||||
pack_size,
|
||||
horizontal_resolution,
|
||||
vertical_resolution;
|
||||
|
||||
short
|
||||
pixel_type,
|
||||
bits_per_pixel,
|
||||
component_count,
|
||||
component_size;
|
||||
|
||||
size_t
|
||||
plane_bytes,
|
||||
table,
|
||||
reserved;
|
||||
} PICTPixmap;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t
|
||||
width,
|
||||
height;
|
||||
|
||||
ssize_t
|
||||
x,
|
||||
y;
|
||||
} RectangleInfo;
|
||||
|
||||
typedef struct _NexusInfo
|
||||
{
|
||||
RectangleInfo
|
||||
region;
|
||||
|
||||
size_t
|
||||
length;
|
||||
|
||||
unsigned char
|
||||
*pixels;
|
||||
|
||||
int
|
||||
authentic_pixel_cache;
|
||||
|
||||
size_t
|
||||
signature;
|
||||
|
||||
struct _NexusInfo
|
||||
*virtual_nexus;
|
||||
} NexusInfo;
|
||||
|
||||
|
||||
|
||||
typedef struct _GeometryInfo
|
||||
{
|
||||
double
|
||||
rho,
|
||||
sigma,
|
||||
xi,
|
||||
psi,
|
||||
chi;
|
||||
} GeometryInfo;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedChannel = 0x0000,
|
||||
RedChannel = 0x0001,
|
||||
GrayChannel = 0x0001,
|
||||
CyanChannel = 0x0001,
|
||||
LChannel = 0x0001,
|
||||
GreenChannel = 0x0002,
|
||||
MagentaChannel = 0x0002,
|
||||
aChannel = 0x0002,
|
||||
BlueChannel = 0x0004,
|
||||
bChannel = 0x0002,
|
||||
YellowChannel = 0x0004,
|
||||
BlackChannel = 0x0008,
|
||||
AlphaChannel = 0x0010,
|
||||
OpacityChannel = 0x0010,
|
||||
IndexChannel = 0x0020, /* Color Index Table? */
|
||||
ReadMaskChannel = 0x0040, /* Pixel is Not Readable? */
|
||||
WriteMaskChannel = 0x0080, /* Pixel is Write Protected? */
|
||||
MetaChannel = 0x0100, /* not used */
|
||||
CompositeMaskChannel = 0x0200, /* SVG mask */
|
||||
CompositeChannels = 0x001F,
|
||||
AllChannels = 0X7FFFFFF,
|
||||
/*
|
||||
Special purpose channel types.
|
||||
FUTURE: are these needed any more - they are more like hacks
|
||||
SyncChannels for example is NOT a real channel but a 'flag'
|
||||
It really says -- "User has not defined channels"
|
||||
Though it does have extra meaning in the "-auto-level" operator
|
||||
*/
|
||||
TrueAlphaChannel = 0x0100, /* extract actual alpha channel from opacity */
|
||||
RGBChannels = 0x0200, /* set alpha from grayscale mask in RGB */
|
||||
GrayChannels = 0x0400,
|
||||
SyncChannels = 0x20000, /* channels modified as a single unit */
|
||||
DefaultChannels = AllChannels
|
||||
} ChannelType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ReadMode,
|
||||
WriteMode,
|
||||
IOMode,
|
||||
PersistMode
|
||||
} MapMode;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedClass,
|
||||
DirectClass,
|
||||
PseudoClass
|
||||
} ClassType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedColorspace,
|
||||
CMYColorspace, /* negated linear RGB colorspace */
|
||||
CMYKColorspace, /* CMY with Black separation */
|
||||
GRAYColorspace, /* Single Channel greyscale (non-linear) image */
|
||||
HCLColorspace,
|
||||
HCLpColorspace,
|
||||
HSBColorspace,
|
||||
HSIColorspace,
|
||||
HSLColorspace,
|
||||
HSVColorspace, /* alias for HSB */
|
||||
HWBColorspace,
|
||||
LabColorspace,
|
||||
LCHColorspace, /* alias for LCHuv */
|
||||
LCHabColorspace, /* Cylindrical (Polar) Lab */
|
||||
LCHuvColorspace, /* Cylindrical (Polar) Luv */
|
||||
LogColorspace,
|
||||
LMSColorspace,
|
||||
LuvColorspace,
|
||||
OHTAColorspace,
|
||||
Rec601YCbCrColorspace,
|
||||
Rec709YCbCrColorspace,
|
||||
RGBColorspace, /* Linear RGB colorspace */
|
||||
scRGBColorspace, /* ??? */
|
||||
sRGBColorspace, /* Default: non-linear sRGB colorspace */
|
||||
TransparentColorspace,
|
||||
xyYColorspace,
|
||||
XYZColorspace, /* IEEE Color Reference colorspace */
|
||||
YCbCrColorspace,
|
||||
YCCColorspace,
|
||||
YDbDrColorspace,
|
||||
YIQColorspace,
|
||||
YPbPrColorspace,
|
||||
YUVColorspace,
|
||||
LinearGRAYColorspace, /* Single Channel greyscale (linear) image */
|
||||
JzazbzColorspace,
|
||||
DisplayP3Colorspace,
|
||||
Adobe98Colorspace,
|
||||
ProPhotoColorspace,
|
||||
OklabColorspace,
|
||||
OklchColorspace
|
||||
} ColorspaceType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedPixelTrait = 0x000000,
|
||||
CopyPixelTrait = 0x000001,
|
||||
UpdatePixelTrait = 0x000002,
|
||||
BlendPixelTrait = 0x000004
|
||||
} PixelTrait;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UndefinedPixelChannel = 0,
|
||||
RedPixelChannel = 0,
|
||||
CyanPixelChannel = 0,
|
||||
GrayPixelChannel = 0,
|
||||
LPixelChannel = 0,
|
||||
LabelPixelChannel = 0,
|
||||
YPixelChannel = 0,
|
||||
aPixelChannel = 1,
|
||||
GreenPixelChannel = 1,
|
||||
MagentaPixelChannel = 1,
|
||||
CbPixelChannel = 1,
|
||||
bPixelChannel = 2,
|
||||
BluePixelChannel = 2,
|
||||
YellowPixelChannel = 2,
|
||||
CrPixelChannel = 2,
|
||||
BlackPixelChannel = 3,
|
||||
AlphaPixelChannel = 4,
|
||||
IndexPixelChannel = 5,
|
||||
ReadMaskPixelChannel = 6,
|
||||
WriteMaskPixelChannel = 7,
|
||||
MetaPixelChannel = 8, /* deprecated */
|
||||
CompositeMaskPixelChannel = 9,
|
||||
MetaPixelChannels = 10,
|
||||
IntensityPixelChannel = 64, /* ???? */
|
||||
CompositePixelChannel = 64, /* ???? */
|
||||
SyncPixelChannel = 65 /* not a real channel */
|
||||
} PixelChannel;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PixelChannel
|
||||
channel;
|
||||
|
||||
PixelTrait
|
||||
traits;
|
||||
|
||||
ssize_t
|
||||
offset;
|
||||
} PixelChannelMap;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ClassType
|
||||
storage_class;
|
||||
|
||||
ColorspaceType
|
||||
colorspace;
|
||||
|
||||
PixelTrait
|
||||
alpha_trait;
|
||||
|
||||
double
|
||||
fuzz;
|
||||
|
||||
size_t
|
||||
depth,
|
||||
count;
|
||||
|
||||
double
|
||||
red,
|
||||
green,
|
||||
blue,
|
||||
black,
|
||||
alpha,
|
||||
index;
|
||||
} PixelInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ClassType
|
||||
storage_class;
|
||||
|
||||
ColorspaceType
|
||||
colorspace;
|
||||
|
||||
ChromaticityInfo
|
||||
chromaticity;
|
||||
|
||||
int
|
||||
m_pctVersion;
|
||||
|
||||
size_t
|
||||
m_nHeight,
|
||||
m_nWidth,
|
||||
m_ndepth,
|
||||
m_nPixelsSize,
|
||||
colors;
|
||||
|
||||
SplayTreeInfo
|
||||
*profiles,
|
||||
*artifacts;
|
||||
|
||||
double
|
||||
fuzz;
|
||||
|
||||
unsigned char
|
||||
*ppixels;
|
||||
|
||||
double
|
||||
resolutionX,
|
||||
resolutionY,
|
||||
gamma;
|
||||
|
||||
ImageType
|
||||
type;
|
||||
|
||||
PixelInfo
|
||||
background_color,
|
||||
*colormap;
|
||||
|
||||
PixelTrait
|
||||
alpha_trait;
|
||||
|
||||
NexusInfo
|
||||
*nexus;
|
||||
|
||||
PixelChannelMap
|
||||
*channel_map;
|
||||
|
||||
PixelTrait
|
||||
mask_trait;
|
||||
|
||||
int
|
||||
taint;
|
||||
|
||||
void
|
||||
*cache;
|
||||
|
||||
size_t
|
||||
number_channels;
|
||||
|
||||
char
|
||||
error[256];
|
||||
}ImagePICT;
|
||||
|
||||
int DecodePICT(FILE* hFile, ImagePICT* image);
|
||||
void AquireImage(ImagePICT* image);
|
||||
ImagePICT *DestroyImage(ImagePICT *image);
|
||||
|
||||
#endif // PIC_H
|
||||
Reference in New Issue
Block a user