问题描述
这样的图片我想做成像CSDN发贴输入框一样的效果,在C/S应用中我应该怎么去取。比如我想取对齐图标。在CSS中background:url(../img/default/form/search.gif)-51px0no-repeat;这样可以取到自己想要的部分,但在C/S中不知道怎么弄了.分不够可以在加
解决方案
解决方案二:
帮顶啦
解决方案三:
用截图软件就可以了啊,呵呵,这只是个人一个不怎么好的意见呵~帮顶啦~~
解决方案四:
用javaGrphics2D.可参考以下代码(下面划分图片成2x2)。imageSrc为lz的图片文件名。/*dividetheimage'bi'intofourrectangularareasanddraweach*oftheseareasintoadifferentpartoftheimage,soasto*jumbleuptheimage.*'cells'isanarraywhichhasbeenpopulatedwithvalues*whichredirectdrawingofonesubareatoanothersubarea.*/BufferedImagebi=ImageIO.read(imageSrc);intcellWidth=bi.getWidth(null)/2;intcellHeight=bi.getHeight(null)/2;for(intx=0;x<2;x++){intsx=x*cellWidth;for(inty=0;y<2;y++){intsy=y*cellHeight;intcell=cells[x*2+y];intdx=(cell/2)*cellWidth;intdy=(cell%2)*cellHeight;g.drawImage(bi,dx,dy,dx+cellWidth,dy+cellHeight,sx,sy,sx+cellWidth,sy+cellHeight,null);}}
解决方案五:
顶了,我用svg图。引用3楼sgcl的回复:
用javaGrphics2D.可参考以下代码(下面划分图片成2x2)。imageSrc为lz的图片文件名。Javacode/*dividetheimage'bi'intofourrectangularareasanddraweach*oftheseareasintoadifferentpartoftheimage,soasto*jumbleuptheimage.*'cells'isanarraywhichhasbeenpopulatedwithvalues*whichredirectdrawingofonesubareatoanothersubarea.*/BufferedImagebi=ImageIO.read(imageSrc);intcellWidth=bi.getWidth(null)/2;intcellHeight=bi.getHeight(null)/2;for(intx=0;x<2;x++){intsx=x*cellWidth;for(inty=0;y<2;y++){intsy=y*cellHeight;intcell=cells[x*2+y];intdx=(cell/2)*cellWidth;intdy=(cell%2)*cellHeight;g.drawImage(bi,dx,dy,dx+cellWidth,dy+cellHeight,sx,sy,sx+cellWidth,sy+cellHeight,null);}}
解决方案六:
先转换SVG去其他格式,如"png"格式,然后再处理即可。
解决方案七:
/*dividetheimage'bi'intofourrectangularareasanddraweach*oftheseareasintoadifferentpartoftheimage,soasto*jumbleuptheimage.*'cells'isanarraywhichhasbeenpopulatedwithvalues*whichredirectdrawingofonesubareatoanothersubarea.*/BufferedImagebi=ImageIO.read(imageSrc);intcellWidth=bi.getWidth(null)/2;intcellHeight=bi.getHeight(null)/2;for(intx=0;x<2;x++){intsx=x*cellWidth;for(inty=0;y<2;y++){intsy=y*cellHeight;intcell=cells[x*2+y];intdx=(cell/2)*cellWidth;intdy=(cell%2)*cellHeight;g.drawImage(bi,dx,dy,dx+cellWidth,dy+cellHeight,sx,sy,sx+cellWidth,sy+cellHeight,null);}}
没用过这学习了