There ought to be a better, faster way to do these two functions (the first creates a texture strip of the texture with spaces and the second adds to it)
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
texture = fix_texture("condensed texture.bmp",32,64,3,0)
image = add_texture("new texture.bmp",texture,32,64)
;image = CreateImage(TextureWidth(texture),TextureHeight(texture))
;SetBuffer(TextureBuffer(texture))
;GrabImage(image,0,0)
;SetBuffer BackBuffer()
DrawImage(image,5,5)
Flip
Print "done"
WaitKey()
;t = texture file, tf = texture flags, ts = size of textures, tn = number of textures
Function fix_texture(t$,tSx,tSy,tN,tF)
oT = LoadImage(t)
final_image = CreateImage(ImageWidth(ot)*2,ImageHeight(ot)) ;be able to put an image between them
g_image = CreateImage(tSx,tSy)
;grab the images and put them into the final image spaced out
For i = 0 To tN
x = i*tSx
SetBuffer(ImageBuffer(ot))
GrabImage(g_image,x,0)
SetBuffer(ImageBuffer(final_image))
DrawImage(g_image,x*2,0)
Next
final_texture = CreateTexture(ImageWidth(final_image),ImageHeight(final_image),tF)
SetBuffer TextureBuffer(final_texture)
DrawImage(final_image,0,0)
SetBuffer BackBuffer()
Return final_texture
End Function
Function add_texture(t$,original,tSx)
image = CreateImage(TextureWidth(original)+tSx*2,TextureHeight(original))
g_image = CreateImage(TextureWidth(original),TextureHeight(original))
SetBuffer TextureBuffer(original)
GrabImage(g_image,0,0)
SetBuffer ImageBuffer(image)
new_image = LoadImage(t)
DrawImage(g_image,0,0)
DrawImage(new_image,TextureWidth(original),0)
t = createtexture(TextureWidth(original)+tSx*2,TextureHeight(original))
setbuffer texturebuffer(t)
drawimage(image)
SetBuffer BackBuffer()
;return t
Return image ;for testing purposes
End Function
|