January 15, 2021, 06:24:12 PM

Author Topic: [bb] Tile2Iso by pc_tek [ 1+ years ago ]  (Read 405 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Tile2Iso by pc_tek [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
Title : Tile2Iso
Author : pc_tek
Posted : 1+ years ago

Description : Converts square tile to an Isometric image.

Code :
Code: BlitzBasic
  1. ;       Author: JP Hamilton 2011
  2. ;       Title:  Tile2Iso.bb creates Isometric images from a uniform tile.  Floor, Left & Right
  3. ;       Inputs:  1 tile of equal sides (32x32, 64x64...etc)
  4. ;       Outputs:        1 image containing the Isometric images
  5. Graphics3D 640,480,32,2
  6. filein$="image.png"
  7. fileout$="slab1.bmp"
  8.  
  9. GFX_In=LoadImage(filein$)
  10. GFX_Out=CreateImage(ImageWidth(GFX_In)*4,ImageHeight(GFX_In)+ImageHeight(GFX_In)/2)
  11.  
  12. For x=0 To ImageWidth(GFX_In)-1
  13.         For y=0 To ImageHeight(GFX_In)-1
  14.                 ix=x+y:iy=ImageWidth(GFX_In)/2-Int(x/2)+y/2
  15.                 WritePixel ix+0,iy,ReadPixel(x,y,ImageBuffer(GFX_In))
  16.                 WritePixel ix+1,iy,ReadPixel(x,y,ImageBuffer(GFX_In))
  17.         Next
  18. Next
  19.  
  20. For x=0 To ImageWidth(GFX_In)-1
  21.         For y=0 To ImageHeight(GFX_In)-1
  22.                 ix=x:iy=y+x/2
  23.                 WritePixel ix+ImageWidth(GFX_In)*2,iy+1,ReadPixel(x,y,ImageBuffer(GFX_In))
  24.         Next
  25. Next
  26.  
  27. For x=0 To ImageWidth(GFX_In)-1
  28.         For y=0 To ImageHeight(GFX_In)-1
  29.                 ix=x:iy=ImageWidth(GFX_In)/2-x/2+y
  30.                 WritePixel ix+ImageWidth(GFX_In)*3,iy,ReadPixel(x,y,ImageBuffer(GFX_In))
  31.         Next
  32. Next
  33.  
  34. GrabImage GFX_Out,0,0
  35. SaveImage(GFX_Out,fileout$)
  36. EndGraphics
  37. End


Comments :


Andy_A(Posted 1+ years ago)

 This could be useful to non-artist types like me.  Nice!


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal