mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-02 22:55:26 +02:00
Bug 487471 - 16 pixel button icons in 32x24 pixels space.
Brings back the switching since we're using the launch group icons in the Launch button. The Build and Stop buttons are also made 16-bit and should be familiar. Warning clean-up in CSelector. Change-Id: I05e4b912d0470eb3f533d462b402faa3002bddd2
This commit is contained in:
parent
91369b4692
commit
68da3d3a38
9 changed files with 92 additions and 123 deletions
|
@ -2,8 +2,11 @@ eclipse.preferences.version=1
|
|||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
|
@ -48,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
|||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=error
|
||||
|
|
BIN
bundles/org.eclipse.launchbar.ui/icons/bgButton.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/bgButton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/build_16.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/build_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
bundles/org.eclipse.launchbar.ui/icons/launch_16.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/launch_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 620 B |
BIN
bundles/org.eclipse.launchbar.ui/icons/stop_16.png
Normal file
BIN
bundles/org.eclipse.launchbar.ui/icons/stop_16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
|
@ -19,7 +19,6 @@ import org.eclipse.core.commands.ParameterizedCommand;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
|
@ -44,17 +43,11 @@ public class Activator extends AbstractUIPlugin {
|
|||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.eclipse.launchbar.ui"; //$NON-NLS-1$
|
||||
|
||||
// Options
|
||||
public static final String OPTION_ICON_SIZE32 = Activator.PLUGIN_ID + "/iconSize32"; //$NON-NLS-1$
|
||||
public static final String OPTION_LAUNCH_ICON_UPDATER = Activator.PLUGIN_ID + "/launchIconUpdater"; //$NON-NLS-1$
|
||||
|
||||
// Images
|
||||
public static final String IMG_BUTTON_BACKGROUND = "bgButton"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_BUILD = "build"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_BUILD_HOT = "build.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_LAUNCH = "launch"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_LAUNCH_HOT = "launch.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_STOP = "stop"; //$NON-NLS-1$
|
||||
public static final String IMG_BUTTON_STOP_HOT = "stop.hot"; //$NON-NLS-1$
|
||||
public static final String IMG_LOCAL_TARGET = "localTarget"; //$NON-NLS-1$
|
||||
|
||||
// Command ids
|
||||
|
@ -86,21 +79,10 @@ public class Activator extends AbstractUIPlugin {
|
|||
plugin = this;
|
||||
|
||||
ImageRegistry imageRegistry = getImageRegistry();
|
||||
if ("true".equals(Platform.getDebugOption(OPTION_ICON_SIZE32))) { //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop.png")); //$NON-NLS-1$
|
||||
} else {
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build2_hot_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch2_hot_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop2_24.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP_HOT, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop2_hot_24.png")); //$NON-NLS-1$
|
||||
}
|
||||
imageRegistry.put(IMG_BUTTON_BACKGROUND, imageDescriptorFromPlugin(PLUGIN_ID, "icons/bgButton.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_BUILD, imageDescriptorFromPlugin(PLUGIN_ID, "icons/build_16.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_LAUNCH, imageDescriptorFromPlugin(PLUGIN_ID, "icons/launch_16.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_BUTTON_STOP, imageDescriptorFromPlugin(PLUGIN_ID, "icons/stop_16.png")); //$NON-NLS-1$
|
||||
imageRegistry.put(IMG_LOCAL_TARGET, imageDescriptorFromPlugin(PLUGIN_ID, "icons/localTarget.png")); //$NON-NLS-1$
|
||||
|
||||
context.registerService(ILaunchTargetUIManager.class, new LaunchTargetUIManager(), null);
|
||||
|
|
|
@ -86,6 +86,7 @@ public abstract class CSelector extends Composite {
|
|||
}
|
||||
return control == this;
|
||||
}
|
||||
|
||||
private Listener focusOutListener = new Listener() {
|
||||
private Job closingJob;
|
||||
|
||||
|
@ -105,9 +106,8 @@ public abstract class CSelector extends Composite {
|
|||
case SWT.FocusOut:
|
||||
if (isPopUpInFocus()) {
|
||||
// we about to loose focus from popup children, but it may
|
||||
// go
|
||||
// to another child, lets schedule a job to wait before we
|
||||
// close
|
||||
// go to another child, lets schedule a job to wait before
|
||||
// we close
|
||||
if (closingJob != null)
|
||||
closingJob.cancel();
|
||||
closingJob = new Job(Messages.CSelector_0) {
|
||||
|
@ -123,7 +123,7 @@ public abstract class CSelector extends Composite {
|
|||
closingJob.schedule(300);
|
||||
}
|
||||
break;
|
||||
case SWT.MouseUp: {
|
||||
case SWT.MouseUp:
|
||||
if (popup != null && !popup.isDisposed()) {
|
||||
Point loc = getDisplay().getCursorLocation();
|
||||
if (!popup.getBounds().contains(loc) && !getBounds().contains(getParent().toControl(loc))) {
|
||||
|
@ -131,7 +131,8 @@ public abstract class CSelector extends Composite {
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -491,7 +492,8 @@ public abstract class CSelector extends Composite {
|
|||
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isDisposed()) return;
|
||||
if (isDisposed())
|
||||
return;
|
||||
update(selection); // update current selection - name or icon
|
||||
// may have changed
|
||||
if (popup != null && !popup.isDisposed()) {
|
||||
|
|
|
@ -16,6 +16,8 @@ import javax.annotation.PreDestroy;
|
|||
|
||||
import org.eclipse.debug.core.ILaunchMode;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.CompositeImageDescriptor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.launchbar.core.ILaunchBarListener;
|
||||
import org.eclipse.launchbar.core.ILaunchDescriptor;
|
||||
import org.eclipse.launchbar.core.internal.LaunchBarManager;
|
||||
|
@ -27,6 +29,8 @@ import org.eclipse.swt.events.DisposeEvent;
|
|||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
@ -65,12 +69,9 @@ public class LaunchBarControl implements ILaunchBarListener {
|
|||
});
|
||||
|
||||
ToolBar toolBar = new ToolBar(container, SWT.FLAT);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Activator.IMG_BUTTON_BUILD_HOT,
|
||||
Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Activator.IMG_BUTTON_LAUNCH_HOT,
|
||||
Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_STOP, Activator.IMG_BUTTON_STOP_HOT, Messages.LaunchBarControl_Stop,
|
||||
Activator.CMD_STOP);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_BUILD, Messages.LaunchBarControl_Build, Activator.CMD_BUILD);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_LAUNCH, Messages.LaunchBarControl_Launch, Activator.CMD_LAUNCH);
|
||||
createButton(toolBar, Activator.IMG_BUTTON_STOP, Messages.LaunchBarControl_Stop, Activator.CMD_STOP);
|
||||
|
||||
modeSelector = new ModeSelector(container, SWT.NONE);
|
||||
modeSelector.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
|
||||
|
@ -109,13 +110,32 @@ public class LaunchBarControl implements ILaunchBarListener {
|
|||
manager.removeListener(this);
|
||||
}
|
||||
|
||||
private ToolItem createButton(Composite parent, String imageName, String hotImageName, String toolTipText,
|
||||
final String command) {
|
||||
private ToolItem createButton(Composite parent, String imageName, String toolTipText, final String command) {
|
||||
ToolItem button = new ToolItem((ToolBar) parent, SWT.FLAT);
|
||||
Image srcImage = Activator.getDefault().getImage(imageName);
|
||||
button.setImage(srcImage);
|
||||
Image hotImage = Activator.getDefault().getImage(hotImageName);
|
||||
button.setHotImage(hotImage);
|
||||
|
||||
Image bgImage = Activator.getDefault().getImage(Activator.IMG_BUTTON_BACKGROUND);
|
||||
Image fgImage = Activator.getDefault().getImage(imageName);
|
||||
|
||||
ImageDescriptor imageDesc = new CompositeImageDescriptor() {
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
Rectangle bounds = bgImage.getBounds();
|
||||
return new Point(bounds.width - bounds.y, bounds.height - bounds.x);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCompositeImage(int width, int height) {
|
||||
drawImage(bgImage.getImageData(), 0, 0);
|
||||
|
||||
Rectangle bgBounds = bgImage.getBounds();
|
||||
Rectangle modeBounds = fgImage.getBounds();
|
||||
int x = ((bgBounds.width - bgBounds.x) - (modeBounds.width - modeBounds.x)) / 2;
|
||||
int y = ((bgBounds.height - bgBounds.y) - (modeBounds.height - modeBounds.y)) / 2;
|
||||
drawImage(fgImage.getImageData(), x, y);
|
||||
}
|
||||
};
|
||||
|
||||
button.setImage(imageDesc.createImage());
|
||||
button.setToolTipText(toolTipText);
|
||||
button.setData("command", command); //$NON-NLS-1$
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
|
|
|
@ -10,13 +10,11 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.launchbar.ui.internal.controls;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.debug.core.ILaunchConfigurationType;
|
||||
import org.eclipse.debug.core.ILaunchManager;
|
||||
import org.eclipse.debug.core.ILaunchMode;
|
||||
|
@ -33,10 +31,8 @@ import org.eclipse.launchbar.ui.internal.Activator;
|
|||
import org.eclipse.launchbar.ui.internal.Messages;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.ImageData;
|
||||
import org.eclipse.swt.graphics.PaletteData;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
|
@ -46,6 +42,7 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
public class ModeSelector extends CSelector {
|
||||
private static final String[] noModes = new String[] { "---" }; //$NON-NLS-1$
|
||||
private final LaunchBarManager manager = Activator.getDefault().getLaunchBarUIManager().getManager();
|
||||
private Map<String, Image> modeButtonImages = new HashMap<>();
|
||||
|
||||
public ModeSelector(Composite parent, int style) {
|
||||
super(parent, style);
|
||||
|
@ -157,6 +154,15 @@ public class ModeSelector extends CSelector {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
|
||||
for (Image image : modeButtonImages.values()) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected ILaunchGroup getDefaultLaunchGroup(String mode) {
|
||||
String groupId = null;
|
||||
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
|
||||
|
@ -206,9 +212,7 @@ public class ModeSelector extends CSelector {
|
|||
if (element == null)
|
||||
element = noModes[0];
|
||||
super.setSelection(element);
|
||||
if ("true".equals(Platform.getDebugOption(Activator.OPTION_LAUNCH_ICON_UPDATER))) { //$NON-NLS-1$
|
||||
updateLaunchButton(findLaunchButton());
|
||||
}
|
||||
updateLaunchButton(findLaunchButton());
|
||||
}
|
||||
|
||||
private ToolItem findLaunchButton() {
|
||||
|
@ -231,84 +235,42 @@ public class ModeSelector extends CSelector {
|
|||
if (toolItem == null || isDisposed()) {
|
||||
return;
|
||||
}
|
||||
toolItem.setImage(Activator.getDefault().getImage(Activator.IMG_BUTTON_LAUNCH));
|
||||
|
||||
Object selection = getSelection();
|
||||
if (selection instanceof ILaunchMode) {
|
||||
ILaunchMode lmode = (ILaunchMode) selection;
|
||||
toolItem.setToolTipText(NLS.bind(Messages.ModeSelector_ToolTip, lmode.getLabel()));
|
||||
String mode = lmode.getIdentifier();
|
||||
String iconPath = "icons/icon_" + mode + "_32x32.png"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
Image modeBigImage = Activator.getDefault().getImage(iconPath);
|
||||
if (modeBigImage == null) {
|
||||
// no icon for the mode, lets do an overlay
|
||||
Image modeImageOrig = getLabelProvider().getImage(lmode);
|
||||
if (modeImageOrig != null) {
|
||||
ImageDescriptor composite = new ReversedCenterOverlay(modeImageOrig.getImageData());
|
||||
Activator.getDefault().getImageRegistry().put(iconPath, composite);
|
||||
modeBigImage = Activator.getDefault().getImage(iconPath);
|
||||
}
|
||||
}
|
||||
if (modeBigImage != null) {
|
||||
toolItem.setImage(modeBigImage);
|
||||
ILaunchMode mode = (ILaunchMode) selection;
|
||||
toolItem.setToolTipText(NLS.bind(Messages.ModeSelector_ToolTip, mode.getLabel()));
|
||||
|
||||
Image image = modeButtonImages.get(mode.getIdentifier());
|
||||
if (image == null) {
|
||||
Image bgImage = Activator.getDefault().getImage(Activator.IMG_BUTTON_BACKGROUND);
|
||||
Image modeImage = getLabelProvider().getImage(mode);
|
||||
|
||||
ImageDescriptor imageDesc = new CompositeImageDescriptor() {
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
Rectangle bounds = bgImage.getBounds();
|
||||
return new Point(bounds.width - bounds.y, bounds.height - bounds.x);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCompositeImage(int width, int height) {
|
||||
drawImage(bgImage.getImageData(), 0, 0);
|
||||
|
||||
Rectangle bgBounds = bgImage.getBounds();
|
||||
Rectangle modeBounds = modeImage.getBounds();
|
||||
int x = ((bgBounds.width - bgBounds.x) - (modeBounds.width - modeBounds.x)) / 2;
|
||||
int y = ((bgBounds.height - bgBounds.y) - (modeBounds.height - modeBounds.y)) / 2;
|
||||
drawImage(modeImage.getImageData(), x, y);
|
||||
}
|
||||
};
|
||||
|
||||
image = imageDesc.createImage();
|
||||
modeButtonImages.put(mode.getIdentifier(), image);
|
||||
}
|
||||
|
||||
toolItem.setImage(image);
|
||||
}
|
||||
}
|
||||
|
||||
private final class ReversedCenterOverlay extends CompositeImageDescriptor {
|
||||
private ImageData small;
|
||||
|
||||
public ReversedCenterOverlay(ImageData small) {
|
||||
this.small = small;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Point getSize() {
|
||||
return new Point(32, 32);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCompositeImage(int width, int height) {
|
||||
ImageDescriptor base = Activator.getImageDescriptor("icons/launch_base_blank.png"); //$NON-NLS-1$
|
||||
ImageData baseData = base.getImageData();
|
||||
int baseColor = baseData.getPixel(16, 16);
|
||||
ImageData data = getReversed(small, baseData.palette.getRGB(baseColor));
|
||||
drawImage(baseData, 0, 0);
|
||||
drawImage(data, 8, 8);
|
||||
}
|
||||
|
||||
private ImageData getReversed(ImageData imageData, RGB baseColor) {
|
||||
int width = imageData.width;
|
||||
PaletteData palette = imageData.palette;
|
||||
RGB whiteColor = new RGB(255, 255, 255);
|
||||
if (!palette.isDirect) {
|
||||
palette.colors = Arrays.copyOf(palette.colors, palette.colors.length + 2);
|
||||
palette.colors[palette.colors.length - 1] = baseColor;
|
||||
palette.colors[palette.colors.length - 2] = whiteColor;
|
||||
}
|
||||
int whitePixel = palette.getPixel(whiteColor);
|
||||
int basePixed = palette.getPixel(baseColor);
|
||||
int transPixed = imageData.transparentPixel;
|
||||
int[] lineData = new int[imageData.width];
|
||||
for (int y = 0; y < imageData.height; y++) {
|
||||
imageData.getPixels(0, y, width, lineData, 0);
|
||||
for (int x = 0; x < lineData.length; x++) {
|
||||
int pixelValue = lineData[x];
|
||||
if (pixelValue == transPixed) {
|
||||
imageData.setPixel(x, y, basePixed);
|
||||
continue;
|
||||
}
|
||||
RGB rgb = palette.getRGB(pixelValue);
|
||||
float brightness = rgb.getHSB()[2];
|
||||
if (brightness > 0.97) {
|
||||
imageData.setPixel(x, y, basePixed);
|
||||
} else {
|
||||
imageData.setPixel(x, y, whitePixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
imageData.transparentPixel = -1;
|
||||
return imageData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue