當前位置: 首頁>>代碼示例>>Java>>正文


Java Rect類代碼示例

本文整理匯總了Java中com.caverock.androidsvg.SVG.Rect的典型用法代碼示例。如果您正苦於以下問題:Java Rect類的具體用法?Java Rect怎麽用?Java Rect使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Rect類屬於com.caverock.androidsvg.SVG包,在下文中一共展示了Rect類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processText

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
@Override
public void processText(String text) {
	if (visible()) {
		android.graphics.Rect rect = new android.graphics.Rect();
		// Get text bounding box (for offset 0)
		state.fillPaint.getTextBounds(text, 0, text.length(), rect);
		RectF textbounds = new RectF(rect);
		// Adjust bounds to offset at text position
		textbounds.offset(x, y);
		// Merge with accumulated bounding box
		bbox.union(textbounds);
	}

	// Update the current text position
	x += state.fillPaint.measureText(text);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:17,代碼來源:SVGAndroidRenderer.java

示例2: processText

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
@Override
public void processText(String text) {
    if (visible()) {
        android.graphics.Rect rect = new android.graphics.Rect();
        // Get text bounding box (for offset 0)
        state.fillPaint.getTextBounds(text, 0, text.length(), rect);
        RectF textbounds = new RectF(rect);
        // Adjust bounds to offset at text position
        textbounds.offset(x, y);
        // Merge with accumulated bounding box
        bbox.union(textbounds);
    }

    // Update the current text position
    x += state.fillPaint.measureText(text);
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:17,代碼來源:SVGAndroidRenderer.java

示例3: processText

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
@Override
public void processText(String text)
{
   if (visible())
   {
      android.graphics.Rect  rect = new android.graphics.Rect();
      // Get text bounding box (for offset 0)
      state.fillPaint.getTextBounds(text, 0, text.length(), rect);
      RectF  textbounds = new RectF(rect);
      // Adjust bounds to offset at text position
      textbounds.offset(x, y);
      // Merge with accumulated bounding box
      bbox.union(textbounds);
   }

   // Update the current text position
   x += state.fillPaint.measureText(text);
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:19,代碼來源:SVGAndroidRenderer.java

示例4: render

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void render(SVG.SvgObject obj) {
	if (obj instanceof NotDirectlyRendered)
		return;

	// Save state
	statePush();

	checkXMLSpaceAttribute(obj);

	if (obj instanceof SVG.Svg) {
		render((SVG.Svg) obj);
	} else if (obj instanceof SVG.Use) {
		render((SVG.Use) obj);
	} else if (obj instanceof SVG.Switch) {
		render((SVG.Switch) obj);
	} else if (obj instanceof SVG.Group) {
		render((SVG.Group) obj);
	} else if (obj instanceof SVG.Image) {
		render((SVG.Image) obj);
	} else if (obj instanceof SVG.Path) {
		render((SVG.Path) obj);
	} else if (obj instanceof SVG.Rect) {
		render((SVG.Rect) obj);
	} else if (obj instanceof SVG.Circle) {
		render((SVG.Circle) obj);
	} else if (obj instanceof SVG.Ellipse) {
		render((SVG.Ellipse) obj);
	} else if (obj instanceof SVG.Line) {
		render((SVG.Line) obj);
	} else if (obj instanceof SVG.Polygon) {
		render((SVG.Polygon) obj);
	} else if (obj instanceof SVG.PolyLine) {
		render((SVG.PolyLine) obj);
	} else if (obj instanceof SVG.Text) {
		render((SVG.Text) obj);
	}

	// Restore state
	statePop();
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:41,代碼來源:SVGAndroidRenderer.java

示例5: addObjectToClip

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void addObjectToClip(SVG.GraphicsElement obj, Path combinedPath,
		Matrix combinedPathMatrix) {
	updateStyleForElement(state, obj);

	if (!display())
		return;
	if (!visible())
		return;

	if (obj.transform != null)
		combinedPathMatrix.preConcat(obj.transform);

	Path path;
	if (obj instanceof SVG.Rect)
		path = makePathAndBoundingBox((SVG.Rect) obj);
	else if (obj instanceof SVG.Circle)
		path = makePathAndBoundingBox((SVG.Circle) obj);
	else if (obj instanceof SVG.Ellipse)
		path = makePathAndBoundingBox((SVG.Ellipse) obj);
	else if (obj instanceof SVG.PolyLine)
		path = makePathAndBoundingBox((SVG.PolyLine) obj);
	else
		return;

	checkForClipPath(obj);

	combinedPath.setFillType(path.getFillType());
	combinedPath.addPath(path, combinedPathMatrix);
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:30,代碼來源:SVGAndroidRenderer.java

示例6: render

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void render(SVG.SvgObject obj) {
    if (obj instanceof NotDirectlyRendered)
        return;

    // Save state
    statePush();

    checkXMLSpaceAttribute(obj);

    if (obj instanceof SVG.Svg) {
        render((SVG.Svg) obj);
    } else if (obj instanceof SVG.Use) {
        render((SVG.Use) obj);
    } else if (obj instanceof SVG.Switch) {
        render((SVG.Switch) obj);
    } else if (obj instanceof SVG.Group) {
        render((SVG.Group) obj);
    } else if (obj instanceof SVG.Image) {
        render((SVG.Image) obj);
    } else if (obj instanceof SVG.Path) {
        render((SVG.Path) obj);
    } else if (obj instanceof SVG.Rect) {
        render((SVG.Rect) obj);
    } else if (obj instanceof SVG.Circle) {
        render((SVG.Circle) obj);
    } else if (obj instanceof SVG.Ellipse) {
        render((SVG.Ellipse) obj);
    } else if (obj instanceof SVG.Line) {
        render((SVG.Line) obj);
    } else if (obj instanceof SVG.Polygon) {
        render((SVG.Polygon) obj);
    } else if (obj instanceof SVG.PolyLine) {
        render((SVG.PolyLine) obj);
    } else if (obj instanceof SVG.Text) {
        render((SVG.Text) obj);
    }

    // Restore state
    statePop();
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:41,代碼來源:SVGAndroidRenderer.java

示例7: addObjectToClip

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void addObjectToClip(SVG.GraphicsElement obj, Path combinedPath, Matrix combinedPathMatrix) {
    updateStyleForElement(state, obj);

    if (!display())
        return;
    if (!visible())
        return;

    if (obj.transform != null)
        combinedPathMatrix.preConcat(obj.transform);

    Path path;
    if (obj instanceof SVG.Rect)
        path = makePathAndBoundingBox((SVG.Rect) obj);
    else if (obj instanceof SVG.Circle)
        path = makePathAndBoundingBox((SVG.Circle) obj);
    else if (obj instanceof SVG.Ellipse)
        path = makePathAndBoundingBox((SVG.Ellipse) obj);
    else if (obj instanceof SVG.PolyLine)
        path = makePathAndBoundingBox((SVG.PolyLine) obj);
    else
        return;

    checkForClipPath(obj);

    combinedPath.setFillType(path.getFillType());
    combinedPath.addPath(path, combinedPathMatrix);
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:29,代碼來源:SVGAndroidRenderer.java

示例8: render

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void render(SVG.Rect obj)
{
   debug("Rect render");

   if (obj.width == null || obj.height == null || obj.width.isZero() || obj.height.isZero())
      return;

   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;

   if (obj.transform != null)
      canvas.concat(obj.transform);

   Path  path = makePathAndBoundingBox(obj);
   updateParentBoundingBox(obj);

   checkForGradientsAndPatterns(obj);
   checkForClipPath(obj);

   boolean  compositing = pushLayer();

   if (state.hasFill)
      doFilledPath(obj, path);
   if (state.hasStroke)
      doStroke(path);


   if (compositing)
      popLayer(obj);
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:35,代碼來源:SVGAndroidRenderer.java

示例9: addObjectToClip

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private void addObjectToClip(SVG.GraphicsElement obj, Path combinedPath, Matrix combinedPathMatrix)
{
   updateStyleForElement(state, obj);

   if (!display())
      return;
   if (!visible())
      return;

   if (obj.transform != null)
      combinedPathMatrix.preConcat(obj.transform);

   Path  path;
   if (obj instanceof SVG.Rect)
      path = makePathAndBoundingBox((SVG.Rect) obj);
   else if (obj instanceof SVG.Circle)
      path = makePathAndBoundingBox((SVG.Circle) obj);
   else if (obj instanceof SVG.Ellipse)
      path = makePathAndBoundingBox((SVG.Ellipse) obj);
   else if (obj instanceof SVG.PolyLine)
      path = makePathAndBoundingBox((SVG.PolyLine) obj);
   else
      return;

   checkForClipPath(obj);

   combinedPath.setFillType(path.getFillType());
   combinedPath.addPath(path, combinedPathMatrix);
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:30,代碼來源:SVGAndroidRenderer.java

示例10: makePathAndBoundingBox

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private Path makePathAndBoundingBox(Rect obj) {
	float x, y, w, h, rx, ry;

	if (obj.rx == null && obj.ry == null) {
		rx = 0;
		ry = 0;
	} else if (obj.rx == null) {
		rx = ry = obj.ry.floatValueY(this);
	} else if (obj.ry == null) {
		rx = ry = obj.rx.floatValueX(this);
	} else {
		rx = obj.rx.floatValueX(this);
		ry = obj.ry.floatValueY(this);
	}
	rx = Math.min(rx, obj.width.floatValueX(this) / 2f);
	ry = Math.min(ry, obj.height.floatValueY(this) / 2f);
	x = (obj.x != null) ? obj.x.floatValueX(this) : 0f;
	y = (obj.y != null) ? obj.y.floatValueY(this) : 0f;
	w = obj.width.floatValueX(this);
	h = obj.height.floatValueY(this);

	if (obj.boundingBox == null) {
		obj.boundingBox = new Box(x, y, w, h);
	}

	float right = x + w;
	float bottom = y + h;

	Path p = new Path();
	if (rx == 0 || ry == 0) {
		// Simple rect
		p.moveTo(x, y);
		p.lineTo(right, y);
		p.lineTo(right, bottom);
		p.lineTo(x, bottom);
		p.lineTo(x, y);
	} else {
		// Rounded rect

		// Bexier control point lengths for a 90 degress arc
		float cpx = rx * BEZIER_ARC_FACTOR;
		float cpy = ry * BEZIER_ARC_FACTOR;

		p.moveTo(x, y + ry);
		p.cubicTo(x, y + ry - cpy, x + rx - cpx, y, x + rx, y);
		p.lineTo(right - rx, y);
		p.cubicTo(right - rx + cpx, y, right, y + ry - cpy, right, y + ry);
		p.lineTo(right, bottom - ry);
		p.cubicTo(right, bottom - ry + cpy, right - rx + cpx, bottom, right
				- rx, bottom);
		p.lineTo(x + rx, bottom);
		p.cubicTo(x + rx - cpx, bottom, x, bottom - ry + cpy, x, bottom
				- ry);
		p.lineTo(x, y + ry);
	}
	p.close();
	return p;
}
 
開發者ID:mkulesh,項目名稱:microMathematics,代碼行數:59,代碼來源:SVGAndroidRenderer.java

示例11: makePathAndBoundingBox

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private Path makePathAndBoundingBox(Rect obj) {
    float x, y, w, h, rx, ry;

    if (obj.rx == null && obj.ry == null) {
        rx = 0;
        ry = 0;
    } else if (obj.rx == null) {
        rx = ry = obj.ry.floatValueY(this);
    } else if (obj.ry == null) {
        rx = ry = obj.rx.floatValueX(this);
    } else {
        rx = obj.rx.floatValueX(this);
        ry = obj.ry.floatValueY(this);
    }
    rx = Math.min(rx, obj.width.floatValueX(this) / 2f);
    ry = Math.min(ry, obj.height.floatValueY(this) / 2f);
    x = (obj.x != null) ? obj.x.floatValueX(this) : 0f;
    y = (obj.y != null) ? obj.y.floatValueY(this) : 0f;
    w = obj.width.floatValueX(this);
    h = obj.height.floatValueY(this);

    if (obj.boundingBox == null) {
        obj.boundingBox = new Box(x, y, w, h);
    }

    float right = x + w;
    float bottom = y + h;

    Path p = new Path();
    if (rx == 0 || ry == 0) {
        // Simple rect
        p.moveTo(x, y);
        p.lineTo(right, y);
        p.lineTo(right, bottom);
        p.lineTo(x, bottom);
        p.lineTo(x, y);
    } else {
        // Rounded rect

        // Bexier control point lengths for a 90 degress arc
        float cpx = rx * BEZIER_ARC_FACTOR;
        float cpy = ry * BEZIER_ARC_FACTOR;

        p.moveTo(x, y + ry);
        p.cubicTo(x, y + ry - cpy, x + rx - cpx, y, x + rx, y);
        p.lineTo(right - rx, y);
        p.cubicTo(right - rx + cpx, y, right, y + ry - cpy, right, y + ry);
        p.lineTo(right, bottom - ry);
        p.cubicTo(right, bottom - ry + cpy, right - rx + cpx, bottom, right - rx, bottom);
        p.lineTo(x + rx, bottom);
        p.cubicTo(x + rx - cpx, bottom, x, bottom - ry + cpy, x, bottom - ry);
        p.lineTo(x, y + ry);
    }
    p.close();
    return p;
}
 
開發者ID:StepicOrg,項目名稱:stepik-android,代碼行數:57,代碼來源:SVGAndroidRenderer.java

示例12: makePathAndBoundingBox

import com.caverock.androidsvg.SVG.Rect; //導入依賴的package包/類
private Path  makePathAndBoundingBox(Rect obj)
{
   float x, y, w, h, rx, ry;

   if (obj.rx == null && obj.ry == null) {
      rx = 0;
      ry = 0;
   } else if (obj.rx == null) {
      rx = ry = obj.ry.floatValueY(this);
   } else if (obj.ry == null) {
      rx = ry = obj.rx.floatValueX(this);
   } else {
      rx = obj.rx.floatValueX(this);
      ry = obj.ry.floatValueY(this);
   }
   rx = Math.min(rx, obj.width.floatValueX(this) / 2f);
   ry = Math.min(ry, obj.height.floatValueY(this) / 2f);
   x = (obj.x != null) ? obj.x.floatValueX(this) : 0f;
   y = (obj.y != null) ? obj.y.floatValueY(this) : 0f;
   w = obj.width.floatValueX(this);
   h = obj.height.floatValueY(this);

   if (obj.boundingBox == null) {
      obj.boundingBox = new Box(x, y, w, h);
   }

   float  right = x + w;
   float  bottom = y + h;

   Path  p = new Path();
   if (rx == 0 || ry == 0)
   {
      // Simple rect
      p.moveTo(x, y);
      p.lineTo(right, y);
      p.lineTo(right, bottom);
      p.lineTo(x, bottom);
      p.lineTo(x, y);
   }
   else
   {
      // Rounded rect
      
      // Bexier control point lengths for a 90 degress arc
      float  cpx = rx * BEZIER_ARC_FACTOR;
      float  cpy = ry * BEZIER_ARC_FACTOR;

      p.moveTo(x, y+ry);
      p.cubicTo(x, y+ry-cpy, x+rx-cpx, y, x+rx, y);
      p.lineTo(right-rx, y);
      p.cubicTo(right-rx+cpx, y, right, y+ry-cpy, right, y+ry);
      p.lineTo(right, bottom-ry);
      p.cubicTo(right, bottom-ry+cpy, right-rx+cpx, bottom, right-rx, bottom);
      p.lineTo(x+rx, bottom);
      p.cubicTo(x+rx-cpx, bottom, x, bottom-ry+cpy, x, bottom-ry);
      p.lineTo(x, y+ry);
   }
   p.close();
   return p;
}
 
開發者ID:moneymanagerex,項目名稱:android-money-manager-ex,代碼行數:61,代碼來源:SVGAndroidRenderer.java


注:本文中的com.caverock.androidsvg.SVG.Rect類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。