how to speed up LoadBrush(id, $file, {x, y, width, height})?
Posted: Fri May 03, 2013 9:01 pm
I noticed there is possiblity to load only part of picture using LoadBrush with idea that if you have several squares to grab from same picture, you could take them piece by piece.
So I did, but it appears to be very slow.
I have roughly 2500 x 2500 pixel picture where I am taking 128x 128 pieces out of it. That makes around 200 tilepieces.
However, It happens very, very slow. I think it takes maybe 3 minutes or something like that to complete the whole process of:
Is there any way to speed thsi up, or do i have to perhaps load that picture as a brush and then keep making smaller brushes from that one big brush?
For my guess is that the slow down is that instead of loading just that small part of that picture, it probably loads that whole picture before taking that small piece making reloading of such a big picture very slow.
So I did, but it appears to be very slow.
I have roughly 2500 x 2500 pixel picture where I am taking 128x 128 pieces out of it. That makes around 200 tilepieces.
However, It happens very, very slow. I think it takes maybe 3 minutes or something like that to complete the whole process of:
Code: Select all
n_brush=1
x=0
y=0
Repeat
Repeat
LoadBrush(n_brush, tiles.image, {x=x, y=y, width=tiles.tilewidth, height=tiles.tileheight})
n_brush = n_brush + 1
x = x + tiles.tilewidth
DebugPrint(x.." / "..y.." n: "..n_brush)
Until x > tiles.imagewidth-tiles.tilewidth
x = 0
y = y + tiles.tileheight
Until y > tiles.imageheight-tiles.tileheight Is there any way to speed thsi up, or do i have to perhaps load that picture as a brush and then keep making smaller brushes from that one big brush?
For my guess is that the slow down is that instead of loading just that small part of that picture, it probably loads that whole picture before taking that small piece making reloading of such a big picture very slow.