]> git.sesse.net Git - mlt/blob - src/modules/qimage/kdenlivetitle_wrapper.cpp
load inline images
[mlt] / src / modules / qimage / kdenlivetitle_wrapper.cpp
1 /*
2  * kdenlivetitle_wrapper.cpp -- kdenlivetitle wrapper
3  * Copyright (c) 2009 Marco Gittler <g.marco@freenet.de>
4  * Copyright (c) 2009 Jean-Baptiste Mardelle <jb@kdenlive.org>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20
21 #include "kdenlivetitle_wrapper.h"
22
23 #include <QtGui/QImage>
24 #include <QtGui/QPainter>
25 #include <QtCore/QDebug>
26 #include <QtGui/QApplication>
27 #include <QtCore/QMutex>
28 #include <QtGui/QGraphicsScene>
29 #include <QtGui/QGraphicsTextItem>
30 #include <QtSvg/QGraphicsSvgItem>
31 #include <QtSvg/QSvgRenderer>
32 #include <QtGui/QTextCursor>
33 #include <QtGui/QTextDocument>
34 #include <QtGui/QStyleOptionGraphicsItem>
35
36 #include <QtCore/QString>
37
38 #include <QtXml/QDomElement>
39 #include <QtCore/QRectF>
40 #include <QtGui/QColor>
41 #include <QtGui/QWidget>
42 #include <framework/mlt_log.h>
43
44 #if QT_VERSION >= 0x040600
45 #include <QtGui/QGraphicsEffect>
46 #include <QtGui/QGraphicsBlurEffect>
47 #include <QtGui/QGraphicsDropShadowEffect>
48 #endif
49
50 static QApplication *app = NULL;
51
52 class ImageItem: public QGraphicsItem
53 {
54 public:
55     ImageItem(QImage img)
56     {
57         m_img = img;
58     }
59     QImage m_img;
60
61
62 protected:
63
64 virtual QRectF boundingRect() const
65 {
66     return QRectF(0, 0, m_img.width(), m_img.height());
67 }
68
69 virtual void paint( QPainter *painter,
70                        const QStyleOptionGraphicsItem * /*option*/,
71                        QWidget* )
72
73     painter->setRenderHint(QPainter::SmoothPixmapTransform, true);
74     painter->drawImage(QPoint(), m_img);
75 }
76 };
77
78
79 QString rectTransform( QString s, QTransform t )
80 {
81         QStringList l = s.split( ',' );
82         return QString::number(l.at(0).toDouble() * t.m11()) + ',' + QString::number(l.at(1).toDouble() * t.m22()) + ',' + QString::number(l.at(2).toDouble() * t.m11()) + ',' + QString::number(l.at(3).toDouble() * t.m22());
83 }
84
85 QString colorToString( const QColor& c )
86 {
87         QString ret = "%1,%2,%3,%4";
88         ret = ret.arg( c.red() ).arg( c.green() ).arg( c.blue() ).arg( c.alpha() );
89         return ret;
90 }
91
92 QString rectFToString( const QRectF& c )
93 {
94         QString ret = "%1,%2,%3,%4";
95         ret = ret.arg( c.top() ).arg( c.left() ).arg( c.width() ).arg( c.height() );
96         return ret;
97 }
98
99 QRectF stringToRect( const QString & s )
100 {
101
102         QStringList l = s.split( ',' );
103         if ( l.size() < 4 )
104                 return QRectF();
105         return QRectF( l.at( 0 ).toDouble(), l.at( 1 ).toDouble(), l.at( 2 ).toDouble(), l.at( 3 ).toDouble() ).normalized();
106 }
107
108 QColor stringToColor( const QString & s )
109 {
110         QStringList l = s.split( ',' );
111         if ( l.size() < 4 )
112                 return QColor();
113         return QColor( l.at( 0 ).toInt(), l.at( 1 ).toInt(), l.at( 2 ).toInt(), l.at( 3 ).toInt() );
114         ;
115 }
116 QTransform stringToTransform( const QString& s )
117 {
118         QStringList l = s.split( ',' );
119         if ( l.size() < 9 )
120                 return QTransform();
121         return QTransform(
122                    l.at( 0 ).toDouble(), l.at( 1 ).toDouble(), l.at( 2 ).toDouble(),
123                    l.at( 3 ).toDouble(), l.at( 4 ).toDouble(), l.at( 5 ).toDouble(),
124                    l.at( 6 ).toDouble(), l.at( 7 ).toDouble(), l.at( 8 ).toDouble()
125                );
126 }
127
128 static void qscene_delete( void *data )
129 {
130         QGraphicsScene *scene = ( QGraphicsScene * )data;
131         if (scene) delete scene;
132         scene = NULL;
133 }
134
135
136 void loadFromXml( mlt_producer producer, QGraphicsScene *scene, const char *templateXml, const char *templateText )
137 {
138         scene->clear();
139         mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
140         QDomDocument doc;
141         QString data = QString::fromUtf8(templateXml);
142         QString replacementText = QString::fromUtf8(templateText);
143         doc.setContent(data);
144         QDomElement title = doc.documentElement();
145         
146         // Check for invalid title
147         if ( title.isNull() || title.tagName() != "kdenlivetitle" ) return;
148         
149         int originalWidth;
150         int originalHeight;
151         if ( title.hasAttribute("width") ) {
152             originalWidth = title.attribute("width").toInt();
153             originalHeight = title.attribute("height").toInt();
154             scene->setSceneRect(0, 0, originalWidth, originalHeight);
155         }
156         else {
157             originalWidth = scene->sceneRect().width();
158             originalHeight = scene->sceneRect().height();
159         }
160         if ( title.hasAttribute( "out" ) ) {
161             mlt_properties_set_position( producer_props, "_animation_out", title.attribute( "out" ).toDouble() );
162         }
163         else {
164             mlt_properties_set_position( producer_props, "_animation_out", mlt_producer_get_out( producer ) );
165         }
166         
167         mlt_properties_set_int( producer_props, "_original_width", originalWidth );
168         mlt_properties_set_int( producer_props, "_original_height", originalHeight );
169
170         QDomNodeList items = title.elementsByTagName("item");
171         for ( int i = 0; i < items.count(); i++ )
172         {
173                 QGraphicsItem *gitem = NULL;
174                 int zValue = items.item( i ).attributes().namedItem( "z-index" ).nodeValue().toInt();
175                 if ( zValue > -1000 )
176                 {
177                         if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsTextItem" )
178                         {
179                                 QDomNamedNodeMap txtProperties = items.item( i ).namedItem( "content" ).attributes();
180                                 QFont font( txtProperties.namedItem( "font" ).nodeValue() );
181                                         QDomNode node = txtProperties.namedItem( "font-bold" );
182                                 if ( !node.isNull() )
183                                 {
184                                 // Old: Bold/Not bold.
185                                         font.setBold( node.nodeValue().toInt() );
186                                 }
187                                 else
188                                 {
189                                         // New: Font weight (QFont::)
190                                         font.setWeight( txtProperties.namedItem( "font-weight" ).nodeValue().toInt() );
191                                 }
192                                         font.setItalic( txtProperties.namedItem( "font-italic" ).nodeValue().toInt() );
193                                 font.setUnderline( txtProperties.namedItem( "font-underline" ).nodeValue().toInt() );
194                                 // Older Kdenlive version did not store pixel size but point size
195                                 if ( txtProperties.namedItem( "font-pixel-size" ).isNull() )
196                                 {
197                                         QFont f2;
198                                         f2.setPointSize( txtProperties.namedItem( "font-size" ).nodeValue().toInt() );
199                                         font.setPixelSize( QFontInfo( f2 ).pixelSize() );
200                                 }
201                                 else
202                                         font.setPixelSize( txtProperties.namedItem( "font-pixel-size" ).nodeValue().toInt() );
203                                 QColor col( stringToColor( txtProperties.namedItem( "font-color" ).nodeValue() ) );
204                                 QString text = items.item( i ).namedItem( "content" ).firstChild().nodeValue();
205                                 if ( !replacementText.isEmpty() )
206                                 {
207                                         text = text.replace( "%s", replacementText );
208                                 }
209                                 QGraphicsTextItem *txt = scene->addText(text, font);
210                                 if (txtProperties.namedItem("font-outline").nodeValue().toDouble()>0.0){
211                                         QTextCursor cursor(txt->document());
212                                         cursor.select(QTextCursor::Document);
213                                         QTextCharFormat format;
214                                         format.setTextOutline(
215                                                         QPen(QColor( stringToColor( txtProperties.namedItem( "font-outline-color" ).nodeValue() ) ),
216                                                         txtProperties.namedItem("font-outline").nodeValue().toDouble(),
217                                                         Qt::SolidLine,Qt::RoundCap,Qt::RoundJoin)
218                                         );
219                                         format.setForeground(QBrush(col));
220
221                                         cursor.mergeCharFormat(format);
222                                 } else {
223                                         txt->setDefaultTextColor( col );
224                                 }
225                                 
226                                 // Effects
227                                 if (!txtProperties.namedItem( "typewriter" ).isNull()) {
228                                         // typewriter effect
229                                         mlt_properties_set_int( producer_props, "_animated", 1 );
230                                         QStringList effetData = QStringList() << "typewriter" << text << txtProperties.namedItem( "typewriter" ).nodeValue();
231                                         txt->setData(0, effetData);
232                                 }
233                                 
234                                 if ( txtProperties.namedItem( "alignment" ).isNull() == false )
235                                 {
236                                         txt->setTextWidth( txt->boundingRect().width() );
237                                         QTextOption opt = txt->document()->defaultTextOption ();
238                                         opt.setAlignment(( Qt::Alignment ) txtProperties.namedItem( "alignment" ).nodeValue().toInt() );
239                                         txt->document()->setDefaultTextOption (opt);
240                                 }
241                                         if ( !txtProperties.namedItem( "kdenlive-axis-x-inverted" ).isNull() )
242                                 {
243                                         //txt->setData(OriginXLeft, txtProperties.namedItem("kdenlive-axis-x-inverted").nodeValue().toInt());
244                                 }
245                                 if ( !txtProperties.namedItem( "kdenlive-axis-y-inverted" ).isNull() )
246                                 {
247                                         //txt->setData(OriginYTop, txtProperties.namedItem("kdenlive-axis-y-inverted").nodeValue().toInt());
248                                 }
249                                         gitem = txt;
250                         }
251                         else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsRectItem" )
252                         {
253                                 QString rect = items.item( i ).namedItem( "content" ).attributes().namedItem( "rect" ).nodeValue();
254                                 QString br_str = items.item( i ).namedItem( "content" ).attributes().namedItem( "brushcolor" ).nodeValue();
255                                 QString pen_str = items.item( i ).namedItem( "content" ).attributes().namedItem( "pencolor" ).nodeValue();
256                                 double penwidth = items.item( i ).namedItem( "content" ).attributes().namedItem( "penwidth") .nodeValue().toDouble();
257                                 QGraphicsRectItem *rec = scene->addRect( stringToRect( rect ), QPen( QBrush( stringToColor( pen_str ) ), penwidth, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin ), QBrush( stringToColor( br_str ) ) );
258                                 gitem = rec;
259                         }
260                         else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsPixmapItem" )
261                         {
262                                 const QString url = items.item( i ).namedItem( "content" ).attributes().namedItem( "url" ).nodeValue();
263                                 const QString base64 = items.item(i).namedItem("content").attributes().namedItem("base64").nodeValue();
264                                 QImage img;
265                                 if (base64.isEmpty()){
266                                         img.load(url);
267                                 }else{
268                                         img.loadFromData(QByteArray::fromBase64(base64.toAscii()));
269                                 }
270                                 ImageItem *rec = new ImageItem(img);
271                                 scene->addItem( rec );
272                                 gitem = rec;
273                         }
274                         else if ( items.item( i ).attributes().namedItem( "type" ).nodeValue() == "QGraphicsSvgItem" )
275                         {
276                                 QString url = items.item(i).namedItem("content").attributes().namedItem("url").nodeValue();
277                                 QString base64 = items.item(i).namedItem("content").attributes().namedItem("base64").nodeValue();
278                                 QGraphicsSvgItem *rec = NULL;
279                                 if (base64.isEmpty()){
280                                         rec = new QGraphicsSvgItem(url);
281                                 }else{
282                                         rec = new QGraphicsSvgItem();
283                                         QSvgRenderer *renderer= new QSvgRenderer(QByteArray::fromBase64(base64.toAscii()) );
284                                         rec->setSharedRenderer(renderer);
285                                         //QString elem=rec->elementId();
286                                         //QRectF bounds = renderer->boundsOnElement(elem);
287                                 }
288                                 if (rec){
289                                         scene->addItem(rec);
290                                         gitem = rec;
291                                 }
292                         }
293                 }
294                 //pos and transform
295                 if ( gitem )
296                 {
297                         QPointF p( items.item( i ).namedItem( "position" ).attributes().namedItem( "x" ).nodeValue().toDouble(),
298                                    items.item( i ).namedItem( "position" ).attributes().namedItem( "y" ).nodeValue().toDouble() );
299                         gitem->setPos( p );
300                         gitem->setTransform( stringToTransform( items.item( i ).namedItem( "position" ).firstChild().firstChild().nodeValue() ) );
301                         int zValue = items.item( i ).attributes().namedItem( "z-index" ).nodeValue().toInt();
302                         gitem->setZValue( zValue );
303
304 #if QT_VERSION >= 0x040600
305                         // effects
306                         QDomNode eff = items.item(i).namedItem("effect");
307                         if (!eff.isNull()) {
308                                 QDomElement e = eff.toElement();
309                                 if (e.attribute("type") == "blur") {
310                                         QGraphicsBlurEffect *blur = new QGraphicsBlurEffect();
311                                         blur->setBlurRadius(e.attribute("blurradius").toInt());
312                                         gitem->setGraphicsEffect(blur);
313                                 }
314                                 else if (e.attribute("type") == "shadow") {
315                                         QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
316                                         shadow->setBlurRadius(e.attribute("blurradius").toInt());
317                                         shadow->setOffset(e.attribute("xoffset").toInt(), e.attribute("yoffset").toInt());
318                                         gitem->setGraphicsEffect(shadow);
319                                 }
320                         }
321 #endif
322                 }
323         }
324
325         QDomNode n = title.firstChildElement("background");
326         if (!n.isNull()) {
327                 QColor color = QColor( stringToColor( n.attributes().namedItem( "color" ).nodeValue() ) );
328                 if (color.alpha() > 0) {
329                         QGraphicsRectItem *rec = scene->addRect(0, 0, scene->width(), scene->height() , QPen( Qt::NoPen ), QBrush( color ) );
330                         rec->setZValue(-1100);
331                 }
332           
333         }
334
335         QString startRect;
336         n = title.firstChildElement( "startviewport" );
337         // Check if node exists, if it has an x attribute, it is an old version title, don't use viewport
338         if (!n.isNull() && !n.toElement().hasAttribute("x"))
339         {
340                 startRect = n.attributes().namedItem( "rect" ).nodeValue();
341         }
342         n = title.firstChildElement( "endviewport" );
343         // Check if node exists, if it has an x attribute, it is an old version title, don't use viewport
344         if (!n.isNull() && !n.toElement().hasAttribute("x"))
345         {
346                 QString rect = n.attributes().namedItem( "rect" ).nodeValue();
347                 if (startRect != rect)
348                         mlt_properties_set( producer_props, "_endrect", rect.toUtf8().data() );
349         }
350         if (!startRect.isEmpty()) {
351                 mlt_properties_set( producer_props, "_startrect", startRect.toUtf8().data() );
352         }
353         return;
354 }
355
356
357 void drawKdenliveTitle( producer_ktitle self, mlt_frame frame, int width, int height, double position, int force_refresh )
358 {
359         // Obtain the producer 
360         mlt_producer producer = &self->parent;
361         mlt_profile profile = mlt_service_profile ( MLT_PRODUCER_SERVICE( producer ) ) ;
362         mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
363
364         // Obtain properties of frame
365         mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
366         
367         pthread_mutex_lock( &self->mutex );
368         
369         // Check if user wants us to reload the image
370         if ( mlt_properties_get( producer_props, "_animated" ) != NULL || force_refresh == 1 || width != self->current_width || height != self->current_height || mlt_properties_get( producer_props, "_endrect" ) != NULL )
371         {
372                 //mlt_cache_item_close( self->image_cache );
373                 self->current_image = NULL;
374                 mlt_properties_set_data( producer_props, "cached_image", NULL, 0, NULL, NULL );
375                 mlt_properties_set_int( producer_props, "force_reload", 0 );
376         }
377         
378         if (self->current_image == NULL) {
379                 // restore QGraphicsScene
380                 QGraphicsScene *scene = static_cast<QGraphicsScene *> (mlt_properties_get_data( producer_props, "qscene", NULL ));
381
382                 if ( force_refresh == 1 && scene )
383                 {
384                         scene = NULL;
385                         mlt_properties_set_data( producer_props, "qscene", NULL, 0, NULL, NULL );
386                 }
387
388                 if ( scene == NULL )
389                 {
390                         int argc = 1;
391                         char* argv[1];
392                         argv[0] = (char*) "xxx";
393                         
394                         // Warning: all Qt graphic objects (QRect, ...) must be initialized AFTER 
395                         // the QApplication is created, otherwise their will be NULL
396                         
397                         if ( app == NULL ) {
398                                 if ( qApp ) {
399                                         app = qApp;
400                                 }
401                                 else {
402 #ifdef linux
403                                         if ( getenv("DISPLAY") == 0 )
404                                         {
405                                                 mlt_log_panic( MLT_PRODUCER_SERVICE( producer ), "Error, cannot render titles without an X11 environment.\nPlease either run melt from an X session or use a fake X server like xvfb:\nxvfb-run -a melt (...)\n" );
406                                                 pthread_mutex_unlock( &self->mutex );
407                                                 exit(1);
408                                                 return;
409                                         }
410 #endif
411                                         app = new QApplication( argc, argv );
412                                         //fix to let the decimal point for every locale be: "."
413                                         setlocale(LC_NUMERIC,"POSIX");
414                                 }
415                         }
416                         scene = new QGraphicsScene();
417                         scene->setItemIndexMethod( QGraphicsScene::NoIndex );
418                         scene->setSceneRect(0, 0, mlt_properties_get_int( properties, "width" ), mlt_properties_get_int( properties, "height" ));
419                         loadFromXml( producer, scene, mlt_properties_get( producer_props, "xmldata" ), mlt_properties_get( producer_props, "templatetext" ) );
420                         mlt_properties_set_data( producer_props, "qscene", scene, 0, ( mlt_destructor )qscene_delete, NULL );
421                 }
422                 
423                 QRectF start = stringToRect( QString( mlt_properties_get( producer_props, "_startrect" ) ) );
424                 QRectF end = stringToRect( QString( mlt_properties_get( producer_props, "_endrect" ) ) );
425         
426                 int originalWidth = mlt_properties_get_int( producer_props, "_original_width" );
427                 int originalHeight= mlt_properties_get_int( producer_props, "_original_height" );
428                 const QRectF source( 0, 0, width, height );
429                 if (start.isNull()) {
430                     start = QRectF( 0, 0, originalWidth, originalHeight );
431                 }
432
433                 // Effects
434                 QList <QGraphicsItem *> items = scene->items();
435                 QGraphicsTextItem *titem = NULL;
436                 for (int i = 0; i < items.count(); i++) {
437                     titem = static_cast <QGraphicsTextItem*> ( items.at( i ) );
438                     if (titem && !titem->data( 0 ).isNull()) {
439                             QStringList params = titem->data( 0 ).toStringList();
440                             if (params.at( 0 ) == "typewriter" ) {
441                                     // typewriter effect has 2 param values:
442                                     // the keystroke delay and a start offset, both in frames
443                                     QStringList values = params.at( 2 ).split( ";" );
444                                     int interval = qMax( 0, ( ( int ) position - values.at( 1 ).toInt()) / values.at( 0 ).toInt() );
445                                     QTextDocument *td = new QTextDocument( params.at( 1 ).left( interval ) );
446                                     td->setDefaultFont( titem->font() );
447                                     td->setDefaultTextOption( titem->document()->defaultTextOption() );
448                                     td->setTextWidth( titem->document()->textWidth() );
449                                     titem->setDocument( td );
450                             }
451                     }
452                 }
453
454                 //must be extracted from kdenlive title
455                 QImage img( width, height, QImage::Format_ARGB32 );
456                 img.fill( 0 );
457                 QPainter p1;
458                 p1.begin( &img );
459                 p1.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing );
460                 //| QPainter::SmoothPixmapTransform );
461                 mlt_position anim_out = mlt_properties_get_position( producer_props, "_animation_out" );
462
463                 if (end.isNull())
464                 {
465                         scene->render( &p1, source, start, Qt::IgnoreAspectRatio );
466                 }
467                 else if ( position > anim_out ) {
468                         scene->render( &p1, source, end, Qt::IgnoreAspectRatio );
469                 }
470                 else {
471                         double percentage = position / anim_out;
472                         QPointF topleft = start.topLeft() + ( end.topLeft() - start.topLeft() ) * percentage;
473                         QPointF bottomRight = start.bottomRight() + ( end.bottomRight() - start.bottomRight() ) * percentage;
474                         const QRectF r1( topleft, bottomRight );
475                         scene->render( &p1, source, r1, Qt::IgnoreAspectRatio );
476                         if ( profile && !profile->progressive ){
477                                 int line=0;
478                                 double percentage_next_filed    = ( position + 0.5 ) / anim_out;
479                                 QPointF topleft_next_field = start.topLeft() + ( end.topLeft() - start.topLeft() ) * percentage_next_filed;
480                                 QPointF bottomRight_next_field = start.bottomRight() + ( end.bottomRight() - start.bottomRight() ) * percentage_next_filed;
481                                 const QRectF r2( topleft_next_field, bottomRight_next_field );
482                                 QImage img1( width, height, QImage::Format_ARGB32 );
483                                 img1.fill( 0 );
484                                 QPainter p2;
485                                 p2.begin(&img1);
486                                 p2.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing );
487                                 scene->render(&p2,source,r2,  Qt::IgnoreAspectRatio );
488                                 p2.end();
489                                 int next_field_line = (  mlt_properties_get_int( producer_props, "top_field_first" ) ? 1 : 0 );
490                                 for (line = next_field_line ;line<height;line+=2){
491                                                 memcpy(img.scanLine(line),img1.scanLine(line),img.bytesPerLine());
492                                 }
493
494                         }
495                 }
496                 p1.end();
497
498                 int size = width * height * 4;
499                 uint8_t *pointer=img.bits();
500                 QRgb* src = ( QRgb* ) pointer;
501                 self->current_image = ( uint8_t * )mlt_pool_alloc( size );
502                 uint8_t *dst = self->current_image;
503         
504                 for ( int i = 0; i < width * height * 4; i += 4 )
505                 {
506                         *dst++=qRed( *src );
507                         *dst++=qGreen( *src );
508                         *dst++=qBlue( *src );
509                         *dst++=qAlpha( *src );
510                         src++;
511                 }
512
513                 mlt_properties_set_data( producer_props, "cached_image", self->current_image, size, mlt_pool_release, NULL );
514                 self->current_width = width;
515                 self->current_height = height;
516         }
517
518         pthread_mutex_unlock( &self->mutex );
519         mlt_properties_set_int( properties, "width", self->current_width );
520         mlt_properties_set_int( properties, "height", self->current_height );
521 }
522
523