Mask Weirdness Readpixel vs Readpixelfast
Blitz3D Forums/Blitz3D Programming/Mask Weirdness Readpixel vs Readpixelfast
| ||
The codeFunction ImageHasAlpha(image, frame, mask) Local x,y,iw,ih iw=ImageWidth(image) ih=ImageWidth(image) For x=0 To iw-1 For y=0 To ih-1 If ReadPixel(x,y,ImageBuffer(image,frame))=mask Then Return True EndIf Next Next Return False End Function works.. but the code... Function ImageHasAlpha(image, frame, mask) Local x,y,iw,ih iw=ImageWidth(image) ih=ImageWidth(image) LockBuffer ImageBuffer(image,frame) For x=0 To iw-1 For y=0 To ih-1 If ReadPixelfast(x,y,ImageBuffer(image,frame))=mask Then UnlockBuffer ImageBuffer(image) Return True EndIf Next Next UnlockBuffer ImageBuffer(image,frame) Return False End Function Doesn't. Is there a difference between what readpixelfast returns and what readpixel returns? |
| ||
Ugh.. just noticed the problem with using imagewidth with an anim image. |
| ||
Fixed... sorry for the post..Function ImageHasAlpha(image, frame, mask) Local x,y LockBuffer ImageBuffer(image,frame) For x=0 To TileSizeX-1 For y=0 To TileSizeY-1 If ReadPixelFast(x,y,ImageBuffer(image,frame))=mask Then UnlockBuffer ImageBuffer(image,frame) Return True EndIf Next Next UnlockBuffer ImageBuffer(image,frame) Return False End Function |
| ||
Don't know if you noticed this too but you put ImageWidth for bothiw=ImageWidth(image) ih=ImageWidth(image) |
| ||
Ya it was messed... sleepy coding! lol thanks. |
| ||
*Orders Red Bull, coffee and pro-plus for Skully* |