missing files

This commit is contained in:
huangyuhui
2017-01-25 12:56:00 +08:00
parent 67a61493dd
commit 74ad750d1d
23 changed files with 627 additions and 31 deletions

View File

@@ -17,9 +17,6 @@ deploy:
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}-MacOSApp.zip
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}-MacOSApp.zip
on:
repo: huanghongxun/HMCL
tags: false

View File

@@ -46,7 +46,7 @@ def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
if (buildnumber == null)
buildnumber = System.getenv("BUILD_NUMBER")
if (buildnumber == null)
buildnumber = "1"
buildnumber = "2"
def versionroot = System.getenv("VERSION_ROOT")
if (versionroot == null)

View File

@@ -77,21 +77,6 @@ public final class Main implements Runnable {
};
private static final HostnameVerifier HNV = (hostname, session) -> true;
static {
SSLContext sslContext = null;
try {
sslContext = SSLContext.getInstance("TLS");
X509TrustManager[] xtmArray = new X509TrustManager[] { XTM };
sslContext.init(null, xtmArray, new java.security.SecureRandom());
} catch (GeneralSecurityException gse) {
}
if (sslContext != null)
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(HNV);
}
public static final String LAUNCHER_NAME = "Hello Minecraft! Launcher";
public static final String LAUNCHER_VERSION = "@HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING@";
public static final int MINIMUM_LAUNCHER_VERSION = 16;
@@ -129,6 +114,16 @@ public final class Main implements Runnable {
System.setProperty("swing.aatext", "true");
System.setProperty("sun.java2d.noddraw", "true");
System.setProperty("sun.java2d.dpiaware", "false");
System.setProperty("https.protocols", "SSLv3,TLSv1");
try {
SSLContext c = SSLContext.getInstance("SSL");
c.init(null, new X509TrustManager[] { XTM }, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(c.getSocketFactory());
} catch (GeneralSecurityException ignore) {
}
HttpsURLConnection.setDefaultHostnameVerifier(HNV);
Thread.setDefaultUncaughtExceptionHandler(new CrashReporter(true));
try {

View File

@@ -53,6 +53,8 @@ public final class Config implements Cloneable {
private String proxyPassword;
@SerializedName("enableShadow")
private boolean enableShadow;
@SerializedName("enableBlur")
private boolean enableBlur;
@SerializedName("decorated")
private boolean decorated;
@SerializedName("theme")
@@ -108,6 +110,15 @@ public final class Config implements Cloneable {
Settings.save();
}
public boolean isEnableBlur() {
return enableBlur;
}
public void setEnableBlur(boolean enableBlur) {
this.enableBlur = enableBlur;
Settings.save();
}
public String getLast() {
if (last == null)
last = Settings.DEFAULT_PROFILE;
@@ -183,7 +194,7 @@ public final class Config implements Cloneable {
public Config() {
clientToken = UUID.randomUUID().toString();
logintype = downloadtype = 0;
enableShadow = false;
enableBlur = enableShadow = true;
theme = 4;
decorated = OS.os() == OS.LINUX;
auth = new HashMap<>();

View File

@@ -0,0 +1,86 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.launcher.ui;
import java.awt.AlphaComposite;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;
import org.jackhuang.hellominecraft.util.ui.StackBlurFilter;
/**
*
* @author huangyuhui
*/
public class GaussionPage extends Page {
private transient BufferedImage aeroBuffer; // 模糊缓存
private transient Image backgroundImage;
private final List<JPanel> aeroObject = new ArrayList<>();
private transient Graphics2D aeroGraphics; // 模糊对象
private static final int RADIUS = 10; // 模糊半径
private transient final StackBlurFilter stackBlurFilter = new StackBlurFilter(RADIUS);
private transient BufferedImage cache = null;
public void setBackgroundImage(Image backgroundImage) {
this.backgroundImage = backgroundImage;
}
public void addAeroObject(JPanel aeroObject) {
this.aeroObject.add(aeroObject);
cache = null;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (backgroundImage == null)
return;
if (cache == null || getWidth() != cache.getWidth() || getHeight() != cache.getHeight()) {
cache = new BufferedImage(getWidth(), getHeight(), 2);
Graphics2D g2 = cache.createGraphics();
g2.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), null);
for (JPanel panel : aeroObject) {
Rectangle aeroRect = panel.getBounds();
if (aeroBuffer == null || aeroBuffer.getWidth() != aeroRect.width + RADIUS || aeroBuffer.getHeight() != aeroRect.height + RADIUS) {
if (aeroBuffer != null && aeroGraphics != null) {
aeroBuffer.flush();
aeroGraphics.dispose();
}
aeroBuffer = new BufferedImage(aeroRect.width + RADIUS, aeroRect.height + RADIUS, BufferedImage.TRANSLUCENT);
}
aeroGraphics = aeroBuffer.createGraphics();
aeroGraphics.setComposite(AlphaComposite.Src);
aeroGraphics.drawImage(backgroundImage, 0, 0, aeroBuffer.getWidth(), aeroBuffer.getHeight(), aeroRect.x, aeroRect.y, aeroRect.x + aeroRect.width, aeroRect.y + aeroRect.height, null);
aeroBuffer = stackBlurFilter.filter(aeroBuffer, null);
g2.drawImage(aeroBuffer, aeroRect.x, aeroRect.y, aeroRect.x + aeroRect.width, aeroRect.y + aeroRect.height, RADIUS / 2, RADIUS / 2, RADIUS / 2 + aeroRect.width, RADIUS / 2 + aeroRect.height, null);
}
g2.dispose();
}
g.drawImage(cache, 0, 0, getWidth(), getHeight(), null);
}
}

View File

@@ -0,0 +1,34 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.launcher.ui;
import java.awt.Rectangle;
import java.awt.Window;
import java.util.Collection;
import javax.swing.JComponent;
/**
*
* @author huang
*/
public interface IRepaint {
JComponent getRepaintComponent();
Window getRepaintWindow();
Collection<Rectangle> getRepaintRects();
}

View File

@@ -72,6 +72,8 @@
</Group>
<Group type="102" attributes="0">
<Component id="chkEnableShadow" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="chkEnableBlur" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="chkDecorated" min="-2" max="-2" attributes="0"/>
</Group>
@@ -120,6 +122,7 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="chkEnableShadow" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chkDecorated" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="chkEnableBlur" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -341,5 +344,15 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMCBBSActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="chkEnableBlur">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/jackhuang/hellominecraft/lang/I18N.properties" key="launcher.enable_blur" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkEnableBlurItemStateChanged"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -72,6 +72,7 @@ public class LauncherSettingsPanel extends RepaintPage {
cboDownloadSource.setSelectedIndex(Settings.getInstance().getDownloadType());
cboTheme.setSelectedIndex(Settings.getInstance().getTheme().ordinal());
chkEnableShadow.setSelected(Settings.getInstance().isEnableShadow());
chkEnableBlur.setSelected(Settings.getInstance().isEnableBlur());
chkDecorated.setSelected(Settings.getInstance().isDecorated());
}
@@ -115,6 +116,7 @@ public class LauncherSettingsPanel extends RepaintPage {
lblLang = new javax.swing.JLabel();
lblRestart = new javax.swing.JLabel();
btnMCBBS = new javax.swing.JButton();
chkEnableBlur = new javax.swing.JCheckBox();
cboDownloadSource.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
@@ -235,6 +237,14 @@ public class LauncherSettingsPanel extends RepaintPage {
}
});
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/jackhuang/hellominecraft/lang/I18N"); // NOI18N
chkEnableBlur.setText(bundle.getString("launcher.enable_blur")); // NOI18N
chkEnableBlur.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
chkEnableBlurItemStateChanged(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -287,6 +297,8 @@ public class LauncherSettingsPanel extends RepaintPage {
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(chkEnableShadow)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(chkEnableBlur)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(chkDecorated)))
.addContainerGap())
@@ -325,7 +337,8 @@ public class LauncherSettingsPanel extends RepaintPage {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(chkEnableShadow)
.addComponent(chkDecorated))
.addComponent(chkDecorated)
.addComponent(chkEnableBlur))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCheckUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -416,6 +429,10 @@ public class LauncherSettingsPanel extends RepaintPage {
SwingUtils.openLink(C.URL_PUBLISH);
}//GEN-LAST:event_btnMCBBSActionPerformed
private void chkEnableBlurItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkEnableBlurItemStateChanged
Settings.getInstance().setEnableBlur(chkEnableBlur.isSelected());
}//GEN-LAST:event_chkEnableBlurItemStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCheckUpdate;
private javax.swing.JButton btnMCBBS;
@@ -424,6 +441,7 @@ public class LauncherSettingsPanel extends RepaintPage {
private javax.swing.JComboBox cboLang;
private javax.swing.JComboBox cboTheme;
private javax.swing.JCheckBox chkDecorated;
private javax.swing.JCheckBox chkEnableBlur;
private javax.swing.JCheckBox chkEnableShadow;
private javax.swing.JLabel lblAbout;
private javax.swing.JLabel lblBackground;

View File

@@ -285,4 +285,4 @@
</SubComponents>
</Container>
</SubComponents>
</Form>
</Form>

View File

@@ -90,7 +90,8 @@ public class MainPagePanel extends GaussionPage {
prepareAuths();
addAeroObject(pnlMore);
if (Settings.getInstance().isEnableBlur())
addAeroObject(pnlMore);
setBackgroundImage(MainFrame.INSTANCE.background.getImage());
((RepaintPage) pnlMore).setRepainter(this);

View File

@@ -0,0 +1,48 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.launcher.ui;
import java.awt.Container;
import java.awt.Rectangle;
import java.awt.Window;
import javax.swing.JComponent;
import javax.swing.RepaintManager;
/**
*
* @author huangyuhui
*/
public class MyRepaintManager extends RepaintManager {
@Override
public void addDirtyRegion(JComponent c, int x, int y, int w, int h) {
super.addDirtyRegion(c, x, y, w, h);
for (Container parent = c.getParent(); (parent instanceof JComponent || parent instanceof Window) && parent.isVisible(); parent = parent.getParent()) {
if (parent instanceof IRepaint) {
IRepaint d = (IRepaint) parent;
for (Rectangle r : d.getRepaintRects()) {
if (d.getRepaintComponent() != null)
super.addDirtyRegion(d.getRepaintComponent(), r.x, r.y, r.width, r.height);
if (d.getRepaintWindow() != null)
super.addDirtyRegion(d.getRepaintWindow(), r.x, r.y, r.width, r.height);
}
}
}
}
}

View File

@@ -0,0 +1,56 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.launcher.ui;
import java.awt.Rectangle;
import java.awt.Window;
import java.util.Arrays;
import java.util.Collection;
import javax.swing.JComponent;
/**
*
* @author huang
*/
public class RepaintPage extends Page implements IRepaint {
public RepaintPage() {
super();
}
JComponent repainter;
@Override
public JComponent getRepaintComponent() {
return repainter;
}
public void setRepainter(JComponent repainter) {
this.repainter = repainter;
}
@Override
public Collection<Rectangle> getRepaintRects() {
return Arrays.asList(this.getBounds());
}
@Override
public Window getRepaintWindow() {
return null;
}
}

View File

@@ -0,0 +1,52 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.launcher.ui;
import java.awt.Dimension;
import javax.swing.JComboBox;
/**
*
* @author huang
*/
public class WideComboBox extends JComboBox {
public WideComboBox() {
}
private boolean layingOut = false;
public int customzedMinimumWidth = 300;
@Override
public void doLayout() {
try {
layingOut = true;
super.doLayout();
} finally {
layingOut = false;
}
}
@Override
public Dimension getSize() {
Dimension dim = super.getSize();
if (!layingOut)
dim.width = Math.max(dim.width, customzedMinimumWidth);
return dim;
}
}

View File

@@ -0,0 +1,26 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.util.ui;
/**
*
* @author huang
*/
public interface AlwaysDirty {
}

View File

@@ -0,0 +1,63 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.util.ui;
import java.awt.Color;
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author huangyuhui
*/
public class JSystemFileChooser extends JFileChooser {
public JSystemFileChooser() {
super();
}
public JSystemFileChooser(File f) {
super(f);
}
@Override
public void updateUI() {
LookAndFeel old = UIManager.getLookAndFeel();
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException ignored) {
old = null;
}
super.updateUI();
if (old != null) {
Color background = UIManager.getColor("Label.background");
setBackground(background);
setOpaque(true);
try {
UIManager.setLookAndFeel(old);
} catch (UnsupportedLookAndFeelException ignored) {
}
}
}
}

View File

@@ -0,0 +1,149 @@
package org.jackhuang.hellominecraft.util.ui;
/*
* Copyright (c) 2007, Romain Guy
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the TimingFramework project nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import java.awt.image.BufferedImage;
/**
* <p>A stack blur filter can be used to create an approximation of a
* gaussian blur. The approximation is controlled by the number of times the
* {@link org.jdesktop.swingx.image.FastBlurFilter} is applied onto the source
* picture. The default number of iterations, 3, provides a decent compromise
* between speed and rendering quality.</p>
* <p>The force of the blur can be controlled with a radius and the
* default radius is 3. Since the blur clamps values on the edges of the
* source picture, you might need to provide a picture with empty borders
* to avoid artifacts at the edges. The performance of this filter are
* independant from the radius.</p>
*
* @author Romain Guy <romain.guy@mac.com>
*/
public class StackBlurFilter extends AbstractFilter {
private final int radius;
private final int iterations;
/**
* <p>Creates a new blur filter with a default radius of 3 and 3 iterations.</p>
*/
public StackBlurFilter() {
this(3, 3);
}
/**
* <p>Creates a new blur filter with the specified radius and 3 iterations.
* If the radius is lower than 1, a radius of 1 will be used automatically.</p>
*
* @param radius the radius, in pixels, of the blur
*/
public StackBlurFilter(int radius) {
this(radius, 3);
}
/**
* <p>Creates a new blur filter with the specified radius. If the radius
* is lower than 1, a radius of 1 will be used automatically. The number
* of iterations controls the approximation to a gaussian blur. If the
* number of iterations is lower than 1, one iteration will be used
* automatically.</p>
*
* @param radius the radius, in pixels, of the blur
* @param iterations the number of iterations to approximate a gaussian blur
*/
public StackBlurFilter(int radius, int iterations) {
if (radius < 1) {
radius = 1;
}
if (iterations < 1) {
iterations = 1;
}
this.radius = radius;
this.iterations = iterations;
}
/**
* <p>Returns the effective radius of the stack blur. If the radius of the
* blur is 1 and the stack iterations count is 3, then the effective blur
* radius is 1 * 3 = 3.</p>
* @return the number of iterations times the blur radius
*/
public int getEffectiveRadius() {
return getIterations() * getRadius();
}
/**
* <p>Returns the radius used by this filter, in pixels.</p>
*
* @return the radius of the blur
*/
public int getRadius() {
return radius;
}
/**
* <p>Returns the number of iterations used to approximate a gaussian
* blur.</p>
*
* @return the number of iterations used by this blur
*/
public int getIterations() {
return iterations;
}
/**
* {@inheritDoc}
*/
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
int width = src.getWidth();
int height = src.getHeight();
if (dst == null) {
dst = createCompatibleDestImage(src, null);
}
int[] srcPixels = new int[width * height];
int[] dstPixels = new int[width * height];
GraphicsUtils.getPixels(src, 0, 0, width, height, srcPixels);
for (int i = 0; i < iterations; i++) {
// horizontal pass
FastBlurFilter.blur(srcPixels, dstPixels, width, height, radius);
// vertical pass
FastBlurFilter.blur(dstPixels, srcPixels, height, width, radius);
}
// the result is now stored in srcPixels due to the 2nd pass
GraphicsUtils.setPixels(dst, 0, 0, width, height, srcPixels);
return dst;
}
}

