B4X FEED [B4X]Turning Miscellaneous Image Shapes into Buttons

اطلاعات موضوع

درباره موضوع در تاریخ, در دسته b4xfeed ایجاد شده و آغاز کننده آن practicalsoftمی باشد و موضوع آن: [B4X]Turning Miscellaneous Image Shapes into Buttons است. این موضوع تا کنون 30 بازدید کننده و, 0 پاسخ داشته و 0 بار پسندیده شده...
نام دسته b4xfeed
نام موضوع [B4X]Turning Miscellaneous Image Shapes into Buttons
آغاز کننده موضوع practicalsoft
تاریخ شروع
پاسخ‌ها
0
بازدیدها
30
پسندها
0
آخرین ارسال توسط PracticalSoft
Jun 6, 2020
11,559
4,422
This is just a bit of fun, inspired by a recent question about the shape of buttons.
Given an image, how hard is it to make a specific area in the picture sensitive to clicks.

It turns out "easy", if the areas have fairly uniform color(s).
The project (about 100 lines of code) uses these techniques:

During the definition phase...
1. Create 2 layers (panels) one for the image and one for the mouse click sensor
2. In response to a click, sample a small rectangle of color using BitmapCreator
3. Use a radial search to detect boundaries (search centered on event point, around the clock in 10 degree steps)
4. Using a path object, connect boundaries and color the inside transparent (see next step)
5. Put the area ID# in the shape's transparency color (1, 2, 3, 4, etc.)

During the testing phase...
1. grab the transparency color of a clicked point to get the shape ID#
2. show a message about the selected shape

I have attached the project as .zip, but you could also just copy the...



 

عقب
بالا