ArtRage (ptg) Format
Posted: Thu Jun 28, 2007 7:49 pm
Please support the ArtRage ptg format in a future release.
As always, thanks for listening!
As always, thanks for listening!
Various discussion boards for XnView and related products
https://newsgroup.xnview.com/
Ok, could you send me some samples? Do you have specifications?JohnFredC wrote:Please support the ArtRage ptg format in a future release.
Code: Select all
#define AR2_File_ProjectThumbnailImage 0x0ff003081
#define AR3_FilePreviewLargeOpaque 0x0ff003b00
#define PBX_File_CanvasColour 0x0ff003007
#define PBX_File_CanvasColourImage 0x0ff00300b
HBITMAP LoadThumbnail(LPCTSTR lpFileName)
{
if (lpFileName == NULL) return NULL;
FILE * cfFile = _wfsopen(lpFileName, L"rb", _SH_DENYNO);
CPNGReader pngReader;
if (cfFile) {
char csHeader[] = "Ambient Design Project file. ";
char csVersion[] = "ArtRage 2";
char csVersion1A[] = "ArtRage";
char csVersion1B[] = "Paintbox";
char buf[200];
memset(buf, 0, sizeof(buf));
fread(buf, sizeof(csHeader) - 1, 1, cfFile);
if (strcmp(csHeader, buf) == 0) {
fread(buf, 2, 1, cfFile); // Spare byte.
memset(buf, 0, sizeof(buf));
fpos_t posVersion;
fgetpos(cfFile, &posVersion);
fread(buf, sizeof(csVersion) - 1, 1, cfFile);
UINT nVersion = 0;
if (strcmp(csVersion, buf) == 0) {
nVersion = 2;
posVersion += sizeof(csVersion); // Advance past the ArtRage 2 version string
}
else if (strncmp(csVersion1A, buf, sizeof(csVersion1A) - 1) == 0) { // Version 1 string "ArtRage"
nVersion = 1;
posVersion += sizeof(csVersion1A); // Advance past the ArtRage 2 version string
}
else if (strncmp(csVersion1B, buf, sizeof(csVersion1B) - 1) == 0) { // Version 1 string "Paintbox"
nVersion = 1;
posVersion += sizeof(csVersion1B); // Advance past the ArtRage 2 version string
}
if (nVersion > 0) { // We found a version string
_fseeki64(cfFile, posVersion + 5, SEEK_SET); // Move to next block (allowing for already-read data
// Parse blocks, looking for Thumbnail block
fpos_t pos;
fgetpos(cfFile, &pos);
UINT64 nFileSize = _filelengthi64(_fileno(cfFile));
UINT64 nFilePos = pos;
UINT nBlockID = 0;
UINT64 nBlockSize = 0;
while (nFilePos < nFileSize - 4) { // Read in the project information.
// Find and process the block.
fread(&nBlockID, sizeof(UINT), 1, cfFile);
fread(&nBlockSize, sizeof(UINT64), 1, cfFile);
if (nBlockSize <1> nFileSize) break; // 'nother silly block.
// Check for paper-colour block
if (nVersion == 1 && nBlockID == PBX_File_CanvasColour) { // Found the paper-colour block
UINT32 pxColour;
fread(&pxColour, sizeof(pxColour), 1, cfFile); // Read in the colour
pngReader.SetPaperColour(pxColour); // Set the paper colour.
}
// Look for Thumbnail block.
else if ((nVersion == 2 && (nBlockID == AR2_File_ProjectThumbnailImage // Thumbnail block found.
|| nBlockID == AR3_FilePreviewLargeOpaque)) // Full-sized preview block found.
||(nVersion == 1 && nBlockID == PBX_File_CanvasColourImage)) { // Colour Map from ArtRage 1 found.
// Read in the PNG image.
char * pMem = NULL;
// cfFile is now pointing to a PNG inlined into the project file. Use something to read PNG from this point.
if (pngReader.ReadImage(cfFile, pMem, nWidth, nHeight)) {
if (nWidth <= 8 || nHeight <8> 100000 || nHeight > 100000) break; // Cabbage out for silly values.
// ***** Do something with the image data
}
if (pMem) free(pMem);
break; // Dont need to search the rest of the project file.
}
// Ensure the file is in the correct position for the next block. Unknown blocks are ignored.
_fseeki64(cfFile, nFilePos + nBlockSize + 12, SEEK_SET); // Move to next block (allowing for already-read data
fgetpos(cfFile, &pos);
nFilePos = pos; // Get the current file location.
}
}
}
fclose(cfFile);
}
return NULL;
}
You have ArtRage support in 1.93!Troken wrote:Any news on this? Will XnView support ArtRage .PTG? I surely support this suggestion. Latest message here was july 2007, and the 1.93.4 does not seem to support to .PTG
Hm... I can not see that it works. I checked the options -> system integration -> associations but I can not find ArtRage (.ptg) in the list. Tried on two different computers (one Vista and one XP).xnview wrote:You have ArtRage support in 1.93!Troken wrote:Any news on this? Will XnView support ArtRage .PTG? I surely support this suggestion. Latest message here was july 2007, and the 1.93.4 does not seem to support to .PTG
Do you have enabled option/Genral/Display all formats?Troken wrote:Hm... I can not see that it works. I checked the options -> system integration -> associations but I can not find ArtRage (.ptg) in the list. Tried on two different computers (one Vista and one XP).xnview wrote:You have ArtRage support in 1.93!Troken wrote:Any news on this? Will XnView support ArtRage .PTG? I surely support this suggestion. Latest message here was july 2007, and the 1.93.4 does not seem to support to .PTG
Is it just me or has somebody else also problems with this?
EDIT: I use ArtRage starter edition, the free version - but I dont think it should matter.
Nooo...xnview wrote:Do you have enabled option/Genral/Display all formats?Troken wrote:Hm... I can not see that it works. I checked the options -> system integration -> associations but I can not find ArtRage (.ptg) in the list. Tried on two different computers (one Vista and one XP).xnview wrote: You have ArtRage support in 1.93!
Is it just me or has somebody else also problems with this?
EDIT: I use ArtRage starter edition, the free version - but I dont think it should matter.
How come this is not enabled by default?xnview wrote:Do you have enabled option/Genral/Display all formats?