Hi
Is there a way to resize a loaded or created
texture in pixel unit ?
Regards
Is there a way to resize a loaded or created
texture in pixel unit ?
Regards
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