cleanup (-> old directory) & creation of 'new' src folder + TODO
[my-code/ivac.git] / webcam.c
diff --git a/webcam.c b/webcam.c
deleted file mode 100644 (file)
index 30c1550..0000000
--- a/webcam.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * webcam.c - fetch data from webcam and display
- *
- * author: hackbard
- *
- */
-
-/* includes */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/xpm.h>
-#include <X11/extensions/shape.h>
-#include "minirgb.h"
-// #include "images/ivac-logo.xpm"
-// #include "images/ivac-logo.h"
-#include "images/example_orig.xbm"
-
-/* defines */
-#define XBM_WIDTH 256
-#define XBM_REAL_WIDTH 512
-#define XBM_HEIGHT 256
-// #define ivac_logo pixel_data
-#define ivac_logo example_bits
-
-/* global variables */
-Display *display;
-Window ivac_win,icon_win;
-GC my_gc;
-MiniRGB rgb1,rgb2;
-
-
-void open_window(char *name,char *ivac_mask) {
-
- /* local variables */
- int screen,width,height;
- Window root_win;
- XSizeHints my_size_hints;
- XClassHint my_class_hints;
- Pixel black,white;
- XGCValues my_gc_val;
- Pixmap pixmap_mask;
- XWMHints my_wm_hints;
-
- screen=DefaultScreen(display);
- root_win=DefaultRootWindow(display);
- width=XBM_WIDTH; /* DisplayWidth(display,screen)/5; */
- height=XBM_HEIGHT; /* DisplayHeight(diplay,screen)/5; */
- my_size_hints.flags=USSize;
- my_size_hints.width=width;
- my_size_hints.height=height;
-
- my_class_hints.res_name=name;
- my_class_hints.res_class=name;
-
- black=BlackPixel(display,screen);
- white=WhitePixel(display,screen);
-
- /* create window */
- ivac_win=XCreateSimpleWindow(display,root_win,0,0,
-                               my_size_hints.width,
-                               my_size_hints.height,
-                               1,black,white);
- icon_win=XCreateSimpleWindow(display,ivac_win,0,0,
-                               my_size_hints.width,
-                               my_size_hints.height,
-                               1,black,white);
-
- /* set wm and class hints */
- XSetWMNormalHints(display,ivac_win,&my_size_hints);
- XSetClassHint(display,ivac_win,&my_class_hints);
-
- /* select event input - what are we listening to? */
- XSelectInput(display,ivac_win,
-               ExposureMask | ButtonPressMask | ButtonReleaseMask |
-               StructureNotifyMask);
- XSelectInput(display,icon_win,
-               ExposureMask | ButtonPressMask | ButtonReleaseMask |
-               StructureNotifyMask);
-
- /* set names for windows */
- XStoreName(display,ivac_win,name);
- XSetIconName(display,ivac_win,name);
-
- /* graphics context values */
- my_gc_val.foreground=black;
- my_gc_val.background=white;
- my_gc_val.graphics_exposures=False;
- /* set graphics context */
- my_gc=XCreateGC(display,ivac_win,
-               GCForeground | GCBackground | GCGraphicsExposures,
-               &my_gc_val);
-
- /* create pixmap mask and shape windows */
- pixmap_mask=XCreateBitmapFromData(display,ivac_win,ivac_mask,
-                                       XBM_WIDTH,XBM_HEIGHT);
- XShapeCombineMask(display,ivac_win,ShapeBounding,0,0,pixmap_mask,ShapeSet);
- XShapeCombineMask(display,icon_win,ShapeBounding,0,0,pixmap_mask,ShapeSet);
-
- /* define and set wmhints */
- my_wm_hints.initial_state=WithdrawnState;
- my_wm_hints.flags=StateHint;
- my_wm_hints.icon_window=icon_win;
- my_wm_hints.icon_x=my_size_hints.x;
- my_wm_hints.icon_y=my_size_hints.y;
- my_wm_hints.window_group=ivac_win;
- my_wm_hints.flags =
-       StateHint | IconWindowHint | IconPositionHint | WindowGroupHint;
- // XSetWMHints(display,ivac_win,&my_wm_hints);
-
- /* finaly ... map that stuff ;) */
- XMapWindow(display,ivac_win);
-
-}
-
-
-/* main routine */
-int main(int argc,char **argv) {
-
- /* local variables */
- XEvent xevent;
-
-
- /* opening display */
- display=XOpenDisplay(NULL); /* connect on local display :0 */
- if(display==NULL) {
-  printf("cannot connect to xserver!\n");
-  exit(EXIT_FAILURE);
- }
- /* minirgb initialization */
- if (minirgb_init(display)) {
-  printf("minirgb initialization failed!\n");
-  exit(1);
- }
-
- open_window(argv[0],(char *)ivac_logo);
- minirgb_new(&rgb1,XBM_WIDTH,XBM_HEIGHT);
- minirgb_new(&rgb2,XBM_WIDTH,XBM_HEIGHT);
- minirgb_copy(&rgb2,&rgb1,0,0,XBM_WIDTH,XBM_HEIGHT,0,0);
-
- /* to be continued ... here is a test! */
- XFlush(display);
- sleep(10);
- printf("blaaaa, schmaeee\n");
- XCloseDisplay(display);
- return 0;
-
-}