本文整理汇总了Java中com.sun.javafx.geom.Rectangle类的典型用法代码示例。如果您正苦于以下问题:Java Rectangle类的具体用法?Java Rectangle怎么用?Java Rectangle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle类属于com.sun.javafx.geom包,在下文中一共展示了Rectangle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mouseMoved
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
public boolean mouseMoved(MouseMovedEvent e) {
if (pickedItem != null) {
pickedX = e.getX();
pickedY = e.getY();
return true;
}
if (!open && new Rectangle((int)pos.x, (int)pos.y, 155, 30).contains(e.getX(), e.getY())) {
setWidth(160);
setText("INVENTORY");
return true;
} else if (!open) {
setWidth(20);
setText("I");
return false;
}
return false;
}
开发者ID:ritcat14,项目名称:The-Mysterious-Mind-Of-Jack,代码行数:18,代码来源:Inventory.java
示例2: filter
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
@Override
public ImageData filter(FilterContext fctx, BaseTransform transform,
Rectangle outputClip, Object renderHelper,
Effect defaultInput)
{
BaseBounds bounds = getBounds(transform, defaultInput);
if (outputClip != null) {
bounds.intersectWith(outputClip);
}
Rectangle r = new Rectangle(bounds);
if (r.width < 1) r.width = 1;
if (r.height < 1) r.height = 1;
PrDrawable ret = (PrDrawable) Effect.getCompatibleImage(fctx, r.width, r.height);
if (ret != null) {
Graphics g = ret.createGraphics();
g.setExtraAlpha(globalAlpha);
g.translate(-r.x, -r.y);
if (transform != null) {
g.transform(transform);
}
buf.restore();
handleRenderOp(token, buf, g, null);
}
return new ImageData(fctx, ret, r);
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:26,代码来源:NGCanvas.java
示例3: getResultBounds
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
@Override
public Rectangle getResultBounds(BaseTransform transform,
Rectangle outputClip,
ImageData... inputDatas)
{
// There is a bug in the ImageData class that means that the
// outputClip will not be taken into account, so we override
// here and apply it ourselves.
Rectangle r = super.getResultBounds(transform, outputClip, inputDatas);
r.intersectWith(outputClip);
return r;
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:13,代码来源:NGCanvas.java
示例4: initRenderer
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
private static DPathConsumer2D initRenderer(
final DRendererContext rdrCtx,
final BasicStroke stroke,
final BaseTransform tx,
final Rectangle clip,
final int piRule,
final DMarlinRenderer renderer)
{
if (DO_CLIP || (DO_CLIP_RUNTIME_ENABLE && MarlinProperties.isDoClipAtRuntime())) {
// Define the initial clip bounds:
final double[] clipRect = rdrCtx.clipRect;
clipRect[0] = clip.y;
clipRect[1] = clip.y + clip.height;
clipRect[2] = clip.x;
clipRect[3] = clip.x + clip.width;
// Enable clipping:
rdrCtx.doClip = true;
}
if (stroke != null) {
renderer.init(clip.x, clip.y, clip.width, clip.height,
MarlinConst.WIND_NON_ZERO);
return initStroker(rdrCtx, stroke, stroke.getLineWidth(), tx, renderer);
} else {
// Filler:
final int oprule = (piRule == PathIterator.WIND_EVEN_ODD) ?
MarlinConst.WIND_EVEN_ODD : MarlinConst.WIND_NON_ZERO;
renderer.init(clip.x, clip.y, clip.width, clip.height, oprule);
DPathConsumer2D pc = renderer;
final DTransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
if (DO_CLIP_FILL && rdrCtx.doClip) {
double rdrOffX = renderer.getOffsetX();
double rdrOffY = renderer.getOffsetY();
if (DO_TRACE_PATH) {
// trace Filler:
pc = rdrCtx.transformerPC2D.traceFiller(pc);
}
pc = rdrCtx.transformerPC2D.pathClipper(pc, rdrOffX, rdrOffY);
}
if (DO_TRACE_PATH) {
// trace Input:
pc = transformerPC2D.traceInput(pc);
}
return pc;
}
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:56,代码来源:DMarlinPrismUtils.java
示例5: getMaskData
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
@Override
public MaskData getMaskData(Shape shape,
BasicStroke stroke,
RectBounds xformBounds,
BaseTransform xform,
boolean close, boolean antialiasedShape)
{
if (stroke != null && stroke.getType() != BasicStroke.TYPE_CENTERED) {
// RT-27427
// TODO: Optimize the combinatorial strokes for simple
// shapes and/or teach the rasterizer to be able to
// do a "differential fill" between two shapes.
// Note that most simple shapes will use a more optimized path
// than this method for the INNER/OUTER strokes anyway.
shape = stroke.createStrokedShape(shape);
stroke = null;
}
if (xformBounds == null) {
if (stroke != null) {
// Note that all places that pass null for xformbounds also
// pass null for stroke so that the following is not typically
// executed, but just here as a safety net.
shape = stroke.createStrokedShape(shape);
stroke = null;
}
xformBounds = new RectBounds();
//TODO: Need to verify that this is a safe cast ... (RT-27427)
xformBounds = (RectBounds) xform.transform(shape.getBounds(), xformBounds);
}
if (xformBounds.isEmpty()) {
return EMPTY_MASK;
}
final RendererContext rdrCtx = MarlinRenderingEngine.getRendererContext();
MarlinRenderer renderer = null;
try {
final Rectangle rclip = rdrCtx.clip;
rclip.setBounds(xformBounds);
if (shape instanceof NGCanvasPath) {
final NGCanvasPath path = (NGCanvasPath)shape;
shape = path.getGeometry(); // use internal Path2D
// adjust xform:
xform = path.getCombinedTransform(xform);
}
renderer = MarlinPrismUtils.setupRenderer(rdrCtx, shape, stroke, xform, rclip,
antialiasedShape);
final int outpix_xmin = renderer.getOutpixMinX();
final int outpix_xmax = renderer.getOutpixMaxX();
final int outpix_ymin = renderer.getOutpixMinY();
final int outpix_ymax = renderer.getOutpixMaxY();
final int w = outpix_xmax - outpix_xmin;
final int h = outpix_ymax - outpix_ymin;
if ((w <= 0) || (h <= 0)) {
return EMPTY_MASK;
}
MaskMarlinAlphaConsumer consumer = rdrCtx.consumer;
if (consumer == null || (w * h) > consumer.getAlphaLength()) {
final int csize = (w * h + 0xfff) & (~0xfff);
rdrCtx.consumer = consumer = new MaskMarlinAlphaConsumer(csize);
if (PrismSettings.verbose) {
System.out.println("new alphas with length = " + csize);
}
}
consumer.setBoundsNoClone(outpix_xmin, outpix_ymin, w, h);
renderer.produceAlphas(consumer);
return consumer.getMaskData();
} finally {
if (renderer != null) {
renderer.dispose();
}
// recycle the RendererContext instance
MarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:80,代码来源:MarlinRasterizer.java
示例6: getMaskData
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
@Override
public MaskData getMaskData(Shape shape,
BasicStroke stroke,
RectBounds xformBounds,
BaseTransform xform,
boolean close, boolean antialiasedShape)
{
if (stroke != null && stroke.getType() != BasicStroke.TYPE_CENTERED) {
// RT-27427
// TODO: Optimize the combinatorial strokes for simple
// shapes and/or teach the rasterizer to be able to
// do a "differential fill" between two shapes.
// Note that most simple shapes will use a more optimized path
// than this method for the INNER/OUTER strokes anyway.
shape = stroke.createStrokedShape(shape);
stroke = null;
}
if (xformBounds == null) {
if (stroke != null) {
// Note that all places that pass null for xformbounds also
// pass null for stroke so that the following is not typically
// executed, but just here as a safety net.
shape = stroke.createStrokedShape(shape);
stroke = null;
}
xformBounds = new RectBounds();
//TODO: Need to verify that this is a safe cast ... (RT-27427)
xformBounds = (RectBounds) xform.transform(shape.getBounds(), xformBounds);
}
if (xformBounds.isEmpty()) {
return EMPTY_MASK;
}
final DRendererContext rdrCtx = DMarlinRenderingEngine.getRendererContext();
DMarlinRenderer renderer = null;
try {
final Rectangle rclip = rdrCtx.clip;
rclip.setBounds(xformBounds);
if (shape instanceof NGCanvasPath) {
final NGCanvasPath path = (NGCanvasPath)shape;
shape = path.getGeometry(); // use internal Path2D
// adjust xform:
xform = path.getCombinedTransform(xform);
}
renderer = DMarlinPrismUtils.setupRenderer(rdrCtx, shape, stroke, xform, rclip,
antialiasedShape);
final int outpix_xmin = renderer.getOutpixMinX();
final int outpix_xmax = renderer.getOutpixMaxX();
final int outpix_ymin = renderer.getOutpixMinY();
final int outpix_ymax = renderer.getOutpixMaxY();
final int w = outpix_xmax - outpix_xmin;
final int h = outpix_ymax - outpix_ymin;
if ((w <= 0) || (h <= 0)) {
return EMPTY_MASK;
}
MaskMarlinAlphaConsumer consumer = rdrCtx.consumer;
if (consumer == null || (w * h) > consumer.getAlphaLength()) {
final int csize = (w * h + 0xfff) & (~0xfff);
rdrCtx.consumer = consumer = new MaskMarlinAlphaConsumer(csize);
if (PrismSettings.verbose) {
System.out.println("new alphas with length = " + csize);
}
}
consumer.setBoundsNoClone(outpix_xmin, outpix_ymin, w, h);
renderer.produceAlphas(consumer);
return consumer.getMaskData();
} finally {
if (renderer != null) {
renderer.dispose();
}
// recycle the DRendererContext instance
DMarlinRenderingEngine.returnRendererContext(rdrCtx);
}
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:80,代码来源:DMarlinRasterizer.java
示例7: initRenderer
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
private static PathConsumer2D initRenderer(
final RendererContext rdrCtx,
final BasicStroke stroke,
final BaseTransform tx,
final Rectangle clip,
final int piRule,
final MarlinRenderer renderer)
{
if (DO_CLIP || (DO_CLIP_RUNTIME_ENABLE && MarlinProperties.isDoClipAtRuntime())) {
// Define the initial clip bounds:
final float[] clipRect = rdrCtx.clipRect;
clipRect[0] = clip.y;
clipRect[1] = clip.y + clip.height;
clipRect[2] = clip.x;
clipRect[3] = clip.x + clip.width;
// Enable clipping:
rdrCtx.doClip = true;
}
if (stroke != null) {
renderer.init(clip.x, clip.y, clip.width, clip.height,
MarlinConst.WIND_NON_ZERO);
return initStroker(rdrCtx, stroke, stroke.getLineWidth(), tx, renderer);
} else {
// Filler:
final int oprule = (piRule == PathIterator.WIND_EVEN_ODD) ?
MarlinConst.WIND_EVEN_ODD : MarlinConst.WIND_NON_ZERO;
renderer.init(clip.x, clip.y, clip.width, clip.height, oprule);
PathConsumer2D pc = renderer;
final TransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
if (DO_CLIP_FILL && rdrCtx.doClip) {
float rdrOffX = renderer.getOffsetX();
float rdrOffY = renderer.getOffsetY();
if (DO_TRACE_PATH) {
// trace Filler:
pc = rdrCtx.transformerPC2D.traceFiller(pc);
}
pc = rdrCtx.transformerPC2D.pathClipper(pc, rdrOffX, rdrOffY);
}
if (DO_TRACE_PATH) {
// trace Input:
pc = transformerPC2D.traceInput(pc);
}
return pc;
}
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:56,代码来源:MarlinPrismUtils.java
示例8: getBounds
import com.sun.javafx.geom.Rectangle; //导入依赖的package包/类
@Override
public BaseBounds getBounds(BaseTransform transform, Effect defaultInput) {
Rectangle r = new Rectangle(tex.getContentWidth(), tex.getContentHeight());
return transformBounds(transform, new RectBounds(r));
}
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:6,代码来源:NGCanvas.java
注:本文中的com.sun.javafx.geom.Rectangle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论