[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

New arrow head



Hello All,

I had the need for an 'X' as an arrow head (see attached image for an
example) so made a little amendment to dia.  I hope this can be
incporated in to a future version.

Thank you
-- 
Michael Smith <michael.smith@marketpipe.com>

Diagram1.png

static void
draw_slashed_cross2(DiaRenderer *renderer, Point *to, Point *from,
		           real length, real width, real linewidth, Color *fg_color, Color *bg_color)
{
  Point vl,vt;
  Point bs,be, bs2,be2, bs3,be3;
  
  DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, linewidth);
  DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID);
  DIA_RENDERER_GET_CLASS(renderer)->set_linejoin(renderer, LINEJOIN_MITER);
  DIA_RENDERER_GET_CLASS(renderer)->set_linecaps(renderer, LINECAPS_BUTT);
  
  point_copy(&vl,from); point_sub(&vl,to);
  if (point_len(&vl) > 0)
	point_normalize(&vl);
  else {
	vl.x = 1.0; vl.y = 0.0;
  }
  if (!finite(vl.x)) {
	vl.x = 1.0; vl.y = 0.0;
  }
  point_get_perp(&vt,&vl);
  point_copy_add_scaled(&bs,to,&vl,length/2);
  point_copy_add_scaled(&be,&bs,&vt,-width/2.0);
  point_add_scaled(&bs,&vt,width/2.0);
  
  point_copy_add_scaled(&bs2,to,&vl,length/2);
  point_copy_add_scaled(&be2,&bs2,&vl,length/2);
  
  point_copy_add_scaled(&bs3,to,&vl,.0*length);
  point_add_scaled(&bs3,&vt,.4*width); 
  point_add_scaled(&bs3,&vl,-.4*length);
  point_copy_add_scaled(&be3,to,&vl,.0*length);
  point_add_scaled(&be3,&vt,-.4*width);
  point_add_scaled(&be3,&vl,.4*length);
  
  point_copy_add_scaled(&bs,to,&vl,.0*length);
  point_add_scaled(&bs,&vl,-.4*width);
  point_add_scaled(&bs,&vt,-.4*length);
  point_copy_add_scaled(&be,to,&vl,.0*length);
  point_add_scaled(&be,&vl,.4*width);
  point_add_scaled(&be,&vt,.4*length);
   
  DIA_RENDERER_GET_CLASS(renderer)->draw_line(renderer, &bs, &be, fg_color);
  DIA_RENDERER_GET_CLASS(renderer)->draw_line(renderer, &bs3, &be3, fg_color); 
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK