当前位置: 首页>>代码示例>>Java>>正文


Java WritableImage.getHeight方法代码示例

本文整理汇总了Java中javafx.scene.image.WritableImage.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java WritableImage.getHeight方法的具体用法?Java WritableImage.getHeight怎么用?Java WritableImage.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.image.WritableImage的用法示例。


在下文中一共展示了WritableImage.getHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderImage

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
private static void renderImage(WritableImage img, double gridSize, double hueFactor, double hueOffset) {
    PixelWriter pw = img.getPixelWriter();
    double w = img.getWidth();
    double h = img.getHeight();
    double xRatio = 0.0;
    double yRatio = 0.0;
    double hue = 0.0;

    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            xRatio = x/w;
            yRatio = y/h;
            hue = Math.sin(yRatio*(gridSize*Math.PI))*Math.sin(xRatio*(gridSize*Math.PI))*Math.tan(hueFactor/20.0)*360.0 + hueOffset;
            Color c = Color.hsb(hue, 1.0, 1.0);
            pw.setColor(x, y, c);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:19,代码来源:ImageOperatorSample.java

示例2: addColouredLabel

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
/**
 * Generates a "colored label", which is a rectangular graphic filled with the specified color, and containing the
 * specified text, and adds it to the provided {@link Pane}.
 * <p>
 * This method should be called after the provided {@link Pane} has already been added to the scene graph. The idea
 * is that with the logic below, the text gets rendered inside its proper place in the scene graph, so that CSS and
 * other style settings are automatically taken into account. The rectangle is then resized to be a bit bigger than
 * the text.
 * <p>
 * @param pane the {@link Pane} into which the graphic will be added
 * @param content the text content to be rendered in the colored label
 * @param color the background color of the label
 * @return the provided {@link Pane}
 */
public static Node addColouredLabel(Pane pane, String content, Color color)
{
    StackPane stackPane = new StackPane();
    stackPane.setAlignment(CENTER);

    Text text = new Text(content);
    Rectangle rectangle = new Rectangle();
    rectangle.setFill(color);

    stackPane.getChildren().addAll(rectangle, text);
    pane.getChildren().add(stackPane);

    // Render the text, and use the resulting image size to resize the
    // rectangle
    WritableImage image = text.snapshot(null, null);

    double width = image.getWidth() + 2;
    double height = image.getHeight() + 2;

    rectangle.setWidth(max(width, height));
    rectangle.setHeight(image.getHeight() + 2);

    return pane;
}
 
开发者ID:jvm-profiling-tools,项目名称:honest-profiler,代码行数:39,代码来源:FxUtil.java

示例3: makeConstantImage

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
private void makeConstantImage(WritableImage img, Color color) {
    int w = (int) img.getWidth();
    int h = (int) img.getHeight();
    ByteBuffer scanline = ByteBuffer.allocate(3 * w);
    byte r = (byte) ((int) Math.round(color.getRed() * 255.0));
    byte g = (byte) ((int) Math.round(color.getGreen() * 255.0));
    byte b = (byte) ((int) Math.round(color.getBlue() * 255.0));
    for (int i = 0; i < w; i++) {
        scanline.put(r);
        scanline.put(g);
        scanline.put(b);
    }
    scanline.rewind();
    img.getPixelWriter().setPixels(0, 0, w, w, PixelFormat.getByteRgbInstance(), scanline, 0);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:16,代码来源:VisibleLight.java

示例4: updateImage

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
private static void updateImage(WritableImage map) {
    PixelWriter pw = map.getPixelWriter();
    for (int i = 0; i < map.getWidth(); i++) {
        for (int j = 0; j < map.getHeight(); j++) {
            pw.setColor(i, j, Color.rgb(73, 212, 206));
            if (j > 0 && j % len == 0) {
                j += len + 1;
            }
        }
        if (i > 0 && i % len == 0) {
            i += len + 1;
        }
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:15,代码来源:ShapesTestCase.java

示例5: createDragImage

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
protected static Image createDragImage(FxDockPane client)
{
	SnapshotParameters sp = new SnapshotParameters();
	sp.setFill(Color.TRANSPARENT);
	
	WritableImage im = client.snapshot(sp, null);

	if(client.isPaneMode())
	{
		return im;
	}
	
	// include selected tab
	FxDockTabPane tp = (FxDockTabPane)DockTools.getParent(client);
	Node n = tp.lookup(".tab:selected");
	WritableImage tim = n.snapshot(sp, null);
	
	double dy = tim.getHeight();
	
	// must adjust for the tab
	deltay += dy;
	
	double w = Math.max(im.getWidth(), tim.getWidth());
	double h = im.getHeight() + dy;
	Canvas c = new Canvas(w, h);
	GraphicsContext g = c.getGraphicsContext2D();
	g.drawImage(tim, 0, 0);
	g.drawImage(im, 0, dy);
	return c.snapshot(sp, null);
}
 
开发者ID:andy-goryachev,项目名称:FxDock,代码行数:31,代码来源:DragAndDropHandler.java

示例6: update

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
@Override
public void update(){
    WritableImage wr = new WritableImage(resX, resY);
    PixelWriter pw = wr.getPixelWriter();
    for (int y = 0; y < wr.getWidth(); y++) {
        for (int x = 0; x < wr.getHeight(); x++) {
            pw.setArgb(x, y, input.getData()[(y * resX) + x]);
        }
    }
    this.setImage(wr);
}
 
开发者ID:FloppidyDingo,项目名称:Dingo-Engine,代码行数:12,代码来源:BufferedVideo.java

示例7: fromNode

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
public static BufferedImage fromNode(Node node)
{
    final WritableImage jfx = node.snapshot(null, null);
    final BufferedImage img = new BufferedImage((int)jfx.getWidth(),
            (int)jfx.getHeight(),
            BufferedImage.TYPE_INT_ARGB);
    SwingFXUtils.fromFXImage(jfx, img);

    return img;
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:11,代码来源:Screenshot.java

示例8: fillColor

import javafx.scene.image.WritableImage; //导入方法依赖的package包/类
private void fillColor(WritableImage img, Color color) {
    for (int x = 0; x < img.getWidth(); x++) {
        for (int y = 0; y < img.getHeight(); y++) {
            img.getPixelWriter().setColor(x, y, color);
        }
    }
}
 
开发者ID:badvision,项目名称:lawless-legends,代码行数:8,代码来源:ImageDitheringTest.java


注:本文中的javafx.scene.image.WritableImage.getHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。