Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
from png tile, create symmetrical screen image
#4
Basically just this simple process:

Code: (Select All)
Randomize Timer

DisplayScreen = _NewImage(1920, 1080, 32) 'make this whatever size you like
ImageScreen = _NewImage(Rnd * 320 + 320, Rnd * 240 + 240, 32) 'my image, which is by definition any size I want it to be -- that's why it's a random size here.

Screen DisplayScreen
_Dest ImageScreen

'Now, let's just draw some pattern on the imagescreen so we can flip/rotate it
For x = 0 To _Width(ImageScreen) Step _Width(ImageScreen) / 8
For y = 0 To _Height(ImageScreen) Step _Height(ImageScreen) / 6
Line (x, y)-Step(_Width(ImageScreen) / 8, _Height(ImageScreen) / 6), _RGB32(Rnd * 256, Rnd * 256, Rnd * 256), BF
Next
Next
_Dest DisplayScreen

'Now let's do our mirroring

'first the original
_PutImage (0, 0)-(_Width / 2, _Height / 2), ImageScreen, DisplayScreen, (0, 0)-(_Width(ImageScreen), _Height(ImageScreen))
'and a SLEEP so we can see it in all its glory
Sleep

'and then let's mirror it on the right and SLEEP to view it
_PutImage (_Width / 2, 0)-(_Width, _Height / 2), ImageScreen, DisplayScreen, (_Width(ImageScreen), 0)-(0, _Height(ImageScreen))
Sleep

'and then let's do the other two quadrants
_PutImage (0, _Height / 2)-(_Width / 2, _Height), ImageScreen, DisplayScreen, (0, _Height(ImageScreen))-(_Width(ImageScreen), 0)
Sleep
_PutImage (_Width / 2, _Height / 2)-(_Width, _Height), ImageScreen, DisplayScreen, (_Width(ImageScreen), _Height(ImageScreen))-(0, 0)
Sleep

Now note that this has a set of black lines which work as a divider to show our quadrants for us. This is not a glitch and is intentional on my part, just to highlight the flipping/mirroring which we do with _PUTIMAGE in each quadrant.

How'd I get it in there? And how would one remove it?

Correct my endpoints!! I'm using putimage from 0 to _WIDTH and from 0 to _HEIGHT, while the image uses coordinates from 0 to _WIDTH -1, 0 to _HEIGHT -1! I'm deliberately tossing a blank pixel that doesn't exist into my putimage statements here to create that blank line which you see in the center of the quadrants. I doubt you'd actually want that for yourself, so adjust those values by that offset.

For example a screen that is 640 x 480 pixels in size has coordinates from 0 to 639, 0 to 479 and NOT from 0 to 640 and 0 to 480. I'm not adjusting for that 0-offset here and I'm using it for an extra pixel to make those blank lines for highlight of each quadrant. You'll want to take that offset into account for seamless mirroring/flipping.

Unless I'm completely missing what you're trying to do here, somehow. Wink
Reply


Messages In This Thread
RE: from png tile, create symmetrical screen image - by SMcNeill - 08-20-2025, 03:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  error doing image collision detection with _MemGet madscijr 55 4,687 10-01-2025, 03:25 PM
Last Post: bplus
  need help printing a scaled string in a custom font to a 32-bit image madscijr 9 1,151 07-03-2025, 04:48 PM
Last Post: SMcNeill
  Trying to create a simple menu CMR 8 1,216 06-18-2025, 06:59 PM
Last Post: CookieOscar
  Erasing (or making a section of an image transparent) based on a mask from image #2? madscijr 17 2,433 04-14-2025, 09:19 PM
Last Post: madscijr
  program that stitches together a bunch of image files into one giant poster? madscijr 15 2,324 10-24-2024, 06:08 PM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)