Concept
Imagine each image as a collection of small boxes arranged in different positions. Each image has four sides, and our goal is to determine how these images can connect to one another based on the configuration of these sides.
Let’s take the example of an image:
- Image Tagged with 1 from above collection is made up of small boxes and has two open sides and two closed sides.
- We represent open sides as 1 and closed sides as 0.
- The sides are labeled as follows:
- Left (L): 0
- Right (R): 1
- Top (T): 0
- Bottom (B): 1
To connect this image to another on the right side, the adjacent image must have an open left side.
Therefore, images that can potentially connect are those with an opening on their left side. Examples of such images are 2, 3, 4, 6, 7, 10, 11, and 14. We can choose any of these images randomly to connect to the first image.
This approach can be applied to all other images to determine possible connections, allowing us to piece together the images like a puzzle based on the arrangement of open and closed sides.
Applying Above Concept
Requiements
- VS Code
- Skia Sharp
- C# as Programming language
- Image used in for this project Download Images
Code behind
Import Skia Library
|
|
Model class for each Cell
Creating Model For holding each Image case data like side open or Close and location image
|
|
Base Directory where all image file will be located
Location of parent folder where image is located
|
|
Creation Model Relation for each image
Creating model for each image with opening data where it is open and close and location of file
|
|
Fisher Yeats Suffling to Randomise Data
|
|
Draw Image on SKCanvas Function
|
|
Find Matching neighobours and return on randomise element
|
|
Setpuing SkCanvas and Calling All Other methods
|
|
Thumbail of This Page Is Generated using same code above + 2 Line of Code to Write Text Obviously 😁😁😁😊