java graphics rotate_Java GraphicsContext.rotate方法代碼示例

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

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

示例1: draw

​點讚 3

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

/**

* Draws the image representing the nucleotide on a graphics context, with specified rotation.

* @param GraphicsContext gc: The GraphicsContext you want to draw the object on

* @param x: The x coord you want to draw the image at

* @param y: The y coord you want to draw the image at

* @param r: The rotation, in degrees, you want to draw the nucleotide at. 0 would draw it with the base pointing up.

*/

public void draw(GraphicsContext gc, int x, int y, int r) {

gc.save();

gc.translate(x, y);

gc.rotate(r);

gc.translate(-x, -y);

gc.drawImage(image, x, y);

gc.restore();

}

開發者ID:clonex10100,項目名稱:Dna-replication-game,代碼行數:16,

示例2: rotateContextForText

​點讚 3

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

private static void rotateContextForText(final GraphicsContext CTX, final double START_ANGLE, final double ANGLE, final TextOrientation ORIENTATION) {

switch (ORIENTATION) {

case TANGENT:

if ((360 - START_ANGLE - ANGLE) % 360 > 90 && (360 - START_ANGLE - ANGLE) % 360 < 270) {

CTX.rotate((180 - START_ANGLE - ANGLE) % 360);

} else {

CTX.rotate((360 - START_ANGLE - ANGLE) % 360);

}

break;

case ORTHOGONAL:

if ((360 - START_ANGLE - ANGLE - 90) % 360 > 90 && (360 - START_ANGLE - ANGLE - 90) % 360 < 270) {

CTX.rotate((90 - START_ANGLE - ANGLE) % 360);

} else {

CTX.rotate((270 - START_ANGLE - ANGLE) % 360);

}

break;

case HORIZONTAL:

default:

break;

}

}

開發者ID:HanSolo,項目名稱:SunburstChart,代碼行數:22,

示例3: rotateContextForText

​點讚 3

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

private void rotateContextForText(final GraphicsContext CTX, final double START_ANGLE, final double TEXT_ANGLE, final TickLabelOrientation ORIENTATION) {

switch (ORIENTATION) {

case ORTHOGONAL:

if ((360 - START_ANGLE - TEXT_ANGLE) % 360 > 90 && (360 - START_ANGLE - TEXT_ANGLE) % 360 < 270) {

CTX.rotate((180 - START_ANGLE - TEXT_ANGLE) % 360);

} else {

CTX.rotate((360 - START_ANGLE - TEXT_ANGLE) % 360);

}

break;

case TANGENT:

if ((360 - START_ANGLE - TEXT_ANGLE - 90) % 360 > 90 && (360 - START_ANGLE - TEXT_ANGLE - 90) % 360 < 270) {

CTX.rotate((90 - START_ANGLE - TEXT_ANGLE) % 360);

} else {

CTX.rotate((270 - START_ANGLE - TEXT_ANGLE) % 360);

}

break;

case HORIZONTAL:

default:

break;

}

}

開發者ID:HanSolo,項目名稱:circularplot,代碼行數:22,

示例4: rotateContextForText

​點讚 3

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

public static final void rotateContextForText(final GraphicsContext CTX, final double START_ANGLE, final double ANGLE, final TickLabelOrientation ORIENTATION) {

switch (ORIENTATION) {

case ORTHOGONAL:

if ((360 - START_ANGLE - ANGLE) % 360 > 90 && (360 - START_ANGLE - ANGLE) % 360 < 270) {

CTX.rotate((180 - START_ANGLE - ANGLE) % 360);

} else {

CTX.rotate((360 - START_ANGLE - ANGLE) % 360);

}

break;

case TANGENT:

if ((360 - START_ANGLE - ANGLE - 90) % 360 > 90 && (360 - START_ANGLE - ANGLE - 90) % 360 < 270) {

CTX.rotate((90 - START_ANGLE - ANGLE) % 360);

} else {

CTX.rotate((270 - START_ANGLE - ANGLE) % 360);

}

break;

case HORIZONTAL:

default:

break;

}

}

開發者ID:HanSolo,項目名稱:charts,代碼行數:22,

示例5: draw

​點讚 2

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

/**

* Draws both strands next to each other

* @param gc- graphics context to draw helix on

* @param x- left start of the drawing

* @param y- upper start of the drawing

*/

public void draw(GraphicsContext gc) {

gc.save();

gc.translate(x, y-imageSize);

gc.rotate(r);

gc.translate(-x, -(y-imageSize));

strands[0].draw(gc);

strands[1].draw(gc);

gc.restore();

}

開發者ID:clonex10100,項目名稱:Dna-replication-game,代碼行數:16,

示例6: draw

​點讚 2

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

/**

* Draws all nucleotides in strand from left to right

* @param gc: GraphicsContext on which to draw strand

* Add type functionality

*/

public void draw(GraphicsContext gc) {

int x2 = x;

int y2 = y;

if(r!=0) {

gc.save();

gc.translate(x, y);

gc.rotate(r);

gc.translate(-x, -y);

}

if(type==1){

for(int i = 0; i < bases.size(); i++) {

if(bases.get(i) != null){

bases.get(i).draw(gc,x2,y);

if(i+1< bases.size()){

if(bases.get(i+1) != null && bonds.get(i)){

gc.strokeLine(x2+Nucleotide.getImageSize()*.81, y+Nucleotide.getImageSize()*.81, x2+Nucleotide.getImageSize()*1.10, y+Nucleotide.getImageSize()*.73);

}

}

}

x2+=Nucleotide.getImageSize();

}

}

else if(type == 0){

int lx = x2+Nucleotide.getImageSize()*2;

y2+=Nucleotide.getImageSize();

x2+=Nucleotide.getImageSize();

for(int i = 0; i < bases.size(); i++) {

if(bases.get(i) != null){

bases.get(i).draw(gc,x2,y2,180);

if(i+1< bases.size()){

if(bases.get(i+1) != null && bonds.get(i)){

//gc.strokeLine(x2,y2,x2+50,y2+50);

gc.strokeLine(lx-Nucleotide.getImageSize()*.81, y2-Nucleotide.getImageSize()*.81, lx-Nucleotide.getImageSize()*1.10, y2-Nucleotide.getImageSize()*.73);

}

}

}

x2+=Nucleotide.getImageSize();

lx+=Nucleotide.getImageSize();

}

}

else{

System.out.println("Type is not 0 or 1");

}

if(r!=0) {

gc.restore();

}

}

開發者ID:clonex10100,項目名稱:Dna-replication-game,代碼行數:53,

示例7: rotateCtx

​點讚 2

import javafx.scene.canvas.GraphicsContext; //導入方法依賴的package包/類

public static final void rotateCtx(final GraphicsContext CTX, final double X, final double Y, final double ANGLE) {

CTX.translate(X, Y);

CTX.rotate(ANGLE);

CTX.translate(-X, -Y);

}

開發者ID:HanSolo,項目名稱:charts,代碼行數:6,

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值