View File

@@ -0,0 +1,41 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {http://www.gnu.org/licenses/}.
*/
package org.jackhuang.hellominecraft.util.ui.wizard.spi;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.jackhuang.hellominecraft.util.func.Consumer;
/**
*
* @author huang
*/
public abstract class AbstractWizard implements WizardImplementation {
protected final List listenerList = Collections.synchronizedList(new LinkedList());
protected void fireChanged(Consumer<WizardObserver> r) {
WizardObserver[] listeners = (WizardObserver[]) listenerList.toArray(new WizardObserver[listenerList.size()]);
for (int i = listeners.length - 1; i >= 0; i--) {
WizardObserver l = (WizardObserver) listeners[i];
r.accept(l);
}
}
}

View File

@@ -310,11 +310,12 @@ launcher.choose_bgpath=选择背景路径
launcher.background_tooltip=<html><body>启动器默认使用自带的背景<br />如果当前目录有background.png则会使用该文件作为背景<br />如果当前目录有bg子目录则会随机使用里面的一张图作为背景<br />如果该背景地址被修改,则会使用背景地址里的一张图作为背景<br />背景地址允许有多个地址,使用半角分号";"(不包含双引号)分隔</body></html>
launcher.update_launcher=检查更新
launcher.enable_shadow=启用窗口阴影
launcher.enable_animation=启用动态效果
launcher.enable_blur=启用主界面模糊
launcher.theme=主题
launcher.proxy=代理
launcher.decorated=启用窗口边框(Linux下可解决程序界面全灰问题)
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">整合包作者帮助</a></html>
launcher.enable_animation=启用动态效果
launcher.lang=语言
launcher.restart=本界面选项需要重启本启动器生效

View File

@@ -310,11 +310,12 @@ launcher.choose_bgpath=\u9009\u62e9\u80cc\u666f\u8def\u5f84
launcher.background_tooltip=<html><body>\u542f\u52a8\u5668\u9ed8\u8ba4\u4f7f\u7528\u81ea\u5e26\u7684\u80cc\u666f<br />\u5982\u679c\u5f53\u524d\u76ee\u5f55\u6709background.png\uff0c\u5219\u4f1a\u4f7f\u7528\u8be5\u6587\u4ef6\u4f5c\u4e3a\u80cc\u666f<br />\u5982\u679c\u5f53\u524d\u76ee\u5f55\u6709bg\u5b50\u76ee\u5f55\uff0c\u5219\u4f1a\u968f\u673a\u4f7f\u7528\u91cc\u9762\u7684\u4e00\u5f20\u56fe\u4f5c\u4e3a\u80cc\u666f<br />\u5982\u679c\u8be5\u80cc\u666f\u5730\u5740\u88ab\u4fee\u6539\uff0c\u5219\u4f1a\u4f7f\u7528\u80cc\u666f\u5730\u5740\u91cc\u7684\u4e00\u5f20\u56fe\u4f5c\u4e3a\u80cc\u666f<br />\u80cc\u666f\u5730\u5740\u5141\u8bb8\u6709\u591a\u4e2a\u5730\u5740\uff0c\u4f7f\u7528\u534a\u89d2\u5206\u53f7";"(\u4e0d\u5305\u542b\u53cc\u5f15\u53f7)\u5206\u9694</body></html>
launcher.update_launcher=\u68c0\u67e5\u66f4\u65b0
launcher.enable_shadow=\u542f\u7528\u7a97\u53e3\u9634\u5f71
launcher.enable_animation=\u542f\u7528\u52a8\u6001\u6548\u679c
launcher.enable_blur=\u542f\u7528\u4e3b\u754c\u9762\u6a21\u7cca
launcher.theme=\u4e3b\u9898
launcher.proxy=\u4ee3\u7406
launcher.decorated=\u542f\u7528\u7a97\u53e3\u8fb9\u6846(Linux\u4e0b\u53ef\u89e3\u51b3\u7a0b\u5e8f\u754c\u9762\u5168\u7070\u95ee\u9898)
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
launcher.enable_animation=\u542f\u7528\u52a8\u6001\u6548\u679c
launcher.lang=\u8bed\u8a00
launcher.restart=\u672c\u754c\u9762\u9009\u9879\u9700\u8981\u91cd\u542f\u672c\u542f\u52a8\u5668\u751f\u6548

View File

@@ -310,11 +310,12 @@ launcher.choose_bgpath=Choose background path.
launcher.background_tooltip=<html><body>This app uses the default background at first.<br />If there is background.png in the directory, it will be used.<br />If there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.<br />If you set the background setting, this app will use it.</body></html>
launcher.update_launcher=Check for update
launcher.enable_shadow=Enable Window Shadow
launcher.enable_animation=Enable Animation
launcher.enable_blur=Enable Blur
launcher.theme=Theme
launcher.proxy=Proxy
launcher.decorated=Enable system window border(in order to fix the problem that the ui become all gray in Linux OS)
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">Documentations for modpacks.</a></html>
launcher.enable_animation=Enable Animation
launcher.lang=Language
launcher.restart=Options will be in operations only if restart this app.

View File

@@ -310,11 +310,12 @@ launcher.choose_bgpath=Choose background path.
launcher.background_tooltip=<html><body>This app uses the default background at first.<br />If there is background.png in the directory, it will be used.<br />If there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.<br />If you set the background setting, this app will use it.</body></html>
launcher.update_launcher=Check for update
launcher.enable_shadow=Enable Window Shadow
launcher.enable_animation=Enable Animation
launcher.enable_blur=Enable Blur
launcher.theme=Theme
launcher.proxy=Proxy
launcher.decorated=Enable system window border(in order to fix the problem that the ui become all gray in Linux OS)
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">Documentations for modpacks.</a></html>
launcher.enable_animation=Enable Animation
launcher.lang=Language
launcher.restart=Options will be in operations only if restart this app.

View File

@@ -309,12 +309,13 @@ launcher.versions_json_not_formatted=版本%s信息資料格式错误是否
launcher.choose_bgpath=選擇背景路徑
launcher.background_tooltip=<html><body>啟動器默認使用自帶的背景<br />如果當前目錄有background.png則會使用該資料作為背景<br />如果當前目錄有bg子目錄則會隨機使用裡面的一張圖作為背景<br />如果該背景地址被修改,則會使用背景地址裡的一張圖作為背景<br />背景地址允許有多個地址,使用半角分號";"(不包含雙引號)分隔</body></html>
launcher.update_launcher=检查更新
launcher.enable_shadow=用窗口
launcher.enable_shadow=用窗口
launcher.enable_animation=啟用動態效果
launcher.enable_blur=啟用主界面模糊
launcher.theme=主题
launcher.proxy=代理
launcher.decorated=啟用窗口邊框(Linux下可解決程序界面全灰問題)
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">整合包作者帮助</a></html>
launcher.enable_animation=啟用動態效果
launcher.lang=語言
launcher.restart=本界面選項需要重啟本啟動器生效

View File

@@ -309,12 +309,13 @@ launcher.versions_json_not_formatted=\u7248\u672c%s\u4fe1\u606f\u8cc7\u6599\u683
launcher.choose_bgpath=\u9078\u64c7\u80cc\u666f\u8def\u5f91
launcher.background_tooltip=<html><body>\u555f\u52d5\u5668\u9ed8\u8a8d\u4f7f\u7528\u81ea\u5e36\u7684\u80cc\u666f<br />\u5982\u679c\u7576\u524d\u76ee\u9304\u6709background.png\uff0c\u5247\u6703\u4f7f\u7528\u8a72\u8cc7\u6599\u4f5c\u70ba\u80cc\u666f<br />\u5982\u679c\u7576\u524d\u76ee\u9304\u6709bg\u5b50\u76ee\u9304\uff0c\u5247\u6703\u96a8\u6a5f\u4f7f\u7528\u88e1\u9762\u7684\u4e00\u5f35\u5716\u4f5c\u70ba\u80cc\u666f<br />\u5982\u679c\u8a72\u80cc\u666f\u5730\u5740\u88ab\u4fee\u6539\uff0c\u5247\u6703\u4f7f\u7528\u80cc\u666f\u5730\u5740\u88e1\u7684\u4e00\u5f35\u5716\u4f5c\u70ba\u80cc\u666f<br />\u80cc\u666f\u5730\u5740\u5141\u8a31\u6709\u591a\u500b\u5730\u5740\uff0c\u4f7f\u7528\u534a\u89d2\u5206\u865f";"(\u4e0d\u5305\u542b\u96d9\u5f15\u865f)\u5206\u9694</body></html>
launcher.update_launcher=\u68c0\u67e5\u66f4\u65b0
launcher.enable_shadow=\u542f\u7528\u7a97\u53e3\u9634\u5f71
launcher.enable_shadow=\u555f\u7528\u7a97\u53e3\u9670\u5f71
launcher.enable_animation=\u555f\u7528\u52d5\u614b\u6548\u679c
launcher.enable_blur=\u555f\u7528\u4e3b\u754c\u9762\u6a21\u7cca
launcher.theme=\u4e3b\u9898
launcher.proxy=\u4ee3\u7406
launcher.decorated=\u555f\u7528\u7a97\u53e3\u908a\u6846(Linux\u4e0b\u53ef\u89e3\u6c7a\u7a0b\u5e8f\u754c\u9762\u5168\u7070\u554f\u984c)
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
launcher.enable_animation=\u555f\u7528\u52d5\u614b\u6548\u679c
launcher.lang=\u8a9e\u8a00
launcher.restart=\u672c\u754c\u9762\u9078\u9805\u9700\u8981\u91cd\u555f\u672c\u555f\u52d5\u5668\u751f\u6548