Resize texture ?

Blitz3D Forums/Blitz3D Programming/Resize texture ?

Filax(Posted 2006) [#1]
Hi

Is there a way to resize a loaded or created
texture in pixel unit ?

Regards


Little Olive(Posted 2006) [#2]
ScaleTexture Texture,x,y,z


Filax(Posted 2006) [#3]
Thanks olive :) but i want scale texture in pixel mode like scaleimage.


RifRaf(Posted 2006) [#4]
this will work, however its not intended for real time use.
Function resizetexture(tex,xs,ys,flags=0)
 oldx=TextureWidth(tex)
 oldy=TextureHeight(tex)
 temptex=CreateImage(oldx,oldy)
 CopyRect 0,0,oldx,oldy,0,0,TextureBuffer(tex),ImageBuffer(temptex)
 ResizeImage temptex,xs,ys
 newx=ImageWidth(temptex)
 newy=ImageHeight(temptex)
 FreeTexture tex
 If flags=0 Then 
  tex=CreateTexture(xs,ys)
  CopyRect 0,0,newx,newy,0,0,ImageBuffer(temptex),TextureBuffer(tex)
  FreeImage temptex
  Else
  SaveImage temptex,"temptex.bmp"
  tex=LoadTexture("temptex.bmp",flags)
 EndIf
 FreeImage temptex
 Return tex
End Function

Function ScaleTexture2(tex,xs#,ys#,flags=0)
 oldx=TextureWidth(tex)
 oldy=TextureHeight(tex)
 temptex=CreateImage(oldx,oldy)
 CopyRect 0,0,oldx,oldy,0,0,TextureBuffer(tex),ImageBuffer(temptex)
 ScaleImage temptex,xs,ys
 newx=ImageWidth(temptex)
 newy=ImageHeight(temptex)
 FreeTexture tex
 If flags=0 Then 
  tex=CreateTexture(newx,newy)
  CopyRect 0,0,newx,newy,0,0,ImageBuffer(temptex),TextureBuffer(tex)
  FreeImage temptex
  Else
  SaveImage temptex,"temptex.bmp"
  tex=LoadTexture("temptex.bmp",flags)
 EndIf
 FreeImage temptex
 Return tex
End Function



Filax(Posted 2006) [#5]
Many thanks !!!