Page 1 of 2
Need clean image
Posted: Tue May 17, 2022 8:24 pm
by dunbarx
I need an image that looks like this, but can not be anything beyond the extent of the shape shown. Right now I I always get some blank space outside the actual shape.

- Screen Shot 2022-05-17 at 2.54.49 PM.png (5.78 KiB) Viewed 4825 times
And I will need to expand and shorten the width of this image under script control, but keep the line width of the small "ends" the same. Currently they thin out as I reduce the width of the whole.
I know LC is not intended to be a drawing or CAD program. How do I make an image but only "grab" the actual lines?
Craig
Re: Need clean image
Posted: Tue May 17, 2022 8:41 pm
by Klaus
Hi Craig,
not sure I fullly understand your problem, but check the image property CenterRect in the dictionary.
This lets you define a region of the image which should be streched when resizing the image instead of streching the complete image.
Sounds like this could be a solution.
Best
Klaus
Re: Need clean image
Posted: Tue May 17, 2022 9:22 pm
by SparkOut
I am not sure what your requirements are either, but wouldn't it be much simpler and cleaner to make a line graphic to draw the shape with a simple set of points? You can very easily script the length of the main width, and adjust the points of the vertical "ends" appropriately.
Otherwise, what Klausimausi said.
Re: Need clean image
Posted: Tue May 17, 2022 9:40 pm
by dunbarx
@Sparkout
The problem with a polygon graphic is that if I set its opaque then LC closes the shape into a rectangle. I cannot use a rectangle. The user changes the width of the graphic dynamically by keeping the pointer within the rect of the graphic and sending "mouseStillDown" messages. With the opaque cleared, LC does not know what the target is.
@ Klaus. Will check out that property. Watch this space...
Craig
Re: Need clean image
Posted: Tue May 17, 2022 10:04 pm
by FourthWorld
dunbarx wrote: ↑Tue May 17, 2022 9:40 pm
@Sparkout
The problem with a polygon graphic is that if I set its opaque then LC closes the shape into a rectangle.
Mark Waddingham provided a nifty trick for creating polygons that avoid the closed shape:
https://forums.livecode.com/viewtopic.p ... 06#p215281
Re: Need clean image
Posted: Tue May 17, 2022 10:11 pm
by dunbarx
Richard.
Thank you.
I am an idiot. And you can see my happy congratulations to Mark for that very solution in the next post.
Problem solved.
Idiot.
Craig
Re: Need clean image
Posted: Tue May 17, 2022 10:13 pm
by SparkOut
Aha.
Notwithstanding the trick from Mark W, I would personally have done something like using an opaque rectangle graphic with no border, and as that is resized, then adjust the points of the (3 segment) line graphic to match the corners. There's not even any calculation involved then, just steal the coordinates from the other object.
Re: Need clean image
Posted: Tue May 17, 2022 10:25 pm
by dunbarx
All
Interestingly, if you run Mark's gadget, but then flip the graphic, the shape closes.
No problem for me, I will just make the several orientation options I need from scratch. But I cannot make them all from a single "template".
Craig
Re: Need clean image
Posted: Tue May 17, 2022 10:30 pm
by dunbarx
Sparkout.
I tried to adjust the points of such a polygon early on. When I set the opaque, LC happily adds the new line in the points property. But deleting that last line does not change anything in the graphic itself. And of course, deleting the last two lines will make a closed triangle, essentially "maintaining" that last closed line.
Craig
Re: Need clean image
Posted: Tue May 17, 2022 10:47 pm
by dunbarx
Mark is still a lifesaver.
But know that if one changes the points of such a manhandled polygon the shape closes. It does not if the shape is adjusted in edit mode with the mouse, only if properties are changed in the inspector or under script control.
Note that one can change the width or height of such a graphic using any method, just not the points.
Craig
Re: Need clean image
Posted: Tue May 17, 2022 10:48 pm
by SparkOut
I meant having two objects, one a resizable graphic rectangle with no border to handle the scaling, and another line graphic of 3 segments that you update the points on the fly to match (3 sides of) the separate rectangle as it resizes.
Re: Need clean image
Posted: Wed May 18, 2022 12:17 am
by FourthWorld
If MW's solution doesn't do what you need, I'd just put a poly and a rect in a group and keep moving forward.
Re: Need clean image
Posted: Wed May 18, 2022 1:33 am
by dunbarx
Richard.
Did that too. I may yet again if what I think are fragile polygons fall apart after being manhandled, stretched and shrunk.
Craig
Re: Need clean image
Posted: Wed May 18, 2022 1:49 am
by FourthWorld
"fall apart"?
Re: Need clean image
Posted: Wed May 18, 2022 9:17 am
by richmond62
Oh, Look! It's Richmond's shovel:
-

- shovel.jpg (3.39 KiB) Viewed 4676 times
-
-
Code: Select all
on mouseDown
grab me
end mouseDown
on mouseStillDown
set the top of me to 10
put the right of img "RV" into RITE
put the left of me into LLL
put (RITE - LLL) into LENF
set the width of img "HOR" to LENF
set the left of img "HOR" to LLL
set the right of img "HOR" to RITE
end mouseStillDown
on mouseUp
set the top of me to 10
put the right of img "RV" into RITE
put the left of me into LLL
put (RITE - LLL) into LENF
set the width of img "HOR" to LENF
set the left of img "HOR" to LLL
set the right of img "HOR" to RITE
end mouseUp