Skip to content

Commit

Permalink
Improved colors of icons a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaldispuehl committed Nov 11, 2017
1 parent d499f3e commit f5be54a
Show file tree
Hide file tree
Showing 23 changed files with 784 additions and 698 deletions.
1,384 changes: 730 additions & 654 deletions intervalmusiccompositor.build/footage/icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.text.DecimalFormat;

/**
* @author nw
* Formats time.
*/
public class FormatTime {

Expand All @@ -12,7 +12,7 @@ public class FormatTime {

/**
* Takes seconds as argument and formats them to for time display ('MM:SS', or 'H:MM:SS' if there are hours).
*
*
* @param seconds
* , a positive number of seconds, if not integer it is rounded.
* @return the formatted string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
import java.util.List;

/**
* @author nw
* Creates an envelope image from
*/
class EnvelopeImage {

private static int BACKGROUND_RED = 245;
private static int BACKGROUND_GREEN = 245;
private static int BACKGROUND_BLUE = 245;
private int env_red = 55;
private int env_green = 119;
private int env_blue = 248;
private int env_mean_red = 113;
private int env_mean_green = 174;
private int env_mean_blue = 243;
//---- Static

private static String BACKGROUND_COLOR = "#f5f5f5";
private static String ENVELOPE_COLOR = "#2196F3";
private static String ENVELOPE_MEAN_COLOR = "#64B5F6";


//---- Fields

private WritableImage writableImage;

private int width = 0;
private int height = 0;


//---- Constructor

EnvelopeImage(Integer width, Integer height) {
writableImage = new WritableImage(width, height);
Expand All @@ -36,9 +36,12 @@ class EnvelopeImage {
this.height = height;

// Initialize image with color
fill(BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE);
fill(BACKGROUND_COLOR);
}


//---- Methods

void generateEnvelope(InputStream inputStream, long compilationDataSize, List<Integer> soundPattern, List<Integer> breakPattern, int iterations) throws IOException {
if (compilationDataSize == 0) {
return;
Expand Down Expand Up @@ -86,15 +89,15 @@ void generateEnvelope(InputStream inputStream, long compilationDataSize, List<In
aggregatedAudioIntArrayLeftMean[i] = aggregatedAudioIntArrayLeftMean[i] / currentSamples * 4;
aggregatedAudioIntArrayRightMean[i] = aggregatedAudioIntArrayRightMean[i] / currentSamples * 4;

drawEnvelopeAmplitude(i, (double) aggregatedAudioIntArrayLeft[i] / 32767, (double) aggregatedAudioIntArrayRight[i] / 32767, env_red, env_green, env_blue);
drawEnvelopeAmplitude(i, (double) aggregatedAudioIntArrayLeftMean[i] / 32767, (double) aggregatedAudioIntArrayRightMean[i] / 32767, env_mean_red, env_mean_green, env_mean_blue);
drawEnvelopeAmplitude(i, (double) aggregatedAudioIntArrayLeft[i] / 32767, (double) aggregatedAudioIntArrayRight[i] / 32767, ENVELOPE_COLOR);
drawEnvelopeAmplitude(i, (double) aggregatedAudioIntArrayLeftMean[i] / 32767, (double) aggregatedAudioIntArrayRightMean[i] / 32767, ENVELOPE_MEAN_COLOR);

i++;
}

}

private void drawEnvelopeAmplitude(int x_px_position, double amp_left, double amp_right, int red, int green, int blue) {
private void drawEnvelopeAmplitude(int x_px_position, double amp_left, double amp_right, String webColor) {

if (1 < amp_left) {
amp_left = 1;
Expand All @@ -119,23 +122,23 @@ private void drawEnvelopeAmplitude(int x_px_position, double amp_left, double am

// Draw left (which is from center to top)
for (int i = centerPixel; i > ((int) (left * (1 - amp_left))); i--) {
setPixel(x_px_position, i, red, green, blue);
setPixel(x_px_position, i, webColor);
}

// Draw right (which is from center to bottom)
for (int i = centerPixel; i < centerPixel + ((int) (right * (amp_right))); i++) {
setPixel(x_px_position, i, red, green, blue);
setPixel(x_px_position, i, webColor);
}
}

private void setPixel(int x, int y, int red, int green, int blue) {
writableImage.getPixelWriter().setColor(x, y, Color.rgb(red, green, blue));
private void setPixel(int x, int y, String webColor) {
writableImage.getPixelWriter().setColor(x, y, Color.web(webColor));
}

private void fill(int red, int green, int blue) {
private void fill(String webColor) {
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
setPixel(j, i, red, green, blue);
setPixel(j, i, webColor);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ private class AudioFileListCellController extends HBox {

private SimpleBooleanProperty isBpmSupported = new SimpleBooleanProperty(false);

private Image loading = new Image(getClass().getResource("/images/waiting_icon.gif").toString());
private Image ok = new Image(getClass().getResource("/images/music_icon.png").toString());
private Image error = new Image(getClass().getResource("/images/error_icon.png").toString());
private Image warning = new Image(getClass().getResource("/images/tooshort_icon.png").toString());
private Image processing = new Image(getClass().getResource("/images/tracklist/processing_icon.gif").toString());
private Image ok = new Image(getClass().getResource("/images/tracklist/music_icon.png").toString());
private Image error = new Image(getClass().getResource("/images/tracklist/error_icon.png").toString());
private Image warning = new Image(getClass().getResource("/images/tracklist/tooshort_icon.png").toString());
private Image queued = new Image(getClass().getResource("/images/tracklist/queued_icon.png").toString());

@FXML
ImageView imageView;
Expand Down Expand Up @@ -198,7 +199,7 @@ private void setTitleWith(IAudioFile audioFile) {
private void setStatusWith(IAudioFile audioFile) {
switch (audioFile.getStatus()) {
case IN_PROGRESS:
imageView.setImage(loading);
imageView.setImage(processing);
status.setText(resourceBundle.getString("ui.form.music_list.loading_text"));
return;
case ERROR:
Expand All @@ -209,6 +210,10 @@ private void setStatusWith(IAudioFile audioFile) {
imageView.setImage(ok);
status.setText(audioFile.getSource().getParentFile().getAbsolutePath());
return;
case QUEUED:
imageView.setImage(queued);
status.setText(resourceBundle.getString("ui.form.music_list.queuing_text"));
return;
default:
imageView.setImage(warning);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import ch.retorte.intervalmusiccompositor.messagebus.DebugMessage;
import ch.retorte.intervalmusiccompositor.spi.MusicListControl;
import ch.retorte.intervalmusiccompositor.spi.messagebus.MessageProducer;
import javafx.application.Platform;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.fxml.FXML;
Expand Down Expand Up @@ -98,9 +99,12 @@ public void show() {
stage.setScene(new Scene(parent));
stage.setResizable(true);
stage.show();

stage.setMinWidth(stage.getWidth());
stage.setMinHeight(stage.getHeight());
Platform.runLater(() -> {
/* We do these little tricks to adapt the window size to the stages content. */
stage.sizeToScene();
stage.setMinWidth(stage.getWidth());
stage.setMinHeight(stage.getHeight());
});
}

private void initialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,17 @@ public class BarChart {
*/
public BarChart(Integer width, Integer height) {
image = new WritableImage(width, height);
fill(245, 245, 245);
fill("#f5f5f5");
}

/**
* Fills the background of the bar chart.
*
* @param red
* Red value for background (0-255)
* @param green
* Green value for background (0-255)
* @param blue
* Blue value for background (0-255)
* @param webColor
* the color in hex representation (e.g. '#123456')
*/
private void fill(int red, int green, int blue) {
Color color = Color.rgb(red, green, blue);
private void fill(String webColor) {
Color color = Color.web(webColor);

for (int i = 0; i < image.getHeight(); i++) {
for (int j = 0; j < image.getWidth(); j++) {
Expand Down Expand Up @@ -89,10 +85,10 @@ public void generate(List<Integer> soundPattern, List<Integer> breakPattern, Int
Font breakFont = Font.font("Sans Serif", FontWeight.NORMAL, 9);
FontMetrics breakFontMetrics = Toolkit.getToolkit().getFontLoader().getFontMetrics(breakFont);

Color darkBlue = Color.rgb(33, 150, 243);
Color lightBlue = Color.rgb(100, 181, 246);
Color evenLighterBlue = Color.rgb(187, 222, 251);
Color soundEffectsColor = Color.rgb(139, 195, 74);
Color darkBlue = Color.web("#2196F3");
Color lightBlue = Color.web("#03A9F4");
Color evenLighterBlue = Color.web("#81D4FA");
Color soundEffectsColor = Color.web("#8BC34A");
Color textColor = Color.GRAY;

double top = 0;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<fx:root stylesheets="@/styles/AudioFileListCell.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1"
type="javafx.scene.layout.HBox" spacing="5">
<ImageView fx:id="imageView">
<Image url="@/images/waiting_icon.gif"/>
<Image url="@/images/tracklist/queued_icon.png"/>
</ImageView>
<VBox>
<HBox spacing="5" fx:id="metaDataLine">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ ui.form.music_list.list_mode.shuffle = Zufällig
ui.form.music_list.list_mode.manual = Manuell
ui.form.music_list.tooshort_error = Stück ist zu kurz für Intervalle
ui.form.music_list.loading_text = Lade ...
ui.form.music_list.queuing_text = In Warteschlange
ui.form.break_list.label = Pausenmusikstück
ui.form.break_list.add_label = +
ui.form.break_list.add_tooltip = Pausenstück hinzufügen ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ui.form.music_list.list_mode.shuffle = Shuffle
ui.form.music_list.list_mode.manual = Manual
ui.form.music_list.tooshort_error = Track is too short for chosen values!
ui.form.music_list.loading_text = Loading ...
ui.form.music_list.queuing_text = Waiting in queue
ui.form.break_list.label = Break Track
ui.form.break_list.add_label = +
ui.form.break_list.add_tooltip = Add break track ...
Expand Down

0 comments on commit f5be54a

Please sign in to comment.