#e6

e664. 在图像中获取子图像

//FromanImageimage=createImage(newFilteredImageSource(image.getSource(),newCropImageFilter(x,y,w,h)));//FromaBufferedImagebufferedImage=bufferedImage.getSubimag...
代码星球 ·2021-02-11

e672. 缩放,剪取,移动,翻转缓冲图像

AffineTransformtx=newAffineTransform();tx.scale(scalex,scaley);tx.shear(shiftx,shifty);tx.translate(x,y);tx.rotate(radians,bufferedImage.getWidth()/2,bufferedIm...

e666. 创建缓冲图像

Abufferedimageisatypeofimagewhosepixelscanbemodified.Forexample,youcandrawonabufferedimageandthendrawtheresultingbufferedimageonthescreenorsaveittoafile.Abuffer...
代码星球 ·2021-02-11

e670. 缓冲图像转换为图像

 //ThismethodreturnsanImageobjectfromabufferedimagepublicstaticImagetoImage(BufferedImagebufferedImage){returnToolkit.getDefaultToolkit().createImage(buffe...
代码星球 ·2021-02-11

e680. 使三元色图像变明变暗

ThisexampledemonstrateshowtobrightenordarkenanRGBbufferedimagebyscalingthered,green,andbluevaluesintheimage.//Tocreateabufferedimage,seee666创建缓冲图像//Brightenthei...

e659. 缩放,剪取,移动,翻转图形

AffineTransformtx=newAffineTransform();tx.scale(scalex,scaley);tx.shear(shiftx,shifty);tx.translate(x,y);tx.rotate(radians);ShapenewShape=tx.createTransformedSh...

e656. 创建基本图形

Shapeline=newLine2D.Float(x1,y1,x2,y2);Shapearc=newArc2D.Float(x,y,w,h,start,extent,type);Shapeoval=newEllipse2D.Float(x,y,w,h);Shaperectangle=newRectangle2D.Fl...
代码星球 ·2021-02-11

e657. 用直线和曲线绘制图形

GeneralPathshape=newGeneralPath();shape.moveTo(x,y);shape.lineTo(x,y);shape.quadTo(controlPointX,controlPointY,x,y);shape.curveTo(controlPointX1,controlPointY1,...

e658. 组合图形

Areashape=newArea(shape1);shape.add(newArea(shape2));shape.subtract(newArea(shape3));shape.intersect(newArea(shape4));shape.exclusiveOr(newArea(shape5)); R...
代码星球 ·2021-02-11

e655. 混合风格的文本

Thisexampleappliesanewfontandbackgroundcolortoapartofthetext.Youcanapplystylestoasmanypartsofthetextasyouneed.SeeTextAttributesforavailablestyles.//Applystylest...
代码星球 ·2021-02-11

e654. 获得文本的缩略图

ShapegetTextShape(Graphics2Dg2d,Stringstr,Fontfont){FontRenderContextfrc=g2d.getFontRenderContext();TextLayouttl=newTextLayout(str,font,frc);returntl.getOutline...
代码星球 ·2021-02-11

e652. Getting the Font Faces for a Font Family

TocreateaFontobjecttodrawtext,itisnecessarytospecifythefontfacename.Thisexampledemonstrateshowtoretrieveallthefontfacenamesfromafontfamilyname.Unfortunately,the...

e651. 列出所有可用字体

Afontfamilyreferstoasetoffontfaceswitharelatedtypographicdesign.Forexample,thefontfacesinthefamilyLucidaSansTypewritermightbeLucidaSansTypewriterBold,andLucidaS...

e653. 写入段落文本

Inordertochangethefontofthetext,youneedtosupplyanattributedstringtotheLineBreakMeasurer.Seee655混合风格的文本foranexample.publicvoiddrawParagraph(Graphics2Dg,Stringpar...
代码星球 ·2021-02-11

e648. 双击和三击事件

component.addMouseListener(newMyMouseListener());publicclassMyMouseListenerextendsMouseAdapter{publicvoidmouseClicked(MouseEventevt){if(evt.getClickCount()==3){...
代码星球 ·2021-02-11
首页上一页...34567...下一页尾页