Updating the changelog in the VERSION file, and version_sync.
[shapes.git] / source / pdffunctiontypes.h
blobe62c58683b6c88fedc7b8f9cf190165ad44cb47d
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 #pragma once
21 #include "functiontypes.h"
22 #include "simplepdfo.h"
23 #include <memory>
25 namespace Shapes
27 namespace Lang
30 class PDF_Function : public Lang::Function
32 public:
33 typedef enum { INTERPOLATION = 0, EXPONENTIAL, STITCHING, CALCULATOR } SubType;
34 private:
35 SubType subType_;
36 protected:
37 const size_t outputDimension_;
38 const size_t inputDimension_;
39 const bool rangeIsActive_;
40 std::vector< std::pair< double, double > > domain_;
41 std::vector< std::pair< double, double > > range_;
42 RefCountPtr< SimplePDF::PDF_Indirect_out > storage;
44 const char * title_;
46 void addCommonFields( SimplePDF::PDF_Dictionary * dst ) const;
47 virtual std::auto_ptr< const std::vector< double > > callImpl( const std::vector< double > & arg ) const;
48 public:
49 PDF_Function( SubType subType, size_t outputDimension, size_t inputDimension, bool rangeIsActive );
50 virtual ~PDF_Function( );
51 virtual void gcMark( Kernel::GCMarkedSet & marked ){ };
52 virtual void call( Kernel::EvalState * evalState, Kernel::Arguments & args, const Ast::SourceLocation & callLoc ) const;
53 virtual bool isTransforming( ) const { return false; }
54 bool matchesDimensions( size_t outputDimension, size_t inputDimension ) const;
55 RefCountPtr< SimplePDF::PDF_Indirect_out > getFunction( ) const;
58 class PDF_InterpolationFunction : public Lang::PDF_Function
60 public:
61 PDF_InterpolationFunction( const std::vector< std::pair< double, double > > & range,
62 const std::vector< std::pair< double, double > > & domain,
63 const std::vector< double > & size,
64 unsigned char bitsPerSample,
65 bool cubic,
66 const std::vector< std::pair< double, double > > & encode,
67 const std::vector< std::pair< double, double > > & decode,
68 const std::vector< double > table );
69 ~PDF_InterpolationFunction( );