コード例 #1
0
ファイル: absfont_metrics.c プロジェクト: Acidburn0zzz/afdko
/* Add line to path. */
static void glyphLine(abfGlyphCallbacks *cb, float x1, float y1)
	{
	abfMetricsCtx h = cb->direct_ctx;

	if (h->flags & ABF_MTX_TRANSFORM)
		boundPoint(h, TX(x1, y1), TY(x1, y1));
	else
		boundPoint(h, x1, y1);

	h->x = x1;
	h->y = y1;
	}
コード例 #2
0
ファイル: absfont_metrics.c プロジェクト: Acidburn0zzz/afdko
/* Add curve to path. */
static void glyphCurve(abfGlyphCallbacks *cb,
					   float x1, float y1, 
					   float x2, float y2, 
					   float x3, float y3)
	{
	abfMetricsCtx h = cb->direct_ctx;
	Rect ep;	/* End-point bounds */
	Rect cp;	/* Control-point bounds */
	float x0 = h->x;
	float y0 = h->y;

	if (h->flags & ABF_MTX_TRANSFORM)
		{
		/* Transform curve */
		float xt;
		xt = x0; x0 = TX(xt, y0); y0 = TY(xt, y0);
		xt = x1; x1 = TX(xt, y1); y1 = TY(xt, y1);
		xt = x2; x2 = TX(xt, y2); y2 = TY(xt, y2);
		xt = x3; x3 = TX(xt, y3); y3 = TY(xt, y3);
		}

	setLineBounds(&ep, x0, y0, x3, y3);
	setLineBounds(&cp, x1, y1, x2, y2);

	if (ep.left   < h->real_mtx.left ||
		ep.bottom < h->real_mtx.bottom ||
		ep.right  > h->real_mtx.right ||
		ep.top    > h->real_mtx.top ||
		cp.left   < h->real_mtx.left ||
		cp.bottom < h->real_mtx.bottom ||
		cp.right  > h->real_mtx.right ||
		cp.top    > h->real_mtx.top)
		{
		/* Curve may extend bounds */
		if (cp.left < ep.left || cp.right > ep.right)
			/* Grow left and/or right bounds */
			setBezLimits(x0, x1, x2, x3, &ep.left, &ep.right);

		if (cp.bottom < ep.bottom || cp.top > ep.top)
			/* Grow top and/or bottom bounds */
			setBezLimits(y0, y1, y2, y3, &ep.bottom, &ep.top);

		boundPoint(h, ep.left, ep.bottom);
		boundPoint(h, ep.right, ep.top);
		}

	h->x = x3;
	h->y = y3;
	}
コード例 #3
0
ファイル: absfont_metrics.c プロジェクト: Acidburn0zzz/afdko
/* Add move to path. */
static void glyphMove(abfGlyphCallbacks *cb, float x0, float y0)
	{
	abfMetricsCtx h = cb->direct_ctx;
	float x;
	float y;

	if (h->flags & ABF_MTX_TRANSFORM)
		{
		x = TX(x0, y0);
		y = TY(x0, y0);
		}
	else
		{
		x = x0;
		y = y0;
		}

	if (h->flags & SEEN_MOVE)
		boundPoint(h, x, y);
	else
		{
		/* Set bounds to first point */
		h->real_mtx.left = h->real_mtx.right = x;
		h->real_mtx.bottom = h->real_mtx.top = y;
		}

	h->x = x0;
	h->y = y0;
	h->flags |= SEEN_MOVE;
	}
コード例 #4
0
ファイル: mapeditordialog.cpp プロジェクト: FXIhub/hawk
void MapEditorWidget::movePoint(int index, const QPointF &point, bool emitUpdate)
{
    points[index] = boundPoint(point, plotArea);
  if (emitUpdate){
    firePointChange();
  }
}