예제 #1
0
static void init_channel_data(struct vino_device *v, int channel)
{
	init_waitqueue_head(&v->dma_wait);
	init_MUTEX(&v->sem);
	spin_lock_init(&v->state_lock);
	memcpy(&v->vdev, &vino_template, sizeof(vino_template));
	v->vdev.priv = v;
	v->chan = channel;
	v->input = -1;
	v->picture.palette = VIDEO_PALETTE_GREY;
	v->picture.depth = 8;
	v->buffer_state = VINO_BUF_UNUSED;
	v->users = 0;
	set_clipping(v, 0, 0, VINO_NTSC_WIDTH, VINO_NTSC_HEIGHT, 1);
}
예제 #2
0
static int cdecl draw_underline(PARMBLK *p)
{
	char	*str;
	int	d, wBox, hBox, effect = 0;

	set_clipping(vdi_handle, p->pb_xc, p->pb_yc, p->pb_wc, p->pb_hc, TRUE);
	vswr_mode(vdi_handle, MD_TRANS);

	/* Font */
	vst_alignment(vdi_handle, 0, 5, &d, &d);
	vst_font(vdi_handle, sys_big_id);
	vst_height(vdi_handle, sys_big_height, &d, &d, &wBox, &hBox);

	/* Text ausgeben */
	str = (char *)p->pb_parm;
	vst_color(vdi_handle, 12);
	
	if(p->pb_tree[p->pb_obj].ob_state & DISABLED)
		effect |= TXT_LIGHT;

	if(p->pb_tree[p->pb_obj].ob_state & CHECKED)
		effect |= TXT_UNDERLINED;

	if(p->pb_tree[p->pb_obj].ob_state & SELECTED)
		vst_color(vdi_handle, 2);

	vst_effects(vdi_handle, effect);
	v_gtext(vdi_handle, p->pb_x, p->pb_y, str);

	/* Linie */
/*	len = get_txtlen(str);*/
/*	len = p->pb_w;

	vsl_color(vdi_handle, 9);

	pxy[0] = p->pb_x;			pxy[1] = p->pb_y + hBox;
	pxy[2] = p->pb_x + len; pxy[3] = pxy[1];
	v_pline(vdi_handle, 2, pxy);

	vsl_color(vdi_handle, 0);
	pxy[1]--; pxy[3]--;
	v_pline(vdi_handle, 2, pxy); */

	return (p->pb_currstate & ~(CHECKED|DISABLED|SELECTED));
}
예제 #3
0
static int cdecl draw_aquaback(PARMBLK *p)
{
	int16 pxy[8];
	int16	x0;
	int16 y0;

	set_clipping(vdi_handle, p->pb_xc, p->pb_yc, p->pb_wc, p->pb_hc, TRUE);
	vswr_mode(vdi_handle, MD_REPLACE);

	pxy[0] = x0 = p->pb_x;				pxy[1] = y0 = p->pb_y;
	pxy[2] = p->pb_x + p->pb_w -1 ;	pxy[3] = p->pb_y + p->pb_h - 1;

	vsf_interior(vdi_handle, FIS_PATTERN); /* FIS_PATTERN */
	vsf_color(vdi_handle, LWHITE );
	vsf_style(vdi_handle, 4);
	v_bar(vdi_handle, pxy);

	pxy[3] = pxy[1];

/*	while( (pxy[1]-y0) < (p->pb_h) )
	{
		vsl_color(vdi_handle, WHITE);
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
	}
*/	
	while( (pxy[1]-y0+2) < (p->pb_h) )
	{
		vsl_color(vdi_handle, LWHITE); 
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
		vsl_color(vdi_handle, WHITE);
		v_pline(vdi_handle, 2, pxy);
		pxy[1]+=2;	pxy[3]+=2;
	}
	
	if( (pxy[1]-y0) < (p->pb_h) )
	{
		vsl_color(vdi_handle, LWHITE);
		v_pline(vdi_handle, 2, pxy);
	}
	
	return (p->pb_currstate);
}
예제 #4
0
void go_plot_contours(
    char *device, char *title, char *xvar, char *yvar, char *topline,
    double **data, double xmin, double xmax, double ymin, double ymax,
    double dx, double dy, long nx, long ny,
    double *contour_level, long n_contours, long contour_label_interval,
    long contour_label_offset, long layout[2], long ix, long iy,
    char *shapes, int *pen, long flags, long pause_interval,
    SHAPE_DATA *shape, long nshapes, unsigned long long tsetFlags, double xlableScale, double ylabelScale)
{
    double map[4], average, spread;
    double pmin, pmax, qmin, qmax;
    double wpmin, wpmax=0, wqmin, wqmax=0;
    long title_at_top=0;
    char newLabel[50];
    time_t timeValue;

    if (!(flags&DEVICE_DEFINED)) 
      change_term(device, strlen(device));
    if ((ix == 0) && (iy == 0))
      graphics_on();
    if (layout[0] && layout[1]) {
      wpmin = (1.0*ix+0)/layout[0];
      wpmax = (1.0*ix+1)/layout[0];
      wqmin = (layout[1]*1.0 - 1 - iy)/layout[1];
      wqmax = (layout[1]*1.0 - 0 - iy)/layout[1];
      set_wspace(wpmin, wpmax, wqmin, wqmax);
      pmin = (wpmax - wpmin) * .15 + wpmin;
      pmax = wpmax - (wpmax - wpmin) * .1;
      qmin = (wqmax - wqmin) * .17 + wqmin;
      qmax = wqmax - (wqmax - wqmin) * .08;
      set_pspace(pmin, pmax, qmin, qmax);
    }

    if (contour_label_interval<0) {
      get_pspace(&pmin, &pmax, &qmin, &qmax);
      set_pspace(pmin, 0.9 * wpmax, qmin, 0.85 * wqmax);
    }
    if (flags&TITLE_AT_TOP) {
      /* adjust pspace to make room at top for the title */
      get_pspace(&pmin, &pmax, &qmin, &qmax);
      spread = qmax-qmin;
      qmax -= 0.04*spread;
      qmin -= 0.04*spread;
      /*    qmax -= 0.04;
            qmin -= 0.04;*/
      set_pspace(pmin, pmax, qmin, qmax);
      title_at_top = 1;
    }
    set_clipping(1, 1, 1);


    if (flags&EQUAL_ASPECT1) 
        set_aspect(1.0L);
    else if (flags&EQUAL_ASPECT_1)
        set_aspect(-1.0L);

    set_linetype(pen[0]);
    get_mapping(map, map+1, map+2, map+3);
    if (map[0]==map[1]) {
        average  = (xmax+xmin)/2;
        spread   = (xmax-xmin)/2;
        map[0]   = average - spread*1.05;
        map[1]   = average + spread*1.05;
        }
    if (map[2]==map[3]) {
        average  = (ymax+ymin)/2;
        spread   = (ymax-ymin)/2;
        map[2]   = average - spread*1.05;
        map[3]   = average + spread*1.05;
        }
    set_mapping(map[0], map[1], map[2], map[3]);
    get_pspace(&pmin, &pmax, &qmin, &qmax);
    get_wspace(&wpmin, &wpmax, &wqmin, &wqmax);

    if (!(flags&NO_BORDER)) {
      border();
      if (!(flags&NO_SCALES)) {
        if (tsetFlags&TICKSET_XTIME) {
          timeValue = map[0];
          if (timeValue!=DBL_MAX)
            sprintf(newLabel, "Time starting %s", ctime(&timeValue));
          else
            sprintf(newLabel, "Undefined time values!");
          delete_chars(newLabel, "\n");
          makeTimeScales(0, 0.02, 0, map[2], map[2], newLabel, 
                         0, 0.67*(qmin-wqmin)*(map[3]-map[2])/(qmax-qmin), 
                         0, 1, 1);
        } else {
          make_scales_with_label(0, 0, 1, 0.0, 0.02, 0.0, 
                                 0.0, 1.0, 0, 0, 
                                 0, 0, 0, 0, xvar, 0, 0, xlableScale);
        }
	if (!(flags&NO_YSCALES)) {
          if (tsetFlags&TICKSET_YTIME) {
            timeValue = map[2];
            if (timeValue!=DBL_MAX)
              sprintf(newLabel, "Time starting %s", ctime(&timeValue));
            else
              sprintf(newLabel, "Undefined time values!");
            delete_chars(newLabel, "\n");
            makeTimeScales(1, 0.0125, 0, map[0], map[0], newLabel, 
                           0, (pmin-wpmin)*(map[1]-map[0])/(pmax-pmin), 
                           0, 1, 1);
          } else {
            make_scales_with_label(1, 0, 1, 0.0, 0.0125, 0.0, 
                                   0.0, 1.0, 0, 0, 
                                   0, 0, 0, 0, yvar, 0, 0, ylabelScale);
          }
	}
      }
    }
    if (!(flags&NO_LABELS)) {
      plotTitle(title, 1, title_at_top, 1.0, 0.0, 0, 0);
      if (contour_label_interval>=0)
	plotTitle(topline, 0, 0, 1.0, 0.0, 0, 0);
    }
    set_linetype(pen[1]);
    draw_contours(data, xmin, xmax, ymin, ymax, nx, ny, contour_level, n_contours);
    if (contour_label_interval!=0) {
        set_linetype(pen[2]);
        label_contours(data, nx, ny, contour_level, n_contours,
            contour_label_interval, contour_label_offset,
            xmin, (double)dx, ymin, (double)dy);
        }
    set_linetype(pen[0]);

    if (nshapes)
      PlotShapesData(shape, nshapes, xmin, xmax, ymin, ymax);

    if (flags&DATE_STAMP)
        time_date_stamp();

    }
