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


Java GraphicsContext.setGlobalAlpha方法代码示例

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


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

示例1: paintStone

import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
/**
 * Paint a black/white stone onto a graphics context with a grid
 * @param gc Graphics context
 * @param startX Start (top left) x coordinate of the grid
 * @param startY Start (top left) y coordinate of the grid
 * @param cellSize Size of the grid cells
 * @param row Row position of the stone
 * @param col Column position of the stone
 * @param index Index of the stone (1 = black, 2 = white)
 * @param transparent Transparency value, 0.5 alpha if true
 */
private static void paintStone(GraphicsContext gc, double startX, double
        startY, double cellSize, int row, int col, int index,
                               boolean transparent) {
    double x = startX + col*cellSize;
    double y = startY + row*cellSize;
    double offset = (cellSize * 0.7) / 2;
    gc.save();
    if(transparent) {
        gc.setGlobalAlpha(0.5);
    }
    switch(index) {
        case 1:
            gc.setFill(blackGradient);
            gc.fillOval(x - offset, y - offset, cellSize * 0.7,
                    cellSize * 0.7);
            break;
        case 2:
            gc.setFill(whiteGradient);
            gc.fillOval(x - offset, y - offset, cellSize * 0.7,
                    cellSize * 0.7);
            break;
    }
    gc.restore();
}
 
开发者ID:haslam22,项目名称:gomoku,代码行数:36,代码来源:BoardPane.java

示例2: draw

import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void draw(GraphicsContext context) {
    final double x = Math.round(posX);
    final double y = Math.round(posY);
    final double xVel = (x - lastPosX) * -5;
    final double yVel = (y - lastPosY) * -5;
    // set the opacity for all drawing of this particle
    context.setGlobalAlpha(Math.random() * this.alpha);
    // draw particle
    context.setFill(color);
    context.fillOval(x-size, y-size, size+size, size+size);
    // draw the arrow triangle from where we were to where we are now
    if (hasTail) {
        context.setFill(Color.rgb(255,255,255,0.3));
        context.fillPolygon(new double[]{posX + 1.5,posX + xVel,posX - 1.5}, 
                new double[]{posY,posY + yVel,posY}, 3);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Fireworks.java

示例3: drawGhostStone

import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void drawGhostStone(DrawCoords position, StoneColour colour) {
	GraphicsContext context = getGraphicsContext();

	context.setGlobalAlpha(0.5);
	draw(position, colour);
	context.setGlobalAlpha(1);
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:8,代码来源:StoneDrawer.java

示例4: drawGhostStones

import javafx.scene.canvas.GraphicsContext; //导入方法依赖的package包/类
public void drawGhostStones(Collection<Coords> stones, StoneColour colour) {
	GraphicsContext context = getGraphicsContext();

	context.setGlobalAlpha(0.5);
	drawStones(stones, colour);
	context.setGlobalAlpha(1);
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:8,代码来源:StoneDrawer.java


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