void gpath_draw_outline(GContext *ctx, GPath *path) { Sint16* pointsX,* pointsY; _gpath_to_sdl (path,&pointsX,&pointsY); polygonColor(getTopScreen(), pointsX, pointsY, path->num_points, getRawColor(ctx->stroke_color)); free(pointsX); free(pointsY); }
int GeoLayer::polygon(int16_t *vx, int16_t *vy, int num_vertex, uint32_t col) { if(!surf) { error("%s can't run: layer not initialized", __PRETTY_FUNCTION__); return -1; } res = polygonColor(surf, vx, vy, num_vertex, col); if(res < 0) error("error in %s", __PRETTY_FUNCTION__); return(res); }
void TSketcher::polytab(int nb,Sint16 *tabx,Sint16 *taby, int col) { int n; for (n=0; n<nb; n++) { tabx[n] = tabx[n]*w/mw+ox; taby[n] = taby[n]*h/mh+oy; } if (filled_poly) filledPolygonColor(sf,tabx,taby,nb,col); else polygonColor(sf,tabx,taby,nb,col); }
/***************************************************************** 関数名 : DrawDiamond 機能 : メインウインドウに菱形を表示する 引数 : int x : 左上の x 座標 int y : 左上の y 座標 int height : 高さ 出力 : なし *****************************************************************/ void DrawDiamond(int x,int y,int height) { Sint16 vx[5],vy[5]; int i; #ifndef NDEBUG printf("#####\n"); printf("DrawDiamond()\n"); printf("x=%d,y=%d,height=%d\n",x,y,height); #endif for(i=0;i<4;i++){ vx[i] = x + height*((1-i)%2)/2; vy[i] = y + height*((2-i)%2); } vx[4]=vx[0]; vy[4]=vy[0]; polygonColor(gMainWindow, vx, vy, 5 , 0x000000ff); SDL_Flip(gMainWindow); }
static PyObject* _gfx_polygoncolor (PyObject *self, PyObject* args) { PyObject *surface, *color, *points, *item; Sint16 *vx, *vy; int tmp1, tmp2; Py_ssize_t count, i; int ret; pguint32 c; ASSERT_VIDEO_INIT (NULL); if (!PyArg_ParseTuple (args, "OOO:polygon", &surface, &points, &color)) return NULL; if (!PySDLSurface_Check (surface)) { PyErr_SetString (PyExc_TypeError, "surface must be a Surface"); return NULL; } if (!PySequence_Check (points)) { PyErr_SetString (PyExc_TypeError, "points must be a sequence"); return NULL; } count = PySequence_Size (points); if (count < 3) { PyErr_SetString (PyExc_ValueError, "points must contain more than 2 points"); return NULL; } if (!ColorFromObj (color, &c)) return NULL; vx = PyMem_New (Sint16, (size_t) count); vy = PyMem_New (Sint16, (size_t) count); if (!vx || !vy) { if (vx) PyMem_Free (vx); if (vy) PyMem_Free (vy); return NULL; } for (i = 0; i < count; i++) { item = PySequence_ITEM (points, i); if (!PointFromObj (item, &tmp1, &tmp2)) { PyMem_Free (vx); PyMem_Free (vy); Py_XDECREF (item); return NULL; } Py_DECREF (item); vx[i] = (Sint16)tmp1; vy[i] = (Sint16)tmp2; } Py_BEGIN_ALLOW_THREADS; ret = polygonColor (((PySDLSurface*)surface)->surface, vx, vy, (int)count, (Uint32)c); Py_END_ALLOW_THREADS; PyMem_Free (vx); PyMem_Free (vy); if (ret == -1) { PyErr_SetString (PyExc_PyGameError, SDL_GetError ()); return NULL; } Py_RETURN_NONE; }