Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

bezier.hpp

00001 /*****************************************************************************
00002  * bezier.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: bezier.hpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef BEZIER_HPP
00026 #define BEZIER_HPP
00027 
00028 #include "../src/skin_common.hpp"
00029 #include "pointer.hpp"
00030 #include <vector>
00031 
00032 #define MAX_BEZIER_POINT 1023
00033 
00034 
00036 class Bezier: public SkinObject
00037 {
00038     public:
00041         typedef enum
00042         {
00043             kCoordsBoth,    // x or y must be different (default)
00044             kCoordsX,       // only x is different
00045             kCoordsY        // only y is different
00046         } Flag_t;
00047 
00048         Bezier( intf_thread_t *p_intf,
00049                 const vector<float> &pAbscissas,
00050                 const vector<float> &pOrdinates,
00051                 Flag_t flag = kCoordsBoth );
00052         ~Bezier() {}
00053 
00055         int getNbCtrlPoints() const { return m_nbCtrlPt; }
00056 
00059         float getNearestPercent( int x, int y ) const;
00060 
00062         float getMinDist( int x, int y ) const;
00063 
00066         void getPoint( float t, int &x, int &y ) const;
00067 
00069         int getWidth() const;
00070 
00072         int getHeight() const;
00073 
00074     private:
00076         int m_nbCtrlPt;
00078         vector<float> m_ptx;
00079         vector<float> m_pty;
00081         vector<float> m_ft;
00082 
00084         int m_nbPoints;
00086         vector<int> m_leftVect;
00087         vector<int> m_topVect;
00089         vector<float> m_percVect;
00090 
00092         int findNearestPoint( int x, int y ) const;
00095         void computePoint( float t, int &x, int &y ) const;
00097         inline float computeCoeff( int i, int n, float t ) const;
00099         inline float power( float x, int n ) const;
00100 };
00101 
00102 
00103 typedef CountedPtr<Bezier> BezierPtr;
00104 
00105 #endif

Generated on Tue Dec 20 10:14:43 2005 for vlc-0.8.4a by  doxygen 1.4.2