IDrawPol.c
资源名称:ilib [点击查看]
上传用户:changbiao
上传日期:2007-01-13
资源大小:141k
文件大小:1k
源码类别:

图片显示

开发平台:

C/C++

  1. /*
  2.  * IDrawPol.c
  3.  *
  4.  * Image library
  5.  *
  6.  * Description:
  7.  * Portable routines to manipulate raster images.
  8.  *
  9.  * History:
  10. * 22-Nov-99 Craig Knudsen cknudsen@radix.net
  11.  * Created
  12.  *
  13.  ****************************************************************************/
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <ctype.h>
  17. #include <memory.h>
  18. #include <math.h>
  19. #include "Ilib.h"
  20. #include "IlibP.h"
  21. IError IDrawPolygon ( image, gc, points, npoints )
  22. IImage image;
  23. IGC gc;
  24. IPoint *points;
  25. int npoints;
  26. {
  27.   IGCP *gcp = (IGCP *)gc;
  28.   IImageP *imagep = (IImageP *)image;
  29.   int loop;
  30.   if ( ! gcp )
  31.     return ( IInvalidGC );
  32.   if ( gcp->magic != IMAGIC_GC )
  33.     return ( IInvalidGC );
  34.   if ( ! imagep )
  35.     return ( IInvalidImage );
  36.   if ( imagep->magic != IMAGIC_IMAGE )
  37.     return ( IInvalidImage );
  38.   for ( loop = 1; loop < npoints; loop++ ) {
  39.     IDrawLine ( image, gc, points[loop-1].x, points[loop-1].y,
  40.       points[loop].x, points[loop].y );
  41.   }
  42.   return ( INoError );
  43. }