OpenToonz - An open-source full-featured 2D animation creation software
C
#assistants: tglGetBounds()
Ivan Mahonin1982ded78663
diff --git a/toonz/sources/common/tgl/tgl.cpp b/toonz/sources/common/tgl/tgl.cppindex 88c69891d..6c3c83154 100644--- a/toonz/sources/common/tgl/tgl.cpp+++ b/toonz/sources/common/tgl/tgl.cpp@@ -73,6 +73,16 @@ double tglGetPixelSize2() {//-----------------------------------------------------------------------------+TRectD tglGetBounds() {+ TAffine4 modelview;+ TAffine4 projection;+ glGetDoublev(GL_MODELVIEW_MATRIX, modelview.a);+ glGetDoublev(GL_PROJECTION_MATRIX, projection.a);+ return (projection*modelview).get2d().inv() * TRectD(-1.0, -1.0, 1.0, 1.0);+}++//-----------------------------------------------------------------------------+double tglGetTextWidth(const std::string &s, void *font) {double factor = 0.07;double w = 0;diff --git a/toonz/sources/include/tgl.h b/toonz/sources/include/tgl.hindex b614cf23c..134da8a3a 100644--- a/toonz/sources/include/tgl.h+++ b/toonz/sources/include/tgl.h@@ -112,6 +112,9 @@ inline void tglColor(const TPixelD &p) { glColor4d(p.r, p.g, p.b, p.m); }//! retrieve the square of pixel size from current GL_MODELVIEW matrixDVAPI double tglGetPixelSize2();+//! retrieve the current viewport bounds in world coordinates+DVAPI TRectD tglGetBounds();+//! Draw text in string s at position p.DVAPI void tglDrawText(const TPointD &p, const std::string &s,