|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TOFFLINEGL_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define TOFFLINEGL_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
262a92 |
#include <memory></memory>
|
|
Shinya Kitaoka |
262a92 |
|
|
Toshihiro Shimizu |
890ddd |
#include "tgl.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TVRENDER_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TVectorRenderData;
|
|
Toshihiro Shimizu |
890ddd |
class TVectorImageP;
|
|
Toshihiro Shimizu |
890ddd |
class TRasterImageP;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TGLContextManager
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
virtual void store() = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void restore() = 0;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TOfflineGL
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
class Imp
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
int m_lx, m_ly;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
Imp(int lx, int ly) : m_lx(lx), m_ly(ly) {}
|
|
Toshihiro Shimizu |
890ddd |
virtual ~Imp(){};
|
|
Toshihiro Shimizu |
890ddd |
virtual void makeCurrent() = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void doneCurrent() = 0; // Da implementare in Imp
|
|
Shinya Kitaoka |
262a92 |
virtual void createContext(TDimension rasterSize, std::shared_ptr<imp> shared) = 0;</imp>
|
|
Toshihiro Shimizu |
890ddd |
virtual void getRaster(TRaster32P) = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual int getLx() const { return m_lx; }
|
|
Toshihiro Shimizu |
890ddd |
virtual int getLy() const { return m_ly; }
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Shinya Kitaoka |
262a92 |
typedef std::shared_ptr<imp> ImpGenerator(const TDimension &dim, std::shared_ptr<imp> shared);</imp></imp>
|
|
Toshihiro Shimizu |
890ddd |
static ImpGenerator *defineImpGenerator(ImpGenerator *impGenerator);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TOfflineGL(TDimension dim, const TOfflineGL *shared = 0);
|
|
Toshihiro Shimizu |
890ddd |
TOfflineGL(const TRaster32P &raster, const TOfflineGL *shared = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~TOfflineGL();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void makeCurrent();
|
|
Toshihiro Shimizu |
890ddd |
void doneCurrent();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static void setContextManager(TGLContextManager *contextManager);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void initMatrix();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void clear(TPixel32 color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void draw(TVectorImageP image, const TVectorRenderData &rd, bool doInitMatrix = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void draw(TRasterImageP image, const TAffine &aff, bool doInitMatrix = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void flush();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TRaster32P getRaster(); // Ritorna il raster copiandolo dal buffer offline
|
|
Toshihiro Shimizu |
890ddd |
void getRaster(TRaster32P raster);
|
|
Toshihiro Shimizu |
890ddd |
void getRaster(TRasterP raster);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int getLx() const;
|
|
Toshihiro Shimizu |
890ddd |
int getLy() const;
|
|
Toshihiro Shimizu |
890ddd |
TDimension getSize() const { return TDimension(getLx(), getLy()); };
|
|
Toshihiro Shimizu |
890ddd |
TRect getBounds() const { return TRect(0, 0, getLx() - 1, getLy() - 1); };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
static TOfflineGL *getStock(TDimension dim);
|
|
Toshihiro Shimizu |
890ddd |
// si usa cosi': TOfflineGL *ogl = TOfflineGL::getStock(d);
|
|
Toshihiro Shimizu |
890ddd |
// non bisogna liberare ogl
|
|
Shinya Kitaoka |
262a92 |
std::shared_ptr<imp> m_imp;</imp>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
TOfflineGL(const TOfflineGL &);
|
|
Toshihiro Shimizu |
890ddd |
TOfflineGL &operator=(const TOfflineGL &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|