Skip to content

Commit 6288efe

Browse files
committed
Introduce circle palette as alternative to default one.
1 parent 570a4a7 commit 6288efe

File tree

8 files changed

+453
-46
lines changed

8 files changed

+453
-46
lines changed

src/chibipaint/controller/CPCommonController.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ public enum selectionAction
151151
private int curMode = M_DRAW;
152152
protected selectionAction curSelectionAction = selectionAction.SELECT;
153153

154-
private final ArrayList<ICPColorListener> colorListeners = new ArrayList<ICPColorListener> ();
154+
private final ArrayList<ICPColorChangeListener> colorListeners = new ArrayList<ICPColorChangeListener> ();
155155
private final ArrayList<ICPToolListener> toolListeners = new ArrayList<ICPToolListener> ();
156156
private final ArrayList<ICPModeListener> modeListeners = new ArrayList<ICPModeListener> ();
157157
private final ArrayList<ICPViewListener> viewListeners = new ArrayList<ICPViewListener> ();
158158
private final ArrayList<ICPEventListener> cpEventListeners = new ArrayList<ICPEventListener> ();
159-
private final HashMap<String, Image> imageCache = new HashMap<String, Image> ();
159+
private final HashMap<String, BufferedImage> imageCache = new HashMap<String, BufferedImage> ();
160160

161161
//
162162
// Definition of all the standard tools available
@@ -553,10 +553,9 @@ private void clearHistory ()
553553
}
554554
}
555555

556-
public interface ICPColorListener
556+
public interface ICPColorChangeListener
557557
{
558-
559-
public void newColor (CPColor color);
558+
public void colorChanged(CPColor color);
560559
}
561560

562561
public interface ICPToolListener
@@ -705,7 +704,7 @@ public void setCurColor (CPColor color)
705704
curColor.copyFrom (color);
706705
for (Object l : colorListeners)
707706
{
708-
((ICPColorListener) l).newColor (color);
707+
((ICPColorChangeListener) l).colorChanged(color);
709708
}
710709
}
711710
}
@@ -773,7 +772,7 @@ protected void initTransform ()
773772

774773
}
775774

776-
public void addColorListener (ICPColorListener listener)
775+
public void addColorChangeListener(ICPColorChangeListener listener)
777776
{
778777
colorListeners.add (listener);
779778
}
@@ -859,9 +858,9 @@ byte[] getPngData (Image img)
859858
return pngData;
860859
}
861860

862-
public Image loadImage (String imageName)
861+
public BufferedImage loadImage (String imageName)
863862
{
864-
Image img = imageCache.get (imageName);
863+
BufferedImage img = imageCache.get (imageName);
865864
if (img == null)
866865
{
867866
try
@@ -870,7 +869,7 @@ public Image loadImage (String imageName)
870869
Class[] classes = {Image.class};
871870

872871
URL url = loader.getResource ("resource/" + imageName);
873-
img = (Image) url.openConnection ().getContent (classes);
872+
img = ImageIO.read (url);
874873
}
875874
catch (Throwable t)
876875
{

0 commit comments

Comments
 (0)