aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/Makefile5
-rw-r--r--modules/Makefile.in5
-rw-r--r--modules/pdp_pen.c39
-rw-r--r--modules/pdp_xcanvas.c1
4 files changed, 40 insertions, 10 deletions
diff --git a/modules/Makefile b/modules/Makefile
index e7f9de0..14b6c92 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -10,10 +10,11 @@ OBJECTS = pdp_intrusion.o pdp_yqt.o pdp_simura.o pdp_underwatch.o \
pdp_rec~.o pdp_o.o pdp_i.o pdp_mgrid.o pdp_ctrack.o \
pdp_cycle.o pdp_transform.o pdp_shagadelic.o \
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
- pdp_compose.o pdp_cmap.o pdp_aa.o pdp_ascii.o \
+ pdp_compose.o pdp_cmap.o pdp_ascii.o \
pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \
pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
- pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o
+ pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
+ pdp_ocanvas.o # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
diff --git a/modules/Makefile.in b/modules/Makefile.in
index e7f9de0..14b6c92 100644
--- a/modules/Makefile.in
+++ b/modules/Makefile.in
@@ -10,10 +10,11 @@ OBJECTS = pdp_intrusion.o pdp_yqt.o pdp_simura.o pdp_underwatch.o \
pdp_rec~.o pdp_o.o pdp_i.o pdp_mgrid.o pdp_ctrack.o \
pdp_cycle.o pdp_transform.o pdp_shagadelic.o \
pdp_dice.o pdp_puzzle.o pdp_text.o pdp_form.o \
- pdp_compose.o pdp_cmap.o pdp_aa.o pdp_ascii.o \
+ pdp_compose.o pdp_cmap.o pdp_ascii.o \
pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \
pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \
pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \
- pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o
+ pdp_canvas.o pdp_pen.o pdp_shape.o pdp_fqt.o pdp_fcqt.o \
+ pdp_ocanvas.o # pdp_xcanvas.o pdp_aa.o
all_modules: $(OBJECTS)
diff --git a/modules/pdp_pen.c b/modules/pdp_pen.c
index d5549da..dad5167 100644
--- a/modules/pdp_pen.c
+++ b/modules/pdp_pen.c
@@ -50,6 +50,8 @@ typedef struct pdp_pen_struct
t_int x_red;
t_int x_green;
t_int x_blue;
+ t_int x_xoffset;
+ t_int x_yoffset;
t_int x_pwidth;
t_int x_mode; // 0=draw ( default), 1=erase
@@ -75,6 +77,8 @@ static void pdp_pen_draw(t_pdp_pen *x, t_floatarg X, t_floatarg Y)
t_int mx, Mx, my, My;
t_int px, py;
+ if ( !x->x_bdata ) return;
+
X = X*x->x_vwidth;
Y = Y*x->x_vheight;
// post( "pdp_pen : draw %f %f", X, Y );
@@ -127,6 +131,8 @@ static void pdp_pen_do_fill(t_pdp_pen *x, t_floatarg X, t_floatarg Y)
short int *pbY, *pbU, *pbV;
short int nX, nY;
+ if ( !x->x_bdata ) return;
+
nbits++;
// post( "pdp_pen_do_fill : X=%d, Y=%d stack=%d", (t_int)X, (t_int)Y, nbits );
@@ -286,6 +292,7 @@ static void pdp_pen_fill(t_pdp_pen *x, t_floatarg X, t_floatarg Y)
static void pdp_pen_clear(t_pdp_pen *x)
{
+ if ( !x->x_bdata ) return;
if ( x->x_vsize > 0 )
{
memset( x->x_bdata, 0x00, (( x->x_vsize + (x->x_vsize>>1))<<1) );
@@ -300,6 +307,16 @@ static void pdp_pen_width(t_pdp_pen *x, t_floatarg width)
}
}
+static void pdp_pen_xoffset(t_pdp_pen *x, t_floatarg xoffset)
+{
+ x->x_xoffset = (int) xoffset;
+}
+
+static void pdp_pen_yoffset(t_pdp_pen *x, t_floatarg yoffset)
+{
+ x->x_yoffset = (int) yoffset;
+}
+
static void pdp_pen_mode(t_pdp_pen *x, t_floatarg mode)
{
if ( ( mode == 0. ) || ( mode == 1. ) )
@@ -372,13 +389,17 @@ static void pdp_pen_process_yv12(t_pdp_pen *x)
{
for(px=0; px<x->x_vwidth; px++)
{
- if ( *(pbY+py*x->x_vwidth+px) != 0 )
+ if ( ( (px-x->x_xoffset)>=0 ) && ( (px-x->x_xoffset)<x->x_vwidth ) &&
+ ( (py-x->x_yoffset)>=0 ) && ( (py-x->x_yoffset)<x->x_vheight ) )
{
- *(pnY+py*x->x_vwidth+px) = *(pbY+py*x->x_vwidth+px);
- *(pnU+(py>>1)*(x->x_vwidth>>1)+(px>>1)) =
- *(pbU+(py>>1)*(x->x_vwidth>>1)+(px>>1));
- *(pnV+(py>>1)*(x->x_vwidth>>1)+(px>>1)) =
- *(pbV+(py>>1)*(x->x_vwidth>>1)+(px>>1));
+ if ( *(pbY+(py-x->x_yoffset)*x->x_vwidth+(px-x->x_xoffset)) != 0 )
+ {
+ *(pnY+py*x->x_vwidth+px) = *(pbY+(py-x->x_yoffset)*x->x_vwidth+(px-x->x_xoffset));
+ *(pnU+(py>>1)*(x->x_vwidth>>1)+(px>>1)) =
+ *(pbU+((py-x->x_yoffset)>>1)*(x->x_vwidth>>1)+((px-x->x_xoffset)>>1));
+ *(pnV+(py>>1)*(x->x_vwidth>>1)+(px>>1)) =
+ *(pbV+((py-x->x_yoffset)>>1)*(x->x_vwidth>>1)+((px-x->x_xoffset)>>1));
+ }
}
}
}
@@ -459,6 +480,8 @@ void *pdp_pen_new(void)
t_pdp_pen *x = (t_pdp_pen *)pd_new(pdp_pen_class);
x->x_outlet0 = outlet_new(&x->x_obj, &s_anything);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("xoffset"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("yoffset"));
x->x_packet0 = -1;
x->x_packet1 = -1;
@@ -470,6 +493,8 @@ void *pdp_pen_new(void)
x->x_red = 255;
x->x_green = 255;
x->x_blue = 255;
+ x->x_xoffset = 0;
+ x->x_yoffset = 0;
x->x_pwidth = 3;
x->x_mode = 0;
@@ -498,6 +523,8 @@ void pdp_pen_setup(void)
class_addmethod(pdp_pen_class, (t_method)pdp_pen_width, gensym("width"), A_DEFFLOAT, A_NULL);
class_addmethod(pdp_pen_class, (t_method)pdp_pen_rgb, gensym("rgb"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_NULL);
class_addmethod(pdp_pen_class, (t_method)pdp_pen_mode, gensym("mode"), A_DEFFLOAT, A_NULL);
+ class_addmethod(pdp_pen_class, (t_method)pdp_pen_xoffset, gensym("xoffset"), A_DEFFLOAT, A_NULL);
+ class_addmethod(pdp_pen_class, (t_method)pdp_pen_yoffset, gensym("yoffset"), A_DEFFLOAT, A_NULL);
}
diff --git a/modules/pdp_xcanvas.c b/modules/pdp_xcanvas.c
index 77bf7d5..071f530 100644
--- a/modules/pdp_xcanvas.c
+++ b/modules/pdp_xcanvas.c
@@ -26,6 +26,7 @@
#include "pdp.h"
#include "pdp_xwindow.h"
+#include <X11/extensions/XShm.h>
#include <math.h>
static char *pdp_xcanvas_version = "pdp_xcanvas: version 0.1, display for several video sources, written by Yves Degoyon (ydegoyon@free.fr)";