mirror of https://github.com/Askill/mosaik.git
This commit is contained in:
parent
1df9e7d4de
commit
85aa1e45ae
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="5d4ebe9a-78e7-4836-aff9-c6f6e8cd4a0d" name="Default" comment="" />
|
||||
<list default="true" id="5d4ebe9a-78e7-4836-aff9-c6f6e8cd4a0d" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/company/Main.java" afterPath="$PROJECT_DIR$/src/com/company/Main.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/company/chunk.java" afterPath="$PROJECT_DIR$/src/com/company/chunk.java" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
|
|
@ -15,8 +18,8 @@
|
|||
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="420">
|
||||
<caret line="21" column="19" lean-forward="false" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
||||
<state relative-caret-position="700">
|
||||
<caret line="35" column="9" lean-forward="true" selection-start-line="35" selection-start-column="9" selection-end-line="35" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
|
@ -27,15 +30,12 @@
|
|||
<file leaf-file-name="chunk.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/com/company/chunk.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="240">
|
||||
<caret line="18" column="5" lean-forward="false" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
<state relative-caret-position="800">
|
||||
<caret line="44" column="17" lean-forward="true" selection-start-line="44" selection-start-column="17" selection-end-line="44" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#143#144#0" expanded="true" />
|
||||
<element signature="e#169#170#0" expanded="true" />
|
||||
<element signature="e#206#207#0" expanded="true" />
|
||||
<element signature="e#232#233#0" expanded="true" />
|
||||
<element signature="e#276#277#0" expanded="true" />
|
||||
<element signature="e#306#307#0" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
<element signature="e#354#355#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
@ -50,6 +50,9 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GradleLocalSettings">
|
||||
<option name="externalProjectsViewState">
|
||||
<projects_view />
|
||||
|
|
@ -74,6 +77,9 @@
|
|||
<option name="width" value="1936" />
|
||||
<option name="height" value="2130" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager">
|
||||
<ConfirmationsSetting value="1" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1">
|
||||
<flattenPackages />
|
||||
|
|
@ -89,37 +95,27 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="AndroidView" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scratches" />
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
<path>
|
||||
<item name="test" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="test" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="test" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="test" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="test" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="test" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="company" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="mosaik" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="mosaik" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
</expand>
|
||||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
|
|
@ -184,11 +180,12 @@
|
|||
<workItem from="1531682548389" duration="791000" />
|
||||
<workItem from="1532439177316" duration="3253000" />
|
||||
<workItem from="1532606900745" duration="8000" />
|
||||
<workItem from="1532607142184" duration="5258000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="4052000" />
|
||||
<option name="totallyTimeSpent" value="9310000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
|
|
@ -201,21 +198,24 @@
|
|||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="-8" y="0" width="1936" height="2130" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32994923" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21935484" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.22258064" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
|
|
@ -226,9 +226,7 @@
|
|||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32959184" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
|
@ -257,12 +255,9 @@
|
|||
<state relative-caret-position="240">
|
||||
<caret line="18" column="5" lean-forward="false" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#143#144#0" expanded="true" />
|
||||
<element signature="e#169#170#0" expanded="true" />
|
||||
<element signature="e#206#207#0" expanded="true" />
|
||||
<element signature="e#232#233#0" expanded="true" />
|
||||
<element signature="e#276#277#0" expanded="true" />
|
||||
<element signature="e#306#307#0" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
<element signature="e#354#355#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
@ -282,20 +277,44 @@
|
|||
<state relative-caret-position="240">
|
||||
<caret line="18" column="5" lean-forward="false" selection-start-line="18" selection-start-column="5" selection-end-line="18" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="e#143#144#0" expanded="true" />
|
||||
<element signature="e#169#170#0" expanded="true" />
|
||||
<element signature="e#206#207#0" expanded="true" />
|
||||
<element signature="e#232#233#0" expanded="true" />
|
||||
<element signature="e#276#277#0" expanded="true" />
|
||||
<element signature="e#306#307#0" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
<element signature="e#354#355#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="420">
|
||||
<caret line="21" column="19" lean-forward="false" selection-start-line="21" selection-start-column="19" selection-end-line="21" selection-end-column="19" />
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/collage.jpg">
|
||||
<provider selected="true" editor-type-id="images">
|
||||
<state />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/com/company/chunk.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="800">
|
||||
<caret line="44" column="17" lean-forward="true" selection-start-line="44" selection-start-column="17" selection-end-line="44" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#324#325#0" expanded="true" />
|
||||
<element signature="e#354#355#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/com/company/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="700">
|
||||
<caret line="35" column="9" lean-forward="true" selection-start-line="35" selection-start-column="9" selection-end-line="35" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 859 B |
|
|
@ -8,22 +8,25 @@ public class Main {
|
|||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
File file = new File("bear.jpg"); // I have bear.jpg in my working directory
|
||||
File file = new File("C:\\Users\\Elliot\\Desktop\\bear.jpeg");
|
||||
FileInputStream fis = new FileInputStream(file);
|
||||
BufferedImage image = ImageIO.read(fis); //reading the image file
|
||||
|
||||
int rows = 20; //You should decide the values for rows and cols variables
|
||||
int rows = 20;
|
||||
int cols = 30;
|
||||
int chunks = rows * cols;
|
||||
|
||||
int chunkWidth = image.getWidth() / cols; // determines the chunk width and height
|
||||
int chunkHeight = image.getHeight() / rows;
|
||||
int count = 0;
|
||||
chunk imgs[] = new chunk[chunks];
|
||||
chunk[] imgs = new chunk[chunks];
|
||||
for (int x = 0; x < rows; x++) {
|
||||
for (int y = 0; y < cols; y++) {
|
||||
//Initialize the image array with image chunks
|
||||
imgs[count].setImg(new BufferedImage(chunkWidth, chunkHeight, image.getType()));
|
||||
BufferedImage tempimg = new BufferedImage(chunkWidth, chunkHeight, image.getType());
|
||||
imgs[count] = new chunk(tempimg);
|
||||
imgs[count].average();
|
||||
|
||||
|
||||
// draws the image chunk
|
||||
Graphics2D gr = imgs[count++].getImg().createGraphics();
|
||||
|
|
@ -31,14 +34,7 @@ public class Main {
|
|||
gr.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//writing mini images into image files
|
||||
for (int i = 0; i < imgs.length; i++) {
|
||||
ImageIO.write(imgs[i].getImg(), "jpg", new File("img" + i + ".jpg"));
|
||||
}
|
||||
|
||||
ImageIO.write(image, "jpg", new File("collage.jpg"));
|
||||
ImageIO.write(imgs[2].getImg(), "jpg", new File("collage.jpg"));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package com.company;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
public class chunk {
|
||||
|
||||
|
||||
|
|
@ -18,21 +19,35 @@ public class chunk {
|
|||
this.img = img;
|
||||
}
|
||||
public int[] average(){
|
||||
int r = 0, g = 0, b = 0, x= 0, y = 0, clr;
|
||||
int r = 0, g = 0, b = 0, a = 0, x= 0, y = 0;
|
||||
|
||||
for(; y < this.img.getHeight(); y++){
|
||||
for(; x < this.img.getWidth(); x++){
|
||||
|
||||
//get pixel value
|
||||
int p = this.img.getRGB(x,y);
|
||||
|
||||
//get alpha
|
||||
a = (p>>24) & 0xff;
|
||||
|
||||
//get red
|
||||
r = (p>>16) & 0xff;
|
||||
|
||||
//get green
|
||||
g = (p>>8) & 0xff;
|
||||
|
||||
//get blue
|
||||
a = p & 0xff;
|
||||
|
||||
for(; x < this.img.getWidth(); x++){
|
||||
for(; x < this.img .getHeight(); x++){
|
||||
clr = this.img.getRGB(x, y);
|
||||
r += (clr & 0x00ff0000) >> 16;
|
||||
g += (clr & 0x0000ff00) >> 8;
|
||||
b += clr & 0x000000ff;
|
||||
}
|
||||
}
|
||||
|
||||
r /= x*y;
|
||||
g /= x*y;
|
||||
b /= x*y;
|
||||
a /= x*y;
|
||||
|
||||
System.out.println(r + " , " + g + " , " + b + " , " + a);
|
||||
return new int[]{r,g,b};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue