⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g2_graphic_pd.c

📁 ViennaRNA-1.6.1
💻 C
📖 第 1 页 / 共 2 页
字号:
	    free(dpt);	    break;	}    } else {	for (i=0;i<N-1;i++)       /* emulate polygon with lines */	    g2_line_pd(pd,		       points[2*i], points[2*i+1],		       points[2*i+2], points[2*i+3]);	g2_line_pd(pd,points[2*N-2], points[2*N-1],points[0], points[1]);    }}/* * * Filled polygon (physical device) * */void g2_filled_polygon_pd(g2_physical_device *pd,			  int N, double *points){    int i;    int    *ipt;    double *dpt;    if(pd->ff[g2_FilledPolygon].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    ipt=g2_malloc(2*N*sizeof(int));	    for(i=0;i<2*N;i+=2)		g2_uc2pdc_int(pd, points[i+0], points[i+1], ipt+i, ipt+i+1);	    pd->ff[g2_FilledPolygon].fun(pd->pid, pd->pdp,					 N, ipt);	    free(ipt);	    break;	  case g2_DoubleCoor:	    dpt=g2_malloc(2*N*sizeof(double));	    for(i=0;i<2*N;i+=2)		g2_uc2pdc_double(pd,				  points[i+0], points[i+1], dpt+i, dpt+i+1);	    pd->ff[g2_FilledPolygon].fun(pd->pid, pd->pdp,					 N, dpt);	    free(dpt);	    break;	}    } else {	/* emulate filled polygon with .... */      }}/* * * Ellipse (physical device) * */void g2_ellipse_pd(g2_physical_device *pd,		   double x, double y, double r1, double r2){    int    ix, iy, ir1, ir2;    double dx, dy, dr1, dr2;    if(pd->ff[g2_Ellipse].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r1, r2, &ir1, &ir2);	    pd->ff[g2_Ellipse].fun(pd->pid, pd->pdp,				   ix, iy, ir1, ir2);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r1, r2, &dr1, &dr2);	    pd->ff[g2_Ellipse].fun(pd->pid, pd->pdp,				   dx, dy, dr1, dr2);	    break;	}    } else {	g2_arc_pd(pd, x, y, r1, r2, 0., 360.);   /* emulate ellipse with arc */    }}/* * * Filled ellipse (physical device) * */void g2_filled_ellipse_pd(g2_physical_device *pd,			  double x, double y, double r1, double r2){    int    ix, iy, ir1, ir2;    double dx, dy, dr1, dr2;    if(pd->ff[g2_FilledEllipse].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r1, r2, &ir1, &ir2);	    pd->ff[g2_FilledEllipse].fun(pd->pid, pd->pdp,					 ix, iy, ir1, ir2);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r1, r2, &dr1, &dr2);	    pd->ff[g2_FilledEllipse].fun(pd->pid, pd->pdp,					 dx, dy, dr1, dr2);	    break;	}    } else {	g2_filled_arc_pd(pd,        /* emulate filledellipse with filled arc */			 x, y,			 r1, r2,			 0., 360.);    }}/* * * Circle (physical device) * */void g2_circle_pd(g2_physical_device *pd,		  double x, double y, double r){    int    ix, iy, ir;    double dx, dy, dr;    if(pd->ff[g2_Circle].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r, 0, &ir, NULL);	    pd->ff[g2_Circle].fun(pd->pid, pd->pdp,				  ix, iy, ir);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r, 0, &dr, NULL);	    pd->ff[g2_Circle].fun(pd->pid, pd->pdp,				  dx, dy, dr);	    break;	}    } else {	g2_ellipse_pd(pd, x, y, r, r);	     /* emulate circle with ellipse */    }   }/* * * Filled circle (physical device) * */void g2_filled_circle_pd(g2_physical_device *pd,			 double x, double y, double r){    int    ix, iy, ir;    double dx, dy, dr;    if(pd->ff[g2_FilledCircle].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r, 0, &ir, NULL);	    pd->ff[g2_FilledCircle].fun(pd->pid, pd->pdp,					ix, iy, ir);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r, 0, &dr, NULL);	    pd->ff[g2_FilledCircle].fun(pd->pid, pd->pdp,					dx, dy, dr);	    break;	}    } else {	g2_filled_ellipse_pd(pd, x, y, r, r);           /* emulate */    }   }/* * * Arc (physical device) * */void g2_arc_pd(g2_physical_device *pd,	       double x, double y, double r1, double r2, double a1, double a2){    int    ix, iy, ir1, ir2;    double dx, dy, dr1, dr2;	    if(pd->ff[g2_Arc].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r1, r2, &ir1, &ir2);	    pd->ff[g2_Arc].fun(pd->pid, pd->pdp,			       ix, iy, ir1, ir2, a1, a2);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r1, r2, &dr1, &dr2);	    pd->ff[g2_Arc].fun(pd->pid, pd->pdp,			       dx, dy, dr1, dr2, a1, a2);	    break;	}    } else {	double a, da, *pt;			  /* emulate arc */	int N, i;	N=(a2==a1)?360:(int)fabs(a2-a1)+8;	a=a1*2.*PI/360.;	da=((a2>a1)? (a2-a1):360.-(a1-a2))*2.*PI/360./(N-1);	pt=g2_malloc(2*N*sizeof(double));	for(i=0;i<N;i++) {	    pt[2*i+0]=x+r1*cos(a+i*da);	    pt[2*i+1]=y+r2*sin(a+i*da);	}	g2_poly_line_pd(pd, N, pt);		  /* using poly_line */	g2_free(pt);    }}/* * * Filled arc (physical device) * */void g2_filled_arc_pd(g2_physical_device *pd,		      double x, double y,		      double r1, double r2,		      double a1, double a2){    int    ix, iy, ir1, ir2;    double dx, dy, dr1, dr2;    	    if(pd->ff[g2_FilledArc].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    g2_us2pds_int(pd, r1, r2, &ir1, &ir2);	    pd->ff[g2_FilledArc].fun(pd->pid, pd->pdp,				     ix, iy, ir1, ir2, a1, a2);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    g2_us2pds_double(pd, r1, r2, &dr1, &dr2);	    pd->ff[g2_FilledArc].fun(pd->pid, pd->pdp,				     dx, dy, dr1, dr2, a1, a2);	    break;	}    } else {	double a, da, *pt;			  /* emulate filled arc */	int N, i;	N=(a2==a1)?360:(int)fabs(a2-a1)+8;	a=a1*2.*PI/360.;	da=((a2>a1)? (a2-a1):360.-(a1-a2))*2.*PI/360./(N-1);	pt=g2_malloc(2*(N+2)*sizeof(double));	pt[0]=x;	pt[1]=y;	for(i=0;i<N;i++) {	    pt[2*i+2]=x+r1*cos(a+i*da);	    pt[2*i+3]=y+r2*sin(a+i*da);	}	pt[2*N+2]=x;	pt[2*N+3]=y;	g2_filled_polygon_pd(pd, N+2, pt);	  /* using filled polygon */	g2_free(pt);    }}/* * * Draw string (physical device) * */void g2_string_pd(g2_physical_device *pd,		  double x, double y, const char *text){    int    ix, iy;    double dx, dy;    if(pd->ff[g2_String].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    pd->ff[g2_String].fun(pd->pid, pd->pdp,				  ix, iy, text);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    pd->ff[g2_String].fun(pd->pid, pd->pdp,				  dx, dy, text);	    break;	}    } else {	/* emulate ... with .... */      }}void g2_image_pd(g2_physical_device *pd,	      double x, double y, int x_size, int y_size, int *pens){    int    ix, iy;    double dx, dy;    if(pd->ff[g2_Image].fun!=NULL) {	switch(pd->coor_type) {	  case g2_IntCoor:	    g2_uc2pdc_int(pd, x, y, &ix, &iy);	    pd->ff[g2_Image].fun(pd->pid, pd->pdp,				 ix, iy, x_size, y_size, pens);	    break;	  case g2_DoubleCoor:	    g2_uc2pdc_double(pd, x, y, &dx, &dy);	    pd->ff[g2_Image].fun(pd->pid, pd->pdp,				 dx, dy, x_size, y_size, pens);	    break;	}    } else {	for(ix=0;ix<x_size;ix++) 	    for(iy=0;iy<y_size;iy++) {		g2_pen_pd(pd, pens[ix+x_size*iy]);		g2_plot_pd(pd, ix+x, (y_size-iy-1)+y);	    }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -