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 / Palette Access?

Author
Message
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 17th Sep 2004 11:18
This is a tedious concern I know but something I've been curious about, in that there seems to be no way to access the palette of an active bitmap file directly. What I have is several images saved from another program that share a common set of palette colors, saved in yet another file that serves as the rendering base. Though I can load each image in native form into a memblock there seems to be no function that will turn it back into an image using the palette desired, as each image is used for both erasure of itself and the painting of it in different colors when being highlighted. This means I'm going to have a lot of conversion to do or must re-invent a drawing routine within DBC code to access a local palette and its overrides when called for, which is going to drop frame rate signifigantly.

Anyone have a suggestion of a short cut?

Is there anyway to access the drawing palette without literally saving the thing into a BMP file along with the image?

Thanks.
S.

Any truly great code should be indisguishable from magic.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 18th Sep 2004 09:18
Nevermind... turns out the images in my pack file are in SL/RLE format anyway so I think conversion is the only way...
(Sometimes I get a little too clever even for myself.)
s.

Any truly great code should be indisguishable from magic.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Sep 2004 03:02
i know you could do it in qbasic.

"eureka" - Archimedes
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 20th Sep 2004 09:32
Yeah, you can do it too in the program I first created the images in as well. But since DBC goes through direct-x there seems to be no definition of a fixed palete, so the only way is to create a bunch of little files out the pictures (or one massive one) and load 'em up and then manipulate. Ah well, such is life...
S.

Any truly great code should be indisguishable from magic.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Sep 2004 16:31
you might be able to create a palette from the image. create some sort of structure that knows where all the red pixels are in the image and purple and so on. using memblocks, you could change the values of the whole image pretty easily then.

"eureka" - Archimedes
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 22nd Sep 2004 23:14
Well, I had considered that as well Phaelax, but again, that would have to be a raw image manipulation. So far, at least as far as I can tell, you can't use bitmap references in an image memblock or vice versa once the type of block has been established.

And by the way, using the SL/RLE format and DBC's memblock and 2D painting access it took 50 minutes for DBC to render an image of 128 color depth by 200 pixels wide by 400 lines in height. Like I said, conversion in the only way...

The older program allows the images to pop up nice & quick and enjoy the smaller size, but alas, DB needs them the other way.
S.

Any truly great code should be indisguishable from magic.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2004 23:24
I had a similar problem, well it was just something I was messing around with really - basically swapping and customising colours on a texture, so different team colours would'nt need different textures - like I'd only need a base texture then specify the colour hue to set a part of texture to.

The way I did it was to have a mask image, like each part of the texture I wanted to be able to change, I gave a solid mask in a unique colour, then I could code it to shade the texture depending on a simple mask. I don't know if this is anything like what you need, but it worked pretty neatly for me - I had a purple dude with orange eyes in no time at all. The problem is that greyscaling your master image can do a lot of harm to your textures detail, and often it's the only way to get the colours right.


Van-B


Muhahahahaha.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 22nd Sep 2004 23:34
Well, in my case I was trying to use the images from a pack file I made for a previously incomplete version of the program, where I thought DB could help me work out some of the prototyping issues that had me stumped in the prior construction. However, I rather doubt I'd be willing to wait for 50 minutes for each image to appear, so conversion appears the only way. That number of images isn't that great but does get a little messy when you consider all the variants for selection and activation by color, but I can't see a quick way around that one. Add to that they too are masked, and it gets out of hand.

Any truly great code should be indisguishable from magic.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 22nd Sep 2004 23:40
Ohh, BTW - in DBC, try and do all your drawing to a hidden bitmap and with sync enabled. If you start DOTing and grabbing colour values in DBC - you'll soon see how rediculously slow it is. This is because if you don't sync, then DBC assumes you want to sync after every drawing operation. That's what's probably taking all your time - DBC should be much faster if you draw to a hidden bitmap first, then sync, then grab it or save it.


Van-B


Muhahahahaha.
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 24th Sep 2004 02:04
Yeah, I found out... heh-heh.

Taking a time test of the unpacking to a hidden bitmap however resulted in about 35 frames per minute, which is certainly fast enough for my prototyping tests but hardly useful for the final. As for the other, the conversion, I hadn't intended on doing it from-to screen anyway, but instead would unpack the images directly to a memblock and then a BMP file for later loading.
S.

Any truly great code should be indisguishable from magic.

Login to post a reply

Server time is: 2025-05-24 16:52:10
Your offset time is: 2025-05-24 16:52:10