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


Java GraphicsContext.strokeRect方法代碼示例

本文整理匯總了Java中javafx.scene.canvas.GraphicsContext.strokeRect方法的典型用法代碼示例。如果您正苦於以下問題:Java GraphicsContext.strokeRect方法的具體用法?Java GraphicsContext.strokeRect怎麽用?Java GraphicsContext.strokeRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.canvas.GraphicsContext的用法示例。


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

示例1: draw

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
@Override
public void draw(DungeonTileRenderer renderer, GraphicsContext g)
{
	RAND.setSeed((long)(renderer.posX * 17 + renderer.posY));
	double ds = MAX_BORDER - MIN_BORDER;
	double dx = RAND.nextDouble() * ds + MIN_BORDER;
	double dy = RAND.nextDouble() * ds + MIN_BORDER;
	double dw = RAND.nextDouble() * ds + MIN_BORDER;
	double dh = RAND.nextDouble() * ds + MIN_BORDER;
	drawBlock(renderer, g, this.chestPaint, dx, dy, 1 - dx - dw, 1 - dy - dh);

	if (this.outlinePaint != null)
	{
		g.setStroke(this.outlinePaint);
	}

	g.setLineWidth(OUTLINE_WIDTH);
	g.strokeRect(dx, dy, 1 - dx - dw, 1 - dy - dh);
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:20,代碼來源:TileItemChest.java

示例2: initDraw

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
private void initDraw(GraphicsContext gc) {
    double canvasWidth = gc.getCanvas().getWidth();
    double canvasHeight = gc.getCanvas().getHeight();

    log.info("canvasWidth = {}, canvasHeight = {}", canvasWidth, canvasHeight);

    gc.clearRect(0, 0, canvasWidth, canvasHeight);

    gc.setStroke(borderRectangleColor);
    gc.setLineWidth(5);
    gc.strokeRect(0, // x of the upper left corner
            0, // y of the upper left corner
            canvasWidth, // width of the rectangle
            canvasHeight); // height of the rectangle

    gc.setFill(Color.RED);
    gc.setStroke(Color.BLUE);
    gc.setLineWidth(drawLineWidth);
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:20,代碼來源:DrawBuilder.java

示例3: drawShapes

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
private void drawShapes() {
    GraphicsContext gc = drawingCanvas.getGraphicsContext2D();
    gc.setStroke(Color.RED);
    gc.setFill(Color.YELLOW);
    gc.setLineWidth(5);
    double w = 100;
    double h = 100;
    double width = drawingCanvas.getWidth();
    double height = drawingCanvas.getHeight();

    gc.fillRect(width / 2 - w / 2, height / 2 - h / 2, w, h);
    gc.strokeRect(width / 2 - w / 2, height / 2 - h / 2, w, h);

    double initialX = 100;
    double initialY = 200;
    double dr = -20;
    for (double radius = 100; radius >= 20; radius += dr, initialX -= dr, initialY -= dr) {
        gc.strokeOval(initialX, initialY, 2 * radius, 2 * radius);
    }

    // Hometasks:
    // 1. draw a sun!
    // 2. draw regular ngons (fix the function that I wrote)
}
 
開發者ID:kmhasan-class,項目名稱:spring2017java,代碼行數:25,代碼來源:FXMLDocumentController.java

示例4: draw

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
public void draw() {
    drawGrid();

    GraphicsContext gc = drawingCanvas.getGraphicsContext2D();
    gc.setStroke(Color.BLACK);
    gc.setLineWidth(5);
    gc.setFill(Color.YELLOW);
    gc.fillRect(300 - 50, 200 - 50, 100, 100);
    gc.strokeRect(300 - 50, 200 - 50, 100, 100);
    gc.setFill(Color.GREEN);
    gc.fillOval(100, 100, 200, 100);
    gc.strokeOval(100, 100, 200, 100);

    // Hometasks:
    // 1. Draw a circle right at the center with radius of 150 pixels
    // 2. Draw 20 concentric circles in the top left box
    // 3. Draw a sun (circle + rays)
    // 4. Draw a regular n-gon (like pentagon)
}
 
開發者ID:kmhasan-class,項目名稱:spring2017java,代碼行數:20,代碼來源:FXMLDocumentController.java

示例5: drawBorder

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
private void drawBorder(GraphicsContext g2d) {
    // fill it in
    g2d.setFill(Paint.valueOf("WHITE"));
    g2d.fillRect(0, 0, width, height);

    // draw bordere
    g2d.setStroke(Paint.valueOf("BLACK"));
    g2d.setLineWidth(1);
    g2d.strokeRect(0, 0, width, height);

}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:12,代碼來源:AbstractDataView.java

示例6: drawExportArea

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
public static void drawExportArea(GraphicsContext g, Rectangle2D area)
{
	g.setStroke(COLOR_EXPORT_AREA);
	g.setLineWidth(EXPORT_LINE_WIDTH);
	g.strokeRect(area.getMinX(), area.getMinY(),
			area.getWidth(), area.getHeight());
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:8,代碼來源:Renderer.java

示例7: draw

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類
@Override
public void draw(DungeonTileRenderer renderer, GraphicsContext g)
{
	double dx = (1 - this.size) * 0.5;
	double dy = (1 - this.size) * 0.5;
	drawBlock(renderer, g, this.mainPaint, dx, dy, 1 - dx - dx, 1 - dy - dy);

	if (this.outlinePaint != null)
	{
		g.setStroke(this.outlinePaint);
	}

	g.setLineWidth(OUTLINE_WIDTH);
	g.strokeRect(dx, dy, 1 - dx - dx, 1 - dy - dy);
}
 
開發者ID:andykuo1,項目名稱:candlelight,代碼行數:16,代碼來源:TileItemFurniture.java


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