maskimage and scaleimage problems

Blitz3D Forums/Blitz3D Beginners Area/maskimage and scaleimage problems

D_Town_Tony(Posted 2005) [#1]
The 2D images I am using for the menus and such are at 800x600, when I scale them to fit 640x480 when the screen resolution is changed not all the maskimage works, somo of it still shows, any way around this?


jfk EO-11110(Posted 2005) [#2]
Try
TFormFilter 0


D_Town_Tony(Posted 2005) [#3]
I did that and it works but the images become choppy, any other work arounds or suggestions


big10p(Posted 2005) [#4]
Well, scaling a 800x600 image down to 640x480 is going to result in loss off some pixel data from the original image - end of story. :) Bi-linear filtering attempts to reduce the visible effect of this but, as you've said, it knackers some transparent pixels.

Can't you just make 2 copies of the images (one 800x600 and one 640x480) and load in the appropriate one?


jfk EO-11110(Posted 2005) [#5]
Theoreticly you could use a "maskcolor range", so you would manually repaint all pixels that are within the mask color range. The problem with this method is: the contours of the masked object will be antialiased when scaled with filters on, so there may be color tones that are outside the mask color range, but still should be masked. Well you can try it.

Let's assume your mask color is black. So make sure all the visible Pixels are brighter than about 15,15,15. after scaleing you would do something like this:

mask_color=$000000 ; black

setbuffer imagebuffer(img)
lockbuffer()
for j=0 to imageheight(img)-1
 for i=0 to imagewidth(img)-1
  rgb=readpixelfast(i,j) and $FFFFFF 
  bri=(((rgb shr 16) and $FF) + ((rgb shr 8) and $FF) + (rgb and $FF))/3
  if bri <=15 then writepixelfast i,j,mask_color
 next
next
unlockbuffer()
setbuffer backbuffer()


I am not sure if a range of 15 will be enough to catch all filter nuances.