Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
from png tile, create symmetrical screen image
#11
Quote:@bplus i am curious with one thing in your program. you say something about scale variable. but why set it to a different value?

Yeah scale was an artifact from the program I modified for the present code, _PutImage Demo #5 was about scaling the size of the image and rotated images or axis flipping. When we speak of using PutImage its more axis flipping than rotation though results do look like rotations.

Yeah the distortions of stretching or shrinking is fixed by PutImage_ing into a slot with the same ratio of Width to Height as the original Image.

So some more calcs to get the screen tiled without distorting the image once tiled, hmm... can do that but likely will need to change screen size or create a border or just not completely fill the screen where tiles would be partial not whole or project into a giant image container and show a screenfull at a time of that image.

Could practice by tiling a screen with rectangles of different ratio width/height dimensions.
Might be an interesting challenge to play with today! Smile Steve might have already been here playing in this sandbox in earlier post of this thread?
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#12
OK no or extremely little distortion from stretching of shrinking of image used to make 2x2 tile to fill screen because the screen is setup to accept integer amounts of whole tiles!

Code: (Select All)
_Title "PutImage Demo 7C" ' b+ 2025-08-22
' created from Demo 7 made yesterday
' modify demo 7 by creating a tile that has the image and 3 flips
' then create a screen so the tiles will fit without stretching or shrinking tile image

FileImage& = _LoadImage("2 Tile crop 2.png") ' note: 2 x 2 block of these will fit 800 x 600 screen

FileImageW& = _Width(FileImage&) '
FileImageH& = _Height(FileImage&)

' make an 2 x 2 image Tile by flipping image into Tile container
TileW& = 2 * FileImageW&
TileH& = 2 * FileImageH&
Tile2x2& = _NewImage(TileW&, TileH&, 32)

' then flip image mirror on x and y axis
_PutImage (FileImageW&, FileImageH& - FileImageH&)-Step(FileImageW&, FileImageH&), FileImage&, Tile2x2&
_PutImage (FileImageW&, FileImageH& - FileImageH&)-Step(-FileImageW&, FileImageH&), FileImage&, Tile2x2&
_PutImage (FileImageW&, FileImageH& + FileImageH&)-Step(FileImageW&, -FileImageH&), FileImage&, Tile2x2&
_PutImage (FileImageW&, FileImageH& + FileImageH&)-Step(-FileImageW&, -FileImageH&), FileImage&, Tile2x2&

nSW& = _DesktopWidth \ TileW& ' how many WHOLE tiles fit on desktop going across
nSH& = _DesktopHeight \ TileH& ' how many WHOLE tiles fit on desktop going down
SW& = nSW& * TileW&
SH& = nSH& * TileH&
Screen _NewImage(SW&, SH&, 32)
_ScreenMove 0, 0
For y = 0 To SH& Step TileH&
    For x = 0 To SW& Step TileW&
        _PutImage (x, y)-Step(TileW&, TileH&), Tile2x2&, 0
    Next
Next
Sleep

2 Tile crop 2.png
   

results with code using above image:
   
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  error doing image collision detection with _MemGet madscijr 55 4,653 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,142 07-03-2025, 04:48 PM
Last Post: SMcNeill
  Trying to create a simple menu CMR 8 1,188 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,402 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,283 10-24-2024, 06:08 PM
Last Post: madscijr

Forum Jump:


Users browsing this thread: 1 Guest(s)