File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
src/evhh/common/imagemanipulation Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ package evhh .common .imagemanipulation ;
2+
3+ import java .awt .*;
4+ import java .awt .image .BufferedImage ;
5+
6+ /***********************************************************************************************************************
7+ * @project: MainProject
8+ * @package: evhh.common.imagemanipulation
9+ * ---------------------------------------------------------------------------------------------------------------------
10+ * @authors: Hamed Haghjo & Elias Vahlberg
11+ * @date: 2021-05-16
12+ * @time: 13:55
13+ **********************************************************************************************************************/
14+ public class ImageTiler
15+ {
16+ public static BufferedImage tileImage (BufferedImage image , int cols , int rows )
17+ {
18+ int width = image .getWidth ()*cols ;
19+ int height = image .getWidth ()*rows ;
20+ BufferedImage tiledImage = new BufferedImage (width ,height , BufferedImage .TYPE_INT_ARGB );
21+ Graphics2D graphics2D = tiledImage .createGraphics ();
22+ for (int i = 0 ; i < cols ; i ++)
23+ {
24+ for (int j = 0 ; j < rows ; j ++)
25+ {
26+ graphics2D .drawImage (image ,null ,image .getWidth ()*cols ,image .getHeight ()*cols );
27+ }
28+ }
29+ graphics2D .dispose ();
30+ return tiledImage ;
31+
32+
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments