Нууу крч графен там усе делы

This commit is contained in:
igor 2017-12-31 18:35:02 +03:00
parent 44dce38e15
commit fc6f071b86
15 changed files with 327 additions and 242 deletions

View File

@ -63,11 +63,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="864">
<caret line="277" column="45" lean-forward="true" selection-start-line="277" selection-start-column="45" selection-end-line="277" selection-end-column="45" />
<state relative-caret-position="219">
<caret line="209" column="70" lean-forward="false" selection-start-line="209" selection-start-column="70" selection-end-line="209" selection-end-column="70" />
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -75,39 +75,29 @@
</provider>
</entry>
</file>
<file leaf-file-name="textField.css" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Styles/textField.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="35" lean-forward="false" selection-start-line="18" selection-start-column="35" selection-end-line="18" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="button.css" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Styles/button.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="25" column="0" lean-forward="false" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="OCIF.java" pinned="false" current-in-tab="true">
<file leaf-file-name="OCIF.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="314">
<caret line="137" column="34" lean-forward="true" selection-start-line="137" selection-start-column="34" selection-end-line="137" selection-end-column="34" />
<state relative-caret-position="-530">
<caret line="87" column="20" lean-forward="true" selection-start-line="87" selection-start-column="20" selection-end-line="87" selection-end-column="20" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
<marker date="1514732289000" expanded="true" signature="4130:5161" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Image.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="416">
<caret line="128" column="51" lean-forward="true" selection-start-line="128" selection-start-column="51" selection-end-line="128" selection-end-column="51" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -119,7 +109,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>Недопус</find>
<find>нед</find>
<find>размер</find>
<find>open</find>
@ -149,6 +138,7 @@
<find>hints</find>
<find>OCIF</find>
<find>loadImage(</find>
<find>onDithering</find>
</findStrings>
<replaceStrings>
<replace>sample</replace>
@ -168,18 +158,18 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/sample/Color.java" />
<option value="$PROJECT_DIR$/src/sample/Pixel.java" />
<option value="$PROJECT_DIR$/src/sample/Image.java" />
<option value="$PROJECT_DIR$/src/sample/ImageConverter.fxml" />
<option value="$PROJECT_DIR$/src/sample/Palette.java" />
<option value="$PROJECT_DIR$/src/sample/OCIF.java" />
<option value="$PROJECT_DIR$/src/sample/Styles/textFieldOCIFString.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringTextField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/OCIFStringButton.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/Cells.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/textField.css" />
<option value="$PROJECT_DIR$/src/sample/Styles/button.css" />
<option value="$PROJECT_DIR$/src/sample/Color.java" />
<option value="$PROJECT_DIR$/src/sample/OCIF.java" />
<option value="$PROJECT_DIR$/src/sample/Image.java" />
<option value="$PROJECT_DIR$/src/sample/Main.java" />
</list>
</option>
@ -208,9 +198,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -247,6 +234,9 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -269,6 +259,7 @@
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="imageconverter" />
<property name="run.code.analysis.last.selected.profile" value="pProject Default" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
@ -529,16 +520,17 @@
<option name="totallyTimeSpent" value="1302000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="981" extended-state="6" />
<frame x="0" y="23" width="1920" height="978" extended-state="6" />
<editor active="true" />
<layout>
<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="4" 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.15572916" sideWeight="0.6703755" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" 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="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.32893288" sideWeight="0.5" order="14" 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.3289183" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" 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="10" 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="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.19581959" sideWeight="0.5" order="2" 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" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.47019866" 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="false" weight="0.33" sideWeight="0.5" order="10" 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="Debug" 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="3" side_tool="false" content_ui="tabs" />
@ -564,7 +556,6 @@
<window_info id="Terminal" 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="12" side_tool="false" content_ui="tabs" />
<window_info id="JetGradle" 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="6" side_tool="false" content_ui="tabs" />
<window_info id="Problems" 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="13" 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" />
<window_info id="Theme Preview" 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="9" side_tool="false" content_ui="tabs" />
</layout>
</component>
@ -586,30 +577,6 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3240">
<caret line="217" column="27" lean-forward="false" selection-start-line="217" selection-start-column="27" selection-end-line="217" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1860">
<caret line="143" column="46" lean-forward="false" selection-start-line="143" selection-start-column="46" selection-end-line="143" selection-end-column="46" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Pixel.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="18" lean-forward="false" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Palette.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
@ -623,7 +590,7 @@
<caret line="113" column="14" lean-forward="false" selection-start-line="113" selection-start-column="14" selection-end-line="113" selection-end-column="14" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
<marker date="1514732289000" expanded="true" signature="4130:5161" ph="..." />
</folding>
</state>
</provider>
@ -636,15 +603,15 @@
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="31" lean-forward="false" selection-start-line="7" selection-start-column="31" selection-end-line="7" selection-end-column="31" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
@ -683,7 +650,7 @@
<caret line="129" column="28" lean-forward="true" selection-start-line="129" selection-start-column="28" selection-end-line="129" selection-end-column="28" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
<marker date="1514732289000" expanded="true" signature="4130:5161" ph="..." />
</folding>
</state>
</provider>
@ -703,15 +670,15 @@
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="31" lean-forward="false" selection-start-line="7" selection-start-column="31" selection-end-line="7" selection-end-column="31" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
@ -743,7 +710,7 @@
<caret line="10" column="47" lean-forward="false" selection-start-line="10" selection-start-column="24" selection-end-line="10" selection-end-column="47" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
<marker date="1514732289000" expanded="true" signature="4130:5161" ph="..." />
</folding>
</state>
</provider>
@ -788,15 +755,15 @@
<entry file="file://$PROJECT_DIR$/src/sample/Resources/Background.jpg" />
<entry file="file://$USER_HOME$/Desktop/IMG_2279.JPG" />
<entry file="file://$PROJECT_DIR$/src/sample/ImageConverter.fxml">
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1905">
<caret line="127" column="23" lean-forward="false" selection-start-line="127" selection-start-column="23" selection-end-line="127" selection-end-column="23" />
<folding />
</state>
</provider>
<provider editor-type-id="JavaFX-Scene-Builder">
<state />
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/util/HashMap.java">
<provider selected="true" editor-type-id="text-editor">
@ -824,22 +791,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="832">
<caret line="58" column="17" lean-forward="false" selection-start-line="58" selection-start-column="17" selection-end-line="58" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="331">
<caret line="28" column="31" lean-forward="true" selection-start-line="28" selection-start-column="24" selection-end-line="28" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Resources/StringResultButtonPressed.png" />
<entry file="file://$PROJECT_DIR$/src/sample/Styles/checkBox.css">
<provider selected="true" editor-type-id="text-editor">
@ -862,13 +813,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/comboBox.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="464">
<caret line="54" column="0" lean-forward="false" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Resources/StringResultButton.psd">
<provider selected="true" editor-type-id="images">
<state />
@ -895,10 +839,61 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/textField.css">
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/javafx/scene/layout/Region.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="35" lean-forward="false" selection-start-line="18" selection-start-column="35" selection-end-line="18" selection-end-column="35" />
<state relative-caret-position="234">
<caret line="1104" column="31" lean-forward="false" selection-start-line="1104" selection-start-column="17" selection-end-line="1104" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/javafx-src.zip!/javafx/stage/Window.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="234">
<caret line="394" column="40" lean-forward="false" selection-start-line="394" selection-start-column="40" selection-end-line="394" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/lang/StrictMath.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="234">
<caret line="269" column="32" lean-forward="false" selection-start-line="269" selection-start-column="32" selection-end-line="269" selection-end-column="32" />
<folding />
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/lang/Math.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="249">
<caret line="338" column="28" lean-forward="true" selection-start-line="338" selection-start-column="28" selection-end-line="338" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Color.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="299">
<caret line="53" column="31" lean-forward="false" selection-start-line="53" selection-start-column="24" selection-end-line="53" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-530">
<caret line="87" column="20" lean-forward="true" selection-start-line="87" selection-start-column="20" selection-end-line="87" selection-end-column="20" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514732289000" expanded="true" signature="4130:5161" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Image.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="416">
<caret line="128" column="51" lean-forward="true" selection-start-line="128" selection-start-column="51" selection-end-line="128" selection-end-column="51" />
<folding />
</state>
</provider>
@ -911,35 +906,32 @@
</state>
</provider>
</entry>
<entry file="jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/src.zip!/java/lang/Math.java">
<entry file="file://$PROJECT_DIR$/src/sample/Styles/comboBox.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="380">
<caret line="715" column="23" lean-forward="false" selection-start-line="715" selection-start-column="23" selection-end-line="715" selection-end-column="23" />
<state relative-caret-position="810">
<caret line="54" column="0" lean-forward="false" selection-start-line="54" selection-start-column="0" selection-end-line="54" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Styles/textField.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="35" lean-forward="false" selection-start-line="18" selection-start-column="35" selection-end-line="18" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="864">
<caret line="277" column="45" lean-forward="true" selection-start-line="277" selection-start-column="45" selection-end-line="277" selection-end-column="45" />
<state relative-caret-position="219">
<caret line="209" column="70" lean-forward="false" selection-start-line="209" selection-start-column="70" selection-end-line="209" selection-end-column="70" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/sample/OCIF.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="314">
<caret line="137" column="34" lean-forward="true" selection-start-line="137" selection-start-column="34" selection-end-line="137" selection-end-column="34" />
<folding>
<element signature="imports" expanded="true" />
<marker date="1514453485000" expanded="true" signature="4152:5205" ph="..." />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

View File

@ -13,7 +13,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.collections.*?>
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="544.0" prefWidth="1056.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="606.0" prefWidth="1149.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
@ -23,7 +23,7 @@
<children>
<Pane>
<children>
<ImageView fx:id="imageView" fitHeight="706.0" fitWidth="1248.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<ImageView fx:id="imageView" fitHeight="805.0" fitWidth="1149.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Background.png" />
</image>
@ -33,7 +33,7 @@
</ImageView>
</children>
</Pane>
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000D0;" visible="false">
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000CC;" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
@ -99,60 +99,60 @@
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="45.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<FlowPane orientation="VERTICAL">
<VBox>
<children>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" prefHeight="20.0" prefWidth="250.0" text="OC Image Converter" textFill="WHITE">
<font>
<Font name="Arial" size="16.0" />
</font>
<FlowPane.margin>
<Insets top="18.0" />
</FlowPane.margin>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Label>
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<font>
<Font size="11.0" />
</font>
<FlowPane.margin>
<Insets top="18.0" />
</FlowPane.margin>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
<Label fx:id="imageSizeInfoLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="N/A" textFill="WHITE">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
</VBox.margin>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="5.0" />
</FlowPane.margin>
</VBox.margin>
</TextField>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Format" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</VBox.margin>
</Label>
<ComboBox fx:id="encodingMethodComboBox" maxHeight="38.0" maxWidth="1.7976931348623157E308" onAction="#onTextFieldTextChanged" stylesheets="@Styles/comboBox.css">
<ComboBox fx:id="encodingMethodComboBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onAction="#onTextFieldTextChanged" prefHeight="38.0" stylesheets="@Styles/comboBox.css">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="OCIFString" />
@ -160,32 +160,53 @@
<String fx:value="OCIF6 (Optimized)" />
</FXCollections>
</items>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</VBox.margin>
</ComboBox>
<CheckBox fx:id="keepProportionsCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onProportionsCheckBoxClicked" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Keep proportions" textFill="WHITE">
<FlowPane.margin>
<VBox.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
</VBox.margin>
</CheckBox>
<CheckBox fx:id="brailleCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable Braille font" textFill="WHITE">
<FlowPane.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
<VBox.margin>
<Insets left="10.0" top="12.0" />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE">
<FlowPane.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
</CheckBox>
<Slider fx:id="ditheringSlider" maxWidth="1.7976931348623157E308" minorTickCount="2" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<FlowPane.margin>
<Insets left="5.0" right="5.0" top="15.0" />
</FlowPane.margin>
</Slider>
<GridPane fx:id="ditheringMainPane" prefHeight="120.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane fx:id="ditheringBackgroundPane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: FFFFFF10;">
<children>
<Label fx:id="ditheringOpacityLabel" alignment="CENTER" layoutY="45.0" minHeight="0.0" prefWidth="250.0" text="Opacity" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<Slider fx:id="ditheringOpacitySlider" layoutY="65.0" minHeight="0.0" prefWidth="250.0" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</Slider>
</children></Pane>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<GridPane.margin>
<Insets left="10.0" top="6.0" />
</GridPane.margin>
</CheckBox>
</children>
<VBox.margin>
<Insets top="6.0" />
</VBox.margin>
</GridPane>
</children>
</FlowPane>
</VBox>
<Button fx:id="convertButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#save" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Convert" GridPane.rowIndex="1">
<font>
<Font size="11.0" />

View File

@ -38,11 +38,25 @@ public class Color {
public static Color sum(Color color1, Color color2)
{
int aSum = color1.alpha + color2.alpha;
int rSum = color1.red + color2.red;
int gSum = color1.green + color2.green;
int bSum = color1.blue + color2.blue;
if (aSum > 255) aSum = 255;
if (rSum > 255) rSum = 255;
if (gSum > 255) gSum = 255;
if (bSum > 255) bSum = 255;
return new Color(aSum, rSum, gSum, bSum);
}
public static Color average(Color color1, Color color2) {
return new Color(
color1.alpha + color2.alpha,
color1.red + color2.red,
color1.green + color2.green,
color1.blue + color2.blue
(color1.alpha + color2.alpha) / 2,
(color1.red + color2.red) / 2,
(color1.green + color2.green) / 2,
(color1.blue + color2.blue) / 2
);
}

View File

@ -96,6 +96,11 @@ public class Image {
return new Pixel(minColor, maxColor, 0x00, brailleChar);
}
private static final double Xp1Yp0 = 7.0d / 16.0d;
private static final double Xp1Yp1 = 1.0d / 16.0d;
private static final double Xp0Yp1 = 5.0d / 16.0d;
private static final double Xm1Y1 = 3.0d / 16.0d;
static Image dither(Image image, double intensity) {
for (int y = 0; y < image.height; y++) {
for (int x = 0; x < image.width; x++) {
@ -108,13 +113,13 @@ public class Image {
if (x < image.width - 1) {
image.pixels[y][x + 1] = Color.sum(
image.pixels[y][x + 1],
Color.multiply(colorDifference, 7.0d / 16.0d * intensity / 100.0d)
Color.multiply(colorDifference, Xp1Yp0 * intensity)
);
if (y < image.height - 1) {
image.pixels[y + 1][x + 1] = Color.sum(
image.pixels[y + 1][x + 1],
Color.multiply(colorDifference, 1.0d / 16.0d * intensity / 100.0d)
Color.multiply(colorDifference, Xp1Yp1 * intensity)
);
}
}
@ -122,13 +127,13 @@ public class Image {
if (y < image.height - 1) {
image.pixels[y + 1][x] = Color.sum(
image.pixels[y + 1][x],
Color.multiply(colorDifference, 5.0d / 16.0d * intensity / 100.0d)
Color.multiply(colorDifference, Xp0Yp1 * intensity)
);
if (x > 0) {
image.pixels[y + 1][x - 1] = Color.sum(
image.pixels[y + 1][x - 1],
Color.multiply(colorDifference, 3.0d / 16.0d * intensity / 100.0d)
Color.multiply(colorDifference, Xm1Y1 * intensity)
);
}
}
@ -138,6 +143,7 @@ public class Image {
return image;
}
static Pixel getSemiPixel(Image image, int x, int y) {
Color upper = image.pixels[y][x], lower = new Color(0xFF, 0x0, 0x0, 0x0);

View File

@ -13,7 +13,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.collections.*?>
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="544.0" prefWidth="1056.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<GridPane fx:id="mainPane" onDragEntered="#onHintsGridPaneDragEntered" prefHeight="606.0" prefWidth="1149.0" styleClass="cyka" stylesheets="@Styles/Cells.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Main">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
@ -23,7 +23,7 @@
<children>
<Pane>
<children>
<ImageView fx:id="imageView" fitHeight="706.0" fitWidth="1248.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<ImageView fx:id="imageView" fitHeight="805.0" fitWidth="1149.0" nodeOrientation="INHERIT" onMouseDragged="#onImageDrag" onMousePressed="#onImageClick" onScroll="#onImageScroll" pickOnBounds="true" preserveRatio="true" GridPane.halignment="CENTER" GridPane.valignment="CENTER">
<image>
<Image url="@Resources/Background.png" />
</image>
@ -33,7 +33,7 @@
</ImageView>
</children>
</Pane>
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000D0;" visible="false">
<GridPane fx:id="hintsGridPane" onDragExited="#onHintsGridPaneDragExited" onMousePressed="#onHintsGridPaneDragMouseClicked" prefHeight="489.0" prefWidth="840.0" style="-fx-background-color: #000000CC;" visible="false">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
@ -99,60 +99,60 @@
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="40.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="-Infinity" minHeight="-Infinity" prefHeight="45.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<FlowPane orientation="VERTICAL">
<VBox>
<children>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" prefHeight="20.0" prefWidth="250.0" text="OC Image Converter" textFill="WHITE">
<font>
<Font name="Arial" size="16.0" />
</font>
<FlowPane.margin>
<Insets top="18.0" />
</FlowPane.margin>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Label>
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<Button fx:id="openButton" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" mnemonicParsing="false" onMousePressed="#open" prefHeight="38.0" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Open">
<font>
<Font size="11.0" />
</font>
<FlowPane.margin>
<Insets top="18.0" />
</FlowPane.margin>
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
<Label fx:id="imageSizeInfoLabel" alignment="CENTER" maxWidth="1.7976931348623157E308" text="N/A" textFill="WHITE">
<FlowPane.margin>
<Insets top="10.0" />
</FlowPane.margin>
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
</VBox.margin>
</Label>
<TextField fx:id="widthTextField" alignment="CENTER" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Ширина" styleClass="textField" stylesheets="@Styles/textField.css" text="160">
<font>
<Font size="12.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</VBox.margin>
</TextField>
<TextField fx:id="heightTextField" alignment="CENTER" disable="true" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onKeyReleased="#onTextFieldTextChanged" prefHeight="38.0" promptText="Высота" styleClass="textField" stylesheets="@Styles/textField.css" text="50">
<font>
<Font size="12.0" />
</font>
<VBox.margin>
<Insets top="5.0" />
</FlowPane.margin>
</VBox.margin>
</TextField>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Format" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</VBox.margin>
</Label>
<ComboBox fx:id="encodingMethodComboBox" maxHeight="38.0" maxWidth="1.7976931348623157E308" onAction="#onTextFieldTextChanged" stylesheets="@Styles/comboBox.css">
<ComboBox fx:id="encodingMethodComboBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" minHeight="-Infinity" onAction="#onTextFieldTextChanged" prefHeight="38.0" stylesheets="@Styles/comboBox.css">
<items>
<FXCollections fx:factory="observableArrayList">
<String fx:value="OCIFString" />
@ -160,32 +160,53 @@
<String fx:value="OCIF6 (Optimized)" />
</FXCollections>
</items>
<FlowPane.margin>
<VBox.margin>
<Insets top="10.0" />
</FlowPane.margin>
</VBox.margin>
</ComboBox>
<CheckBox fx:id="keepProportionsCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onProportionsCheckBoxClicked" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Keep proportions" textFill="WHITE">
<FlowPane.margin>
<VBox.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
</VBox.margin>
</CheckBox>
<CheckBox fx:id="brailleCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable Braille font" textFill="WHITE">
<FlowPane.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
<VBox.margin>
<Insets left="10.0" top="12.0" />
</VBox.margin>
</CheckBox>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE">
<FlowPane.margin>
<Insets left="10.0" top="15.0" />
</FlowPane.margin>
</CheckBox>
<Slider fx:id="ditheringSlider" maxWidth="1.7976931348623157E308" minorTickCount="2" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<FlowPane.margin>
<Insets left="5.0" right="5.0" top="15.0" />
</FlowPane.margin>
</Slider>
<GridPane fx:id="ditheringMainPane" prefHeight="120.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Pane fx:id="ditheringBackgroundPane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: FFFFFF10;">
<children>
<Label fx:id="ditheringOpacityLabel" alignment="CENTER" layoutY="45.0" minHeight="0.0" prefWidth="250.0" text="Opacity" textFill="WHITE">
<font>
<Font name="Arial" size="11.0" />
</font>
</Label>
<Slider fx:id="ditheringOpacitySlider" layoutY="65.0" minHeight="0.0" prefWidth="250.0" showTickLabels="true" showTickMarks="true" stylesheets="@Styles/slider.css" value="100.0">
<padding>
<Insets left="5.0" right="5.0" />
</padding>
</Slider>
</children></Pane>
<CheckBox fx:id="ditheringCheckBox" maxHeight="-Infinity" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMouseClicked="#onDitheringStateChanged" selected="true" styleClass="checkBox" stylesheets="@Styles/checkBox.css" text="Enable dithering" textFill="WHITE" GridPane.halignment="LEFT" GridPane.valignment="TOP">
<GridPane.margin>
<Insets left="10.0" top="6.0" />
</GridPane.margin>
</CheckBox>
</children>
<VBox.margin>
<Insets top="6.0" />
</VBox.margin>
</GridPane>
</children>
</FlowPane>
</VBox>
<Button fx:id="convertButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onMousePressed="#save" styleClass="defaultButton" stylesheets="@Styles/button.css" text="Convert" GridPane.rowIndex="1">
<font>
<Font size="11.0" />

View File

@ -4,6 +4,8 @@ import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
@ -15,6 +17,8 @@ import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.*;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@ -29,6 +33,8 @@ import java.util.regex.Pattern;
public class Main extends Application {
public GridPane mainPane;
public CheckBox keepProportionsCheckBox;
public Button openButton;
public Button convertButton;
@ -36,13 +42,10 @@ public class Main extends Application {
public TextField heightTextField;
public ImageView imageView;
public CheckBox brailleCheckBox;
public CheckBox ditheringCheckBox;
public Label imageSizeInfoLabel;
public Slider ditheringSlider;
public ComboBox<String> encodingMethodComboBox;
public ImageView dragDropFilesImageView;
public GridPane settingsPane;
public GridPane mainPane;
public GridPane hintsGridPane;
public GridPane dragImageGridPane;
@ -51,6 +54,12 @@ public class Main extends Application {
public ImageView OCIFStringResultImageView;
public GridPane OCIFStringResultGridPane;
public CheckBox ditheringCheckBox;
public GridPane ditheringMainPane;
public Label ditheringOpacityLabel;
public Pane ditheringBackgroundPane;
public Slider ditheringOpacitySlider;
private String currentImagePath = "sample/Resources/Background.png";
@Override
@ -184,7 +193,29 @@ public class Main extends Application {
}
public void onDitheringStateChanged() {
ditheringSlider.setDisable(!ditheringCheckBox.isSelected());
boolean state = ditheringCheckBox.isSelected();
Timeline timeline = newTimeLine(
150,
new KeyValue[] {
new KeyValue(ditheringBackgroundPane.opacityProperty(), state ? 0 : 1),
new KeyValue(ditheringMainPane.prefHeightProperty(), state ? 38 : 120),
new KeyValue(ditheringOpacitySlider.layoutYProperty(), state ? 38 : 65),
new KeyValue(ditheringOpacityLabel.layoutYProperty(), state ? 38 : 45)
},
new KeyValue[] {
new KeyValue(ditheringBackgroundPane.opacityProperty(), state ? 1 : 0),
new KeyValue(ditheringMainPane.prefHeightProperty(), state ? 120 : 38),
new KeyValue(ditheringOpacitySlider.layoutYProperty(), state ? 65 : 38),
new KeyValue(ditheringOpacityLabel.layoutYProperty(), state ? 45 : 38)
}
);
timeline.setOnFinished(event -> ditheringOpacitySlider.setDisable(!state));
timeline.play();
}
private boolean checkTextField(TextField textField) {
@ -272,12 +303,12 @@ public class Main extends Application {
public void save() throws IOException {
if (encodingMethodComboBox.getValue().contains("OCIFString")) {
OCIFStringResultTextField.setText(OCIF.convertToString(
currentImagePath,
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringSlider.getValue()
currentImagePath,
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringOpacitySlider.getValue() / 100.0d
));
hintsGridPane.setVisible(true);
@ -293,14 +324,14 @@ public class Main extends Application {
if (file != null) {
OCIF.convert(
currentImagePath,
file.getPath(),
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
encodingMethodComboBox.getValue().contains("OCIF6") ? 6 : 5,
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringSlider.getValue()
currentImagePath,
file.getPath(),
Integer.parseInt(widthTextField.getText()),
Integer.parseInt(heightTextField.getText()),
encodingMethodComboBox.getValue().contains("OCIF6") ? 6 : 5,
brailleCheckBox.isSelected(),
ditheringCheckBox.isSelected(),
ditheringOpacitySlider.getValue() / 100.0d
);
}
}

View File

@ -80,7 +80,7 @@ class OCIF {
}
}
private static sample.Image loadImage(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double ditheringIntensity) {
private static sample.Image loadImage(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double opacity) {
sample.Image image = new sample.Image(new javafx.scene.image.Image(imagePath,
requestedWidth * (convertAsBraille ? 2 : 1),
requestedHeight * (convertAsBraille ? 4 : 2),
@ -89,7 +89,7 @@ class OCIF {
));
if (enableDithering) {
image = sample.Image.dither(image, ditheringIntensity);
image = sample.Image.dither(image, opacity);
}
return image;
@ -102,8 +102,8 @@ class OCIF {
result.append(pixel.symbol);
}
static String convertToString(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double ditheringIntensity) {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, ditheringIntensity);
static String convertToString(String imagePath, int requestedWidth, int requestedHeight, boolean convertAsBraille, boolean enableDithering, double opacity) {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, opacity);
StringBuilder result = new StringBuilder();
result.append(String.format("%02X", requestedWidth));
@ -127,8 +127,8 @@ class OCIF {
return result.toString();
}
static void convert(String imagePath, String convertedImagePath, int requestedWidth, int requestedHeight, int encodingMethod, boolean convertAsBraille, boolean enableDithering, double ditheringIntensity) throws IOException {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, ditheringIntensity);
static void convert(String imagePath, String convertedImagePath, int requestedWidth, int requestedHeight, int encodingMethod, boolean convertAsBraille, boolean enableDithering, double opacity) throws IOException {
sample.Image image = loadImage(imagePath, requestedWidth, requestedHeight, convertAsBraille, enableDithering, opacity);
FileOutputStream out = new FileOutputStream(convertedImagePath);