Commit bad1933c authored by claes's avatar claes

Support for video image files added

parent dd709fa6
...@@ -3491,6 +3491,10 @@ void grow_GetNodeClassOrigo( grow_tObject object, double *x, double *y) ...@@ -3491,6 +3491,10 @@ void grow_GetNodeClassOrigo( grow_tObject object, double *x, double *y)
((GrowNode *)object)->get_nodeclass_origo((GlowTransform *)NULL, x, y); ((GrowNode *)object)->get_nodeclass_origo((GlowTransform *)NULL, x, y);
} }
int grow_ImageUpdate( grow_tObject object)
{
return ((GrowImage *)object)->update();
}
......
...@@ -539,6 +539,7 @@ int grow_GetBackgroundObjectLimits( grow_tCtx ctx, glow_eTraceType type, ...@@ -539,6 +539,7 @@ int grow_GetBackgroundObjectLimits( grow_tCtx ctx, glow_eTraceType type,
int grow_GetTranslate( grow_tCtx ctx); int grow_GetTranslate( grow_tCtx ctx);
glow_eMB3Action grow_GetMB3Action( grow_tCtx ctx); glow_eMB3Action grow_GetMB3Action( grow_tCtx ctx);
void grow_GetNodeClassOrigo( grow_tObject object, double *x, double *y); void grow_GetNodeClassOrigo( grow_tObject object, double *x, double *y);
int grow_ImageUpdate( grow_tObject object);
#if defined __cplusplus #if defined __cplusplus
} }
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#if defined OS_LINUX || defined OS_LYNX
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "glow_transform.h" #include "glow_transform.h"
#include "glow_growimage.h" #include "glow_growimage.h"
#include "glow_grownode.h" #include "glow_grownode.h"
...@@ -41,6 +45,7 @@ GrowImage::GrowImage( GlowCtx *glow_ctx, char *name, double x, double y, ...@@ -41,6 +45,7 @@ GrowImage::GrowImage( GlowCtx *glow_ctx, char *name, double x, double y,
{ {
strcpy( n_name, name); strcpy( n_name, name);
strcpy( image_filename, ""); strcpy( image_filename, "");
strcpy( filename, "");
strcpy( last_group, ""); strcpy( last_group, "");
imlib = ((draw_tCtx)ctx->draw_ctx)->imlib; imlib = ((draw_tCtx)ctx->draw_ctx)->imlib;
if ( imagefile) if ( imagefile)
...@@ -112,8 +117,9 @@ int GrowImage::insert_image( char *imagefile) ...@@ -112,8 +117,9 @@ int GrowImage::insert_image( char *imagefile)
{ {
int found = 0; int found = 0;
char imagename[80]; char imagename[80];
char filename[120];
char *s; char *s;
struct stat info;
int sts;
strcpy( image_filename, imagefile); strcpy( image_filename, imagefile);
...@@ -150,6 +156,12 @@ int GrowImage::insert_image( char *imagefile) ...@@ -150,6 +156,12 @@ int GrowImage::insert_image( char *imagefile)
} }
#if defined IMLIB #if defined IMLIB
sts = stat( filename, &info);
if ( sts == -1)
return 0;
date = info.st_ctime;
if ( pixmap) { if ( pixmap) {
Imlib_free_pixmap( imlib, pixmap); Imlib_free_pixmap( imlib, pixmap);
pixmap = 0; pixmap = 0;
...@@ -206,6 +218,53 @@ int GrowImage::insert_image( char *imagefile) ...@@ -206,6 +218,53 @@ int GrowImage::insert_image( char *imagefile)
return 1; return 1;
} }
int GrowImage::update()
{
#if defined IMLIB
struct stat info;
int sts;
sts = stat( filename, &info);
if ( sts == -1)
return 0;
if ( date == info.st_ctime)
return 0;
date = info.st_ctime;
if ( original_image)
Imlib_kill_image( imlib, original_image);
original_image = Imlib_load_image( imlib, filename);
if ( !original_image)
return 0;
if ( pixmap) {
Imlib_free_pixmap( imlib, pixmap);
pixmap = 0;
}
if ( nav_pixmap) {
Imlib_free_pixmap( imlib, nav_pixmap);
nav_pixmap = 0;
}
// Make a copy
if ( image)
Imlib_kill_image( imlib, image);
image = Imlib_clone_image( imlib, original_image);
set_image_color( image, NULL);
Imlib_render( imlib, image, current_width, current_height);
pixmap = Imlib_move_image( imlib, image);
draw();
return 1;
#endif
return 0;
}
void GrowImage::zoom() void GrowImage::zoom()
{ {
ll.zoom(); ll.zoom();
......
...@@ -51,6 +51,7 @@ class GrowImage : public GlowArrayElem { ...@@ -51,6 +51,7 @@ class GrowImage : public GlowArrayElem {
void get_object_name( char *name) { strcpy( name, n_name);}; void get_object_name( char *name) { strcpy( name, n_name);};
void set_object_name( char *name) { strcpy( n_name, name);}; void set_object_name( char *name) { strcpy( n_name, name);};
void align( double x, double y, glow_eAlignDirection direction); void align( double x, double y, glow_eAlignDirection direction);
int update();
GlowPoint ll; GlowPoint ll;
GlowPoint ur; GlowPoint ur;
...@@ -100,6 +101,8 @@ class GrowImage : public GlowArrayElem { ...@@ -100,6 +101,8 @@ class GrowImage : public GlowArrayElem {
int current_nav_color_inverse; int current_nav_color_inverse;
int current_nav_direction; int current_nav_direction;
char last_group[32]; char last_group[32];
int date;
char filename[256];
int insert_image( char *imagefile); int insert_image( char *imagefile);
void zoom(); void zoom();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment