Skip to content

Commit

Permalink
fixes #14, default color in new transparent image should be black
Browse files Browse the repository at this point in the history
  • Loading branch information
jabiercoding committed Sep 28, 2016
1 parent b77ada0 commit 8998e8a
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,26 @@ private void createToolItems(ToolBar toolBar) {
currentColorToolItem.setToolTipText("Current color");

// initialize color selection
// get first non transparent one
// get first completely non-transparent color
for (PixelItem item : pixels) {

This comment has been minimized.

Copy link
@trkndi17

trkndi17 Oct 2, 2020

#23

if (item.alpha == 255) {

This comment has been minimized.

Copy link
@trkndi17

trkndi17 Oct 2, 2020

👍

colorPickerSelection = (PixelItem) item.clone();
break;

This comment has been minimized.

Copy link
@trkndi17
}
}
// if not found, get the first color
// get first non-transparent color
for (PixelItem item : pixels) {
if (item.alpha != 0) {
colorPickerSelection = (PixelItem) item.clone();
break;
}
}
// if not found, get black
if (colorPickerSelection == null) {
colorPickerSelection = (PixelItem) pixels.get(0).clone();
PixelItem pixelItem = (PixelItem) pixels.get(0).clone();
pixelItem.alpha = 255;
pixelItem.color = new RGB(0,0,0);
colorPickerSelection = pixelItem;
}
currentColorToolItem.setImage(EditorUtils.createImageForColorSelection(colorPickerSelection.color,
colorPickerSelection.alpha));
Expand Down

0 comments on commit 8998e8a

Please sign in to comment.