MaskImage
Blitz3D Forums/Blitz3D Programming/MaskImage
Why does maskimage never work?
Ive tried it with every version of blitz3D ive had, and when i used to have blitzbasic, MaskImage has NEVER worked for me
Do you have an example? Like a piece of code, with an image that doesn't work?
This code here should work. If you see a white circle, with NO purple around it, it works.
Graphics 800,600
SetBuffer BackBuffer()
Global image = CreateImage(64,64)
Color 255,0,255
SetBuffer ImageBuffer(image)
Rect 0,0,64,64
Color 255,255,255
Oval 0,0,64,64
SetBuffer BackBuffer()
maskimage image,255,0,255
While Not KeyHit(1)
Cls
Color 100,100,100
Rect 0,0,125,600
Color 150,150,150
Rect 125,0,400,600
DrawImage image,100,100
Flip
Wend
End
Same thing really, as images have a maskimage of RGB(0,0,0) already applied. I've updated my code to be more thorough :o0
Graphics 800,600,0,2
Global image = CreateImage(64,64)
Color 255,0,255
SetBuffer ImageBuffer(image)
Rect 0,0,64,64
Color 255,255,255
Oval 0,0,64,64
SetBuffer BackBuffer()
MaskImage image,255,0,255
Mask=1
HidePointer()
While Not KeyHit(1)
Cls
If KeyHit(57)
mask=1-Mask
If Mask=1
MaskImage image,255,0,255
Else
MaskImage image,0,0,0
EndIf
EndIf
Color 100,100,100
Rect 0,0,125,600
Color 150,150,150
Rect 125,0,400,600
DrawImage image,MouseX(),MouseY()
Color 255,255,255
Text 0,0,"Hit Space to swap Mask"
Flip
Wend
ShowPointer()
End
Little modification to test the effect
No offense ;o) But, isn't it proof enough that it isn't drawing the pixels? Ayway, i wish he's post back to see if it works for him.
Ross C. do you have any mental problems?
Isn't it better for him to have code where he can test it without any changes and additions? Especially due to the fact that the online help doesn't work because of a wrong link to the bitmap...
Not to mention that I gave you the hint what he really meant... then you added MaskImage in your program and even later you corrected the 63s in your code to 64s meanwhile, what was another reason to make a better version...
RaGR. Stop being a cheeky git. I was saying i don't see the problem with my code. It CLEARY show that maskimage is working. That's what i'm saying. My code, doesn't need any changes or additions. If you are seeing no square behind the circle, maskimage is clearly working.
You, my friend, have an attitude problem.
Ross C ... I see you have mental problems... so I click myself out of this childish conversation...
Why exactly do i have mental problems? You have an attitude problem and deserve to be banned from the forum for personal attacks.
I found that the main reason it doesnt work is.. when i load a jpg, maskimage doesnt work at all, and when i load a bmp, it works slightly ,but not much, i think the pixels arent being saved as exactly the color i want, more like 1 pixel off
Well, when you save a .JPG, the images doesn't save exactly. The black pixel may got slightly distorted. You should never use .jpgs if you want to retain image accuracy and use things such as maskimage. Use a .png preferably, or .bmp.
this was really funny to read. 2 guys getting in troubles while discussing about MaskImage - how about a discussion about religion or politics then? Seriously, take it easy.
Zach - never use lossy compression for images you want to mask. Jpeg is lossy, even in the best quality setting.
Instead use bmp, png, tga. Also make sure to use 32 Bit graphics since in 16 Bit mode colors will be converted to 5.6.5 Bits.
And make sure to use a reliable Painting App that will save things correctly.
Roos C and jfk and right. Masking is defeated by lossy jpegs.
Also, RaGR initiates unwarranted (and unwelcome on the forum) insults, then calls the whole conversation childish. Go figure.
Yeah, there was no need to say i have mental problems. I'm not geting worked up about the maskimage thing. Just no need for insults.
There's a teaching that says, "As much as lies within you, be at peace with all men." It implicitly is indicating that there will be some who won't be at peace with you, no matter what you do, so you're on the right track by not letting it get to you.