Page 1 of 2
Putting image into a circle shape
Posted: Sat Nov 24, 2018 9:21 am
by EddieLee
Hi all, the livecode built in image only allows square images . The property does not have any ways to change the shape. Do I have to use a graphic in this case?
Thank you for your kind replies.
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 9:38 am
by SparkOut
What are you trying to do with the image? There are different ways of dealing with this depending on what your interactions with the image are (eg collision detection, mouseover actions etc).
Most can probably be dealt with by transparency settings, but can be enhanced with one of Hermann's nifty stacks with frame masking, or possibly as a background pattern in a graphic if it really needs to be, as in the hex tile creation thread.
http://forums.livecode.com/viewtopic.php?f=22&t=31212
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 9:56 am
by richmond62
Personally I'd make a circular graphic, store your image off-screen
and then set the backGroundPattern of the graphic to your picture.
-
-
Code: Select all
on mouseUp
set the backGroundPattern of grc "oo" to the ID of image "tt"
end mouseUp
-
If you want to save storage space you can subsequently take a snapshot
of the circular graphic and delete both it and the original image.
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 10:02 am
by SparkOut
Is that supposed to have a cross-hair reticule?
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 10:20 am
by EddieLee
Hi Richmond,
Thanks, what I was trying to do is exactly what you have posted. I will try to use the backgroundpattern to do it. However in your post, is there a way to centralise the image so that I can fully see Donald Trump's face?
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 11:23 am
by jmburnod
Hi,
is there a way to centralise the image
You may try to set the rect of your img to the rect of your grc.
If the human face is on the middle of your image that should work.
Best
Jean-Marc
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 11:37 am
by Klaus
Hi Eddie,
yep, the backgroudpattern is the easy-peasy-new-york-teenie version, but has its limits like the part you will see in the pattern is alway starting at the the topleft.
To have more control of the excerpt you want to display use INKS and a group.
INKS are still a complete mistery to me

but some testing revealed this solution to me:
1. Create a graphic object (oval, rect, roundrect, polygon) for your mask
2. Set it to OPAQUE and backgroundcolor to WHITE
3. Set its INK to -> BlendDestIn
4. Now group this grahic and your image and set the INK of the GROUP to -> blendSrc
5. Example of same rect for graphic and group:
6.Now you can postion your graphic inside of the group to display the part of the image you always wanted to but you need to set the rect of the group to the (new) rect of the mask graphic
Have fun!
Best
Klaus
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 3:57 pm
by richmond62
is there a way to centralise the image so that I can fully see Donald Trump's face?
If you must, you must:
-
-
HOWEVER, as you can see, that is far from satisfactory as his
cheesy muzzle
is in the centre of a non-square image, and back patterns tile.
Of course you can "fiddle around" with the Donald Trump picture outwith LiveCode
with an image editor such as GIMP so that you end up with his
cheesy muzzle
in the centre of a square picture.
This does seem to be etched in stone:
The backgroundPattern of controls is drawn starting at the control's upper left corner: if the control is moved, the pattern does not shift.
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 3:59 pm
by Klaus
Eddie, no idea why you really want to fully see Donald Trump's face!?

Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:03 pm
by richmond62
no idea why you really want to fully see Donald Trump's face!?
Oh, come on, Klaus, we all have our "little kinks"
(and I won't tell about yours if you don't tell about mine).

Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:06 pm
by richmond62
setht eINK of the GROUP
Why do I feel that needs a bit of clarification?
Or is November 24 Metathesis Day?
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:07 pm
by Klaus
I have nothing to hide, just go ahead!

Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:10 pm
by Klaus
richmond62 wrote: ↑Sat Nov 24, 2018 4:06 pm
setht eINK of the GROUP
Why do I feel that needs a bit of clarification?
Because you do not have the slightest touch of imagination?
I corrected this little faux-pas in the meantime.
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:15 pm
by richmond62
Because you do not have the slightest touch of imagination?
Wow! That's the first time I have been accused of that.
-

- trump2.jpg (116.32 KiB) Viewed 7941 times
-
-
All stand for "Hail to the Cheese."
Re: Putting image into a circle shape
Posted: Sat Nov 24, 2018 4:18 pm
by Klaus
Did you notice the questionmark at the end of my first sentence?
