Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Image.h

00001 //
00002 // OpenVRML
00003 //
00004 // Copyright (C) 1998  Chris Morley
00005 // 
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 // 
00020 
00021 # ifndef IMAGE_H
00022 #   define IMAGE_H
00023 
00024 # include <stddef.h>
00025 # include "common.h"
00026 
00027 namespace OpenVRML {
00028 
00029     class Doc;
00030     class Doc2;
00031     class MFString;
00032 
00036     class OPENVRML_SCOPE Image {
00037         Doc * d_url;
00038         int d_w, d_h, d_nc, d_nFrames;
00039         unsigned char *d_pixels;
00040         unsigned char **d_frame;
00041 
00042     public:
00043         Image();
00044         ~Image();
00045 
00046         bool setURL(const char * url, const Doc2 * relative = 0);
00047 
00048         bool tryURLs(const MFString & urls, const Doc2 * relative = 0);
00049 
00050         const char *url();
00051 
00052         int w()                 { return d_w; }
00053         int h()                 { return d_h; }
00054         int nc()                        { return d_nc; }
00055         int nFrames()                   { return d_nFrames; }
00056         unsigned char *pixels() { return d_pixels; }
00057         unsigned char *pixels(int frame);
00058 
00059         void setSize(int w, int h)      { d_w = w; d_h = h; }
00060     };
00061 }
00062 
00063 #endif