开发者

does anybody know how to set the color of the border of text in processing

I think there is no 开发者_StackOverflow中文版textBorder(); and Stroke(); does not work. any help


This makes a pretty good 1px stroke by drawing the text four times in the stroke color, then once in the fill color:

void draw() {
  textSize(30);
  textWithBorder("text", 255, 0, 15, 30); 
}

void textWithBorder(String string, int strokecolor, int fillcolor, int x, int y) {
  fill(strokecolor);
  text(string, x-1, y); 
  text(string, x+1, y); 
  text(string, x, y-1); 
  text(string, x, y+1); 
  fill(fillcolor);
  text(string, x, y); 
}


I had the same issue

you have to print two texts with different font sizes over each other, one with the border color and on top of that and slightly smaller the one with the fill color.

you can write a basic textWithBorder(...) function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