Page 3 of 4
Re: Hexagons and stuff
Posted: Thu Jul 26, 2018 8:03 am
by richmond62
That's clever stuff!
Although:
1. I'm not sure if that provides the whole image in hex tiles.
2. It needs quite a bit of modification to chop up any image an end-user imports into the stack.
Re: Hexagons and stuff
Posted: Thu Jul 26, 2018 8:26 am
by richmond62
-
-
Code: Select all
import snapshot from grc "hex"
set the name of the last control to ("r"&tRow&"c"&(tCol))
set the left of img ("r"&tRow&"c"&(tCol)) to (10 + KOUNT)
-
Re: Hexagons and stuff
Posted: Thu Jul 26, 2018 2:02 pm
by bwmilby
richmond62 wrote: ↑Thu Jul 26, 2018 8:03 am
That's clever stuff!
Although:
1. I'm not sure if that provides the whole image in hex tiles.
2. It needs quite a bit of modification to chop up any image an end-user imports into the stack.
Correct, I was just demonstrating the process. A more robust solution would allow configuration of the hex size and then automatically split any image. I will check out your mods this evening.
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 4:09 am
by bwmilby
I've updated the button to use the red rectangle as the bounds for the slicing. There is also a variable to set the desired side length of the tile and everything adjusts accordingly.
Download the stack here:
https://milby.us/lc/HexSplit2.livecode
(I couldn't post here - kept getting a message that it was too large)
Code: Select all
on mouseUp pMouseButton
local tColOffset, tCols, tHeight, tLeft, tMargin, tMaxX, tMaxY
local tName, tRowOffset, tRows, tSide, tTop, tTopOffset, tWidth
put 20 into tSide
put 2 * tSide into tWidth
put sqrt(3) * tSide into tHeight
put tWidth - tHeight into tMargin
put tWidth + tSide + tMargin into tColOffset
put tHeight + tMargin/2 into tRowOffset
set the width of grc "hex" to tWidth
set the height of grc "hex" to tWidth
put the width of grc "border" / (tSide*3/2) into tCols
put the height of grc "border" / tHeight into tRows
put the right of grc "border" into tMaxX
put the bottom of grc "border" into tMaxY
put round(tMaxY + tHeight) into tTopOffset
set the visible of grc "border" to false
repeat with tCol = 1 to tCols step 2
lock screen
repeat with tRow = 1 to tRows
put "r" & tRow & "c" & (tCol) into tName
put (tCol-1)/2 * (tSide*3) into tLeft
put (tRow-1) * tHeight into tTop
export snapshot from rect tLeft,tTop,tLeft+tWidth,tTop+tWidth \
of this card to img "box"
set the backPattern of grc "hex" to the ID of img "box"
import snapshot from grc "hex"
set the name of the last control to tName
set the left of img tName to (tCol-1)/2 * tColOffset
set the top of img tName to tTopOffset + (tRow-1) * tRowOffset
put "r" & tRow & "c" & (tCol+1) into tName
put tLeft + tSide*3/2 into tLeft
if tLeft > tMaxX then next repeat
put tTop + tHeight/2 into tTop
if tTop > tMaxY then next repeat
export snapshot from rect tLeft,tTop,tLeft+tWidth,tTop+tWidth \
of this card to img "box"
set the backPattern of grc "hex" to the ID of img "box"
import snapshot from grc "hex"
set the name of the last control to tName
set the left of img tName to (tCol-1)/2 * tColOffset + tColOffset/2
set the top of img tName to tTopOffset + (tRow-1) * tRowOffset + tHeight/2
end repeat
unlock screen
end repeat
set the visible of grc "border" to true
end mouseUp
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 8:40 am
by richmond62
Clever as far as it goes (meaning that this weekend I'll try to "get down and dirty"
with the code and see if I can effect things in a slightly different way), but,
even before downloading your stack:
-
- hexsplit2Crit.jpg (64.81 KiB) Viewed 12957 times
-
My green crosses point out where there are problems.
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 2:33 pm
by bwmilby
Stack updated. Still need to work with it a bit more to be sure it captures the entire image.
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 7:54 pm
by jiml
Might want to remove any images left over from earlier uses of the DO IT button
Code: Select all
-- remove earlier tiles if any
repeat with x = the number of images down to 1
put the short name of img x into adad
if matchtext(the short name of img x, "r[0-9]+c[0-9]+") then delete img x
end repeat
Place that code before
Code: Select all
repeat with tCol = 1 to tCols step 2
Jim Lambert
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 7:55 pm
by jiml
Ooops
delete line
Code: Select all
put the short name of img x into adad
Unnecessary.
JimL
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 7:59 pm
by bwmilby
Thanks. I’ll add that and repost. I’ve been doing it by hand each time
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 9:19 pm
by bogs
bwmilby wrote: ↑Fri Jul 27, 2018 7:59 pm
I’ve been doing it by hand each time
OMG, it is just as I feared, my methods are infecting Brian! Wait till the spots stop spinning Brian! Hold out for help!!
Re: Hexagons and stuff
Posted: Fri Jul 27, 2018 11:38 pm
by bwmilby
I've posted an update that does the auto-cleanup.
https://milby.us/lc/HexSplit3.livecode
UPDATED: Code now has more comments. Adjusted code to only capture one column at a time. I left the previous version up and added a new version.
I've also move the tile size to a field.
bogs wrote: ↑Fri Jul 27, 2018 9:19 pm
OMG, it is just as I feared, my methods are infecting Brian! Wait till the spots stop spinning Brian! Hold out for help!!
Yeah... I was actually thinking that I should code the tile cleanup, but wanted to do the other logic stuff first.
Re: Hexagons and stuff
Posted: Sun Jul 29, 2018 9:37 pm
by richmond62
I don't think I'd bother with a cleanup code as I'd export the hexagons
to an external file as PNG images so they could be used anywhere.
Re: Hexagons and stuff
Posted: Mon Jul 30, 2018 2:59 pm
by richmond62
Re: Hexagons and stuff
Posted: Fri Aug 03, 2018 9:00 pm
by richmond62
-
"That's not Rockabilly, that's Swing!"
Hope to get some "Rockabilly" together this weekend.
Part of my further posting might be stated like this:
"Why have DAZ been so STUPID as to do nothing about making Bryce 7 available for any MacOS past 10.6 ?"
Re: Hexagons and stuff
Posted: Sat Aug 04, 2018 1:26 pm
by richmond62
-
Ooh: Gosh; a new, boring interface.
-
Possibly; but getting more like something that imports
an image and chops it up into hexagonal png images and exports them.
-
-
the inevitable sticky patch . . .
-
-
but getting
Somewhere.