Need clean image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Need clean image
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.
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
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
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
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
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.
Otherwise, what Klausimausi said.
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
@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
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
-
- VIP Livecode Opensource Backer
- Posts: 9837
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Need clean image
Mark Waddingham provided a nifty trick for creating polygons that avoid the closed shape:
https://forums.livecode.com/viewtopic.p ... 06#p215281
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
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
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
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
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
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
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
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
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
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
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
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
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.
-
- VIP Livecode Opensource Backer
- Posts: 9837
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Need clean image
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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Need clean image
Richard.
Did that too. I may yet again if what I think are fragile polygons fall apart after being manhandled, stretched and shrunk.
Craig
Did that too. I may yet again if what I think are fragile polygons fall apart after being manhandled, stretched and shrunk.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9837
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Need clean image
"fall apart"?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 9386
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Need clean image
Oh, Look! It's Richmond's shovel:
- - -
- - -
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
- Attachments
-
- WIDE.livecode.zip
- Stack.
- (1.27 KiB) Downloaded 72 times