commit 7e8750c953555b44656f77e7840ab452f4406b7e
Author: leszek <leszek@koltunski.pl>
Date:   Fri Mar 8 00:07:10 2024 +0100

    progress with configurable stickers

diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index 198b46c1..b645b9f3 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -901,9 +901,9 @@ public class ObjectControl
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public void repaintPuzzleFace(int cubit, int face, int color)
+    public void repaintPuzzleFace(int cubit, int face, int color, float borders, float corners)
       {
-      mPreRender.repaintPuzzleFace(cubit,face,color);
+      mPreRender.repaintPuzzleFace(cubit,face,color,borders,corners);
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 1984b746..7ff8a559 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -60,6 +60,7 @@ public class ObjectPreRender implements EffectListener
   private float mFinishAngle, mAvgSpeed;
   private long mScrambleStartTime, mScrambleEndTime;
   private int mIconMode;
+  private float mTextureBorders, mTextureCorners;
 
   // debugging only
   private long mAddRotationTime;
@@ -389,7 +390,7 @@ public class ObjectPreRender implements EffectListener
   private void repaintPuzzleFaceNow()
     {
     mRepaintPuzzleFace = false;
-    if( mNewObject!=null ) mNewObject.repaintPuzzleFace(mCubit,mFace,mNewColor);
+    if( mNewObject!=null ) mNewObject.repaintPuzzleFace(mCubit,mFace,mNewColor,mTextureBorders,mTextureCorners);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -472,13 +473,15 @@ public class ObjectPreRender implements EffectListener
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void repaintPuzzleFace(int cubit, int face, int newColor)
+  public void repaintPuzzleFace(int cubit, int face, int newColor, float borders, float corners)
     {
     mRepaintPuzzleFace = true;
 
     mCubit    = cubit;
     mFace     = face;
     mNewColor = newColor;
+    mTextureBorders = borders;
+    mTextureCorners = corners;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index 6a570971..b3c5d47b 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -1239,9 +1239,16 @@ public abstract class TwistyObject
 // figure out the whole face to which (cubit,face) belongs, repaint all (cubit,face) pairs to
 // the new color.
 
-  void repaintPuzzleFace(int cubit, int face, int color)
+  void repaintPuzzleFace(int cubit, int face, int color, float borders, float corners)
     {
-    android.util.Log.e("D", "repainting: "+cubit+" "+face+" "+color);
+    int oldColorIndex = getCubitFaceColor(cubit,face);
+    int oldColor = getColor(oldColorIndex);
+
+    if( oldColor!=color )
+      {
+      changeColorInTexture(borders,corners,oldColor,color);
+      setTexture();
+      }
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1656,6 +1663,34 @@ public abstract class TwistyObject
         }
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void changeColorInTexture(float borders, float corners, int oldColor, int newColor)
+    {
+    Paint paint = new Paint();
+    Canvas canvas = new Canvas(mBitmap);
+    paint.setAntiAlias(true);
+    int texture = 0;
+    FactorySticker factory = FactorySticker.getInstance();
+
+    for(int row=0; row<mNumTexRows; row++)
+      for(int col=0; col<mNumTexCols; col++)
+        {
+        if( texture<mNumTextures-mNumOverrides )
+          {
+          int color = getColor(texture%mNumFaceColors);
+
+          if( color==oldColor )
+            {
+            ObjectSticker sticker = retSticker(texture/mNumFaceColors);
+            factory.drawRoundedPolygons(canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight, newColor, mTexHeight, sticker,borders,corners);
+            }
+          }
+
+        texture++;
+        }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   void setTexture()