예제 #5
0
static int vino_do_ioctl(struct inode *inode, struct file *file,
			 unsigned int cmd, void *arg)
{
	struct video_device *dev = video_devdata(file);
	struct vino_device *v = dev->priv;

	switch (cmd) {
	case VIDIOCGCAP: {
		struct video_capability *cap = arg;

		strcpy(cap->name, vinostr);
		cap->type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE;
		cap->channels = VINO_INPUT_CHANNELS;
		cap->audios = 0;
		cap->maxwidth = VINO_PAL_WIDTH;
		cap->maxheight = VINO_PAL_HEIGHT;
		cap->minwidth = VINO_MIN_WIDTH;
		cap->minheight = VINO_MIN_HEIGHT;
		break;
	}
	case VIDIOCGCHAN: {
		struct video_channel *ch = arg;

		ch->flags = 0;
		ch->tuners = 0;
		switch (ch->channel) {
		case VINO_INPUT_COMP:
			ch->norm = VIDEO_MODE_PAL | VIDEO_MODE_NTSC;
			ch->type = VIDEO_TYPE_TV;
			strcpy(ch->name, "Composite");
			break;
		case VINO_INPUT_SVIDEO:
			ch->norm = VIDEO_MODE_PAL | VIDEO_MODE_NTSC;
			ch->type = VIDEO_TYPE_TV;
			strcpy(ch->name, "S-Video");
			break;
		case VINO_INPUT_CAMERA:
			ch->norm = VIDEO_MODE_NTSC;
			ch->type = VIDEO_TYPE_CAMERA;
			strcpy(ch->name, "IndyCam");
			break;
		default:
			return -EINVAL;
		}
		break;
	}
	case VIDIOCSCHAN: {
		struct video_channel *ch = arg;
		int err = 0;
		struct vino_device *w = (v->chan == VINO_CHAN_A) ?
					&Vino->chB : &Vino->chA;

		spin_lock(&Vino->input_lock);
		switch (ch->channel) {
		case VINO_INPUT_COMP:
		case VINO_INPUT_SVIDEO:
			if (!Vino->decoder.driver) {
				err = -ENODEV;
				break;
			}
			if (!Vino->decoder.owner)
				Vino->decoder.owner = v->chan;
			if (Vino->decoder.owner == v->chan)
				i2c_decoder_command(DECODER_SET_INPUT,
						    &ch->channel);
			else
				if (ch->channel != w->input) {
					err = -EBUSY;
					break;
				}
			if (Vino->camera.owner == v->chan)
				Vino->camera.owner =
					(w->input == VINO_INPUT_CAMERA) ?
					w->chan : 0;
			break;
		case VINO_INPUT_CAMERA:
			if (!Vino->camera.driver) {
				err = -ENODEV;
				break;
			}
			if (!Vino->camera.owner)
				Vino->camera.owner = v->chan;
			if (Vino->decoder.owner == v->chan)
				Vino->decoder.owner =
					(w->input == VINO_INPUT_COMP ||
					 w->input == VINO_INPUT_SVIDEO) ?
					w->chan : 0;
			break;
		default:
			err = -EINVAL;
		}
		if (!err)
			v->input = ch->channel;
		spin_unlock(&Vino->input_lock);

		return err;
	}
	case VIDIOCGPICT: {
		struct video_picture *pic = arg;

		memcpy(pic, &v->picture, sizeof(struct video_picture));
		break;
	}
	case VIDIOCSPICT: {
		struct video_picture *pic = arg;

		switch (pic->palette) {
		case VIDEO_PALETTE_GREY:
			pic->depth = 8;
			break;
		case VIDEO_PALETTE_YUV422:
			pic->depth = 16;
			break;
		case VIDEO_PALETTE_RGB32:
			pic->depth = 24;
			break;
		default:
			return -EINVAL;
		}
		if (v->picture.palette != pic->palette) {
			v->picture.palette = pic->palette;
			v->picture.depth = pic->depth;
			/* TODO: we need to change line size */
		}
		DEBUG("XXX %d, %d\n", v->input, Vino->camera.owner);
		spin_lock(&Vino->input_lock);
		if (v->input == VINO_INPUT_CAMERA) {
			if (Vino->camera.owner == v->chan) {
				spin_unlock(&Vino->input_lock);
				memcpy(&v->picture, pic,
					sizeof(struct video_picture));
				i2c_camera_command(DECODER_SET_PICTURE, pic);
				goto out_unlocked;
			}
		} else {
			if (Vino->decoder.owner == v->chan) {
				spin_unlock(&Vino->input_lock);
				memcpy(&v->picture, pic,
					sizeof(struct video_picture));
				i2c_decoder_command(DECODER_SET_PICTURE, pic);
				goto out_unlocked;
			}
		}
		spin_unlock(&Vino->input_lock);
out_unlocked:
		break;
	}
	/* get cropping */
	case VIDIOCGCAPTURE: {
		struct video_capture *capture = arg;

		capture->x = v->left;
		capture->y = v->top;
		capture->width = v->right - v->left;
		capture->height = v->bottom - v->top;
		capture->decimation = v->decimation;
		capture->flags = 0;
		break;
	}
	/* set cropping */
	case VIDIOCSCAPTURE: {
		struct video_capture *capture = arg; 
		
		return set_clipping(v, capture->x, capture->y, capture->width,
				    capture->height, capture->decimation);
	}
	/* get scaling */
	case VIDIOCGWIN: {
		struct video_window *win = arg;

		memset(win, 0, sizeof(*win));
		win->width = (v->right - v->left) / v->decimation;
		win->height = (v->bottom - v->top) / v->decimation;
		break;
	}
	/* set scaling */
	case VIDIOCSWIN: {
		struct video_window *win = arg;

		if (win->x || win->y || win->clipcount || win->clips)
			return -EINVAL;
		return set_scaling(v, win->width, win->height);
	}
	case VIDIOCGMBUF: {
		struct video_mbuf *buf = arg;

		buf->frames = 1;
		buf->offsets[0] = 0;
		buf->size = v->page_count * PAGE_SIZE;
		break;
	}
	case VIDIOCMCAPTURE: {
		struct video_mmap *mmap = arg; 

		if (mmap->width != v->right - v->left ||
		    mmap->height != v->bottom - v->top ||
		    mmap->format != v->picture.palette ||
		    mmap->frame != 0)
			return -EINVAL;

		return vino_grab(v, mmap->frame);
	}
	case VIDIOCSYNC:
		return vino_waitfor(v, *((int*)arg));
	default:
		return -ENOIOCTLCMD;
	}
	return 0;
}