Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / get image problem

Author
Message
Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 28th May 2008 03:08
I have a small game where you can draw your own character on the screen and then play with it in the game.

However when I use the get image command it does not copy the things that you drew and only the white box behind it.

How can I fix this?



Thanks!

Cheers,
Capt. America
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th May 2008 04:40 Edited at: 28th May 2008 04:44
Quote: "How can I fix this?"


What about the other problems?...

1. Set the display mode first - before turning Sync on as Set Display Mode re-initialises everything and can cause problems.

2. RGB values go up to 255 - not 500.

3. "ink rgb(0,0,0),1" <<< Do you understand what this does? Look Ink up in the help files. Read up on colours.

4. What do you see if you place a sprite which is black on a white background on top of a white screen? Answer - nothing, which is exactly what you were getting...



TDK_Man

BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 28th May 2008 05:11
your problem:

DBC Automatically displays the color black as transparent. White bounding box with transparent character over a white background just looks like white.

solution:
1. Instead of coloring with rgb(0,0,0) use rgb(1,1,1). Looks the same, just doesn't get set as transparent

OR

2. Use the SET SPRITE command to disable the transparency

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th May 2008 06:07
There's an echo in here...

Quote: "Use the SET SPRITE command to disable the transparency"


Changing the colour is the better option as the Sprite command is being used in the main Do..Loop and Set Sprite would need to be called every time too.

TDK_Man

Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 28th May 2008 08:15
@ALL

wow that was pretty rookie mistake!

Thanks for all the help!

@TDK

Does it affect the program at all if you use rgb(500,0,0) as opposed
to rgb(255,0,0)?

What is the difference?
Because it works the same for me.

Thanks again it would have taken me a LONG time to figure this out by myself!

Thanks again!

Cheers,
Capt. America
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 28th May 2008 08:38 Edited at: 28th May 2008 08:40
Quote: "Changing the colour is the better option as the Sprite command is being used in the main Do..Loop and Set Sprite would need to be called every time too."


I'm gonna have to disagree with TDK on this one, though it also depends on the ultimate goal Setting the transparency off will help solve the problem in this case - and if transparency is not needed, I think it should be a rule of thumb to turn it off; also Set Sprite only has to be called once for a sprite unless you delete the sprite. Plus turning off transparency if you don't need it improves performance as the number of sprites increase (you get a significant performance increase if you handle the redraw yourself also) Here's an example:



And in regards to using get image: without a sync following it, it often results in the image not being captured properly in my experience.

Enjoy your day.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th May 2008 10:21 Edited at: 28th May 2008 10:26
I regarded changing the colour better only because you do it once - each time the Sprite command is used in the loop, it has to be followed by a Set Sprite command to turn transparency off.

I regard this worse than changing the colour once when creating the sprite image and leaving transparency on.

However, I doubt the difference in speed doing this would be much different than leaving it black and having two sprite commands called each time around the loop. Well not enough to warrant writing a program to benchmark it anyway!

Quote: "Set Sprite only has to be called once for a sprite unless you delete the sprite"


Strange... that's what I thought, but I tried that first and unless it was called repeatedly it didn't work. If you are right and I just had a glitch with V1.2.0, then I'm with you 100% on yours being the better way.

Quote: "What is the difference?
Because it works the same for me."


It isn't the same - they are different colours:



RGB(500,500,500) is the same colour as RGB(245,245,245) - slightly darker than white.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 28th May 2008 21:40
rgb(1,1,1) will still register as black although it depends on bit depth how bright the colour has to be before it's not seen as black.

rgb values loop after 255 (256 is black)
having 500 is unnecessary and will produce some funny results if you try doing any maths on the colours.

It is far better to complete a 10 line program than to start a 10,000 line program.
Captain America
20
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 29th May 2008 07:29
ok ill just stick to 255 then.

Thanks for all the help guys!

Cheers,
Capt. America

Login to post a reply

Server time is: 2025-06-05 21:25:37
Your offset time is: 2025-06-05 21:25:37