restore image type pnm

This commit is contained in:
David Rose 2007-07-06 06:04:18 +00:00
parent 97bb4c2d8e
commit a1bc2a8c22
7 changed files with 1393 additions and 3 deletions

View File

@ -13,7 +13,8 @@
#define SOURCES \
config_pnmimagetypes.h pnmFileTypeAlias.h pnmFileTypeBMP.h \
pnmFileTypeIMG.h \
pnmFileTypePNG.cxx pnmFileTypePNG.h \
pnmFileTypePNG.h \
pnmFileTypePNM.h \
pnmFileTypeSGI.h pnmFileTypeSoftImage.h \
pnmFileTypeTGA.h \
pnmFileTypeTIFF.cxx pnmFileTypeTIFF.h \
@ -25,6 +26,8 @@
pnmFileTypeBMP.cxx \
pnmFileTypeIMG.cxx \
pnmFileTypeJPG.cxx pnmFileTypeJPGReader.cxx pnmFileTypeJPGWriter.cxx \
pnmFileTypePNG.cxx \
pnmFileTypePNM.cxx \
pnmFileTypeSGI.cxx \
pnmFileTypeSGIReader.cxx pnmFileTypeSGIWriter.cxx \
pnmFileTypeSoftImage.cxx \

View File

@ -25,6 +25,7 @@
#include "pnmFileTypeBMP.h"
#include "pnmFileTypeJPG.h"
#include "pnmFileTypePNG.h"
#include "pnmFileTypePNM.h"
#include "pnmFileTypeTIFF.h"
#include "sgi.h"
@ -43,6 +44,7 @@ NotifyCategoryDefName(pnmimage_soft, "soft", pnmimage_cat);
NotifyCategoryDefName(pnmimage_bmp, "bmp", pnmimage_cat);
NotifyCategoryDefName(pnmimage_jpg, "jpg", pnmimage_cat);
NotifyCategoryDefName(pnmimage_png, "png", pnmimage_cat);
NotifyCategoryDefName(pnmimage_pnm, "pnm", pnmimage_cat);
NotifyCategoryDefName(pnmimage_tiff, "tiff", pnmimage_cat);
ConfigVariableEnum<SGIStorageType> sgi_storage_type
@ -187,6 +189,7 @@ init_libpnmimagetypes() {
PNMFileTypeIMG::init_type();
PNMFileTypeSoftImage::init_type();
PNMFileTypeBMP::init_type();
PNMFileTypePNM::init_type();
#ifdef HAVE_JPEG
PNMFileTypeJPG::init_type();
#endif
@ -206,6 +209,7 @@ init_libpnmimagetypes() {
tr->register_type(new PNMFileTypeIMG);
tr->register_type(new PNMFileTypeSoftImage);
tr->register_type(new PNMFileTypeBMP);
tr->register_type(new PNMFileTypePNM);
#ifdef HAVE_JPEG
tr->register_type(new PNMFileTypeJPG);
#endif
@ -223,6 +227,7 @@ init_libpnmimagetypes() {
PNMFileTypeIMG::register_with_read_factory();
PNMFileTypeSoftImage::register_with_read_factory();
PNMFileTypeBMP::register_with_read_factory();
PNMFileTypePNM::register_with_read_factory();
#ifdef HAVE_JPEG
PNMFileTypeJPG::register_with_read_factory();
#endif

View File

@ -36,6 +36,7 @@ NotifyCategoryDecl(pnmimage_soft, EXPCL_PANDA, EXPTP_PANDA);
NotifyCategoryDecl(pnmimage_bmp, EXPCL_PANDA, EXPTP_PANDA);
NotifyCategoryDecl(pnmimage_jpg, EXPCL_PANDA, EXPTP_PANDA);
NotifyCategoryDecl(pnmimage_png, EXPCL_PANDA, EXPTP_PANDA);
NotifyCategoryDecl(pnmimage_pnm, EXPCL_PANDA, EXPTP_PANDA);
enum SGIStorageType {
SST_rle = STORAGE_RLE,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
// Filename: pnmFileTypePNM.h
// Created by: drose (17Jun00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved
//
// All use of this software is subject to the terms of the Panda 3d
// Software license. You should have received a copy of this license
// along with this source code; you will also find a current copy of
// the license at http://www.panda3d.org/license.txt .
//
// To contact the maintainers of this program write to
// panda3d@yahoogroups.com .
//
////////////////////////////////////////////////////////////////////
#ifndef PNMFILETYPEPNM_H
#define PNMFILETYPEPNM_H
#include "pandabase.h"
#include "pnmFileType.h"
#include "pnmReader.h"
#include "pnmWriter.h"
////////////////////////////////////////////////////////////////////
// Class : PNMFileTypePNM
// Description : For reading and writing basic PNM files--*.pbm,
// *.ppm, *.pnm.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA PNMFileTypePNM : public PNMFileType {
public:
PNMFileTypePNM();
virtual string get_name() const;
virtual int get_num_extensions() const;
virtual string get_extension(int n) const;
virtual string get_suggested_extension() const;
virtual bool has_magic_number() const;
virtual bool matches_magic_number(const string &magic_number) const;
virtual PNMReader *make_reader(istream *file, bool owns_file = true,
const string &magic_number = string());
virtual PNMWriter *make_writer(ostream *file, bool owns_file = true);
public:
class Reader : public PNMReader {
public:
Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number);
virtual bool supports_read_row() const;
virtual bool read_row(xel *array, xelval *alpha, int x_size, int y_size);
private:
int _ftype;
};
class Writer : public PNMWriter {
public:
Writer(PNMFileType *type, ostream *file, bool owns_file);
virtual bool supports_write_row() const;
virtual bool write_header();
virtual bool write_row(xel *array, xelval *alpha);
private:
int _pnm_format;
};
// The TypedWritable interface follows.
public:
static void register_with_read_factory();
protected:
static TypedWritable *make_PNMFileTypePNM(const FactoryParams &params);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
PNMFileType::init_type();
register_type(_type_handle, "PNMFileTypePNM",
PNMFileType::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
#endif

View File

@ -1,4 +1,3 @@
#include "config_pnmimagetypes.cxx"
#include "pnmFileTypeAlias.cxx"
#include "pnmFileTypeBMPReader.cxx"

View File

@ -1,4 +1,5 @@
#include "pnmFileTypePNG.cxx"
#include "pnmFileTypePNM.cxx"
#include "pnmFileTypeSGI.cxx"
#include "pnmFileTypeSGIReader.cxx"
#include "pnmFileTypeSGIWriter.cxx"