您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
本篇文章为大家展示了java jwt图形设计是怎样的,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
#java jwt图形设计
方式一
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); BufferedImageGraphicsConfig config = BufferedImageGraphicsConfig.getConfig(bufferedImage); bufferedImage = config.createCompatibleImage(width, height, Transparency.TRANSLUCENT);
方式二
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = bufferedImage.createGraphics(); bufferedImage = graphics.getDeviceConfiguration() .createCompatibleImage(width, height, Transparency.TRANSLUCENT);
方式三
ColorModel cm = ColorModel.getRGBdefault(); WritableRaster wr = cm.createCompatibleWritableRaster(width, height); BufferedImage bufferedImage = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null);
画圆形
double centerX=1000/2; double centerY=1000/2; double conerX=centerX+100; double conerY=centerY+100; Ellipse2D circle=new Ellipse2D.Double(); double radius=Point2D.distance(centerX, centerY, conerX, conerY); circle.setFrameFromCenter(centerX,centerY,centerX+radius,centerY+radius); graphics.draw(circle);
画正方形
double centerX=1000/2; double centerY=1000/2; double conerX=centerX+100; double conerY=centerY+50; Rectangle2D rect =new Rectangle2D.Double(); rect.setFrameFromCenter(centerX,centerY,conerX,conerY);
画椭圆
double centerX=1000/2; double centerY=1000/2; double conerX=centerX+100; double conerY=centerY+50; Rectangle2D rect =new Rectangle2D.Double(); rect.setFrameFromCenter(centerX,centerY,conerX,conerY); Ellipse2D ellipse=new Ellipse2D.Double(); ellipse.setFrame(rect);
画线
Line2D line= new Line2D.Double(conerX,conerY,conerX-200,conerY-200);
多边形
int px1[]={50,90,10,50};//首末点相重,才能画多边形 int py1[]={10,50,50,10}; int px2[]={140,180,170,180,140,100,110,140}; int py2[]={5,25,35,45,65,35,25,5}; g.setColor(Color.blue); g.fillPolygon(px1,py1,4); g.setColor(Color.red); g.drawPolygon(px2,py2,9);
画弧线
g.drawArc(10,40,90,50,0,180);//画圆弧线
BufferedImage inputImage = ImageIO.read(new File("/Users/manager/Desktop/tupian.png")); Rectangle2D rectangle = new Rectangle(0,0,inputImage.getWidth(),inputImage.getHeight()); TexturePaint tPaint = new TexturePaint(inputImage,rectangle); BufferedImage bufferedImage = new BufferedImage(100,100,BufferedImage.TYPE_4BYTE_ABGR); Graphics2D g = bufferedImage.createGraphics(); g.setPaint(tPaint);//填充颜色可以使用g.setColor(new Color(0,204,255))方法替换 //如果需要设置透明度,添加这句代码 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC,0.5f)); g.fillPolygon(new int[]{0,100,100,0},new int[]{0,0,100,100},4); g.dispose(); ImageIO.write(bufferedImage,"png",new File("/Users/manager/Desktop/tupian3.png"));
//消除文字锯齿 g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,RenderingHints.VALUE_TEXT_ANTIALIAS_ON); //消除画图锯齿 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
上述内容就是java jwt图形设计是怎样的,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。