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.

Author
Message
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 18th Feb 2003 22:50
I can't work out how to edit an image in a memblock state,
could someone help me please
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 19th Feb 2003 02:07
need more info

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 19th Feb 2003 19:11
At the moment I have an image for a level in my 2D shooter thingy, however I want to be able to alter the image, eg create terrain or remove it, (for example if it got shot up I would need to take chunks out) meaning I will need to alter pixels etc, I have decided to do this by turning the image/level into a memblock, all I have to do now is understand how the info is stored for each pixel and edit it as I see fit, then turn it back into a image and paste it to the screen,

Shadow
22
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 19th Feb 2003 20:34
DB Classic help file:

MAKE MEMBLOCK FROM IMAGE
This command will make a memblock from an image. The specified values must be integer values and the source resource must exist or the command will fail. The memblock stores the data as described below.

Memblock-Image (12 Byte Header)
-Header
--4 BYTES (DWORD) Width
--4 BYTES (DWORD) Height
--4 BYTES (DWORD) Depth
-Data
--X BYTES - Pixel Data (a 16bit bitmap uses 2 BYTES per Pixel)

SYNTAX
MAKE MEMBLOCK FROM IMAGE Memblock Number, Image Number
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 19th Feb 2003 23:18
yeah but how is the information coded into those 2bytes and how does one get at it?
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 19th Feb 2003 23:32
And what about 24bit, I assume that uses 3 bytes (?) and how would I get about decoding that?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 20th Feb 2003 00:11
No, 24-bit takes the same space as 32-bit - its just encoded slightly differently.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 20th Feb 2003 00:30
for a 16bit colour table you need to convert to a 16bit colour table ... if you need to know how look at the HSL -> RGB thread below

and rather than using
Y + (Cr>>8) + (Cb>>16)
use
T + (Cr>>5) + (Cb>>11)

you can either use 16bit colour or 32bit colour

32bit colour is 4 byte values RGBA

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 20th Feb 2003 14:20
Ok, so my pointer location is found out by this equation:
pointerl = xposition + yposition*(image_x_size)+12
then what? read dword at that point or something?
thanks for your help so far everyone,
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 20th Feb 2003 18:00
You could use either mine or Ian's peek routine, thus you have something like :

value=peekS(base,offset)

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 20th Feb 2003 23:48


How come this doesn't work?
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 20th Feb 2003 23:53
sorry that post missed the 1 after value (a variable name thingy) in line 7, however still doesn't work
boo hoo
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Feb 2003 23:58
You need to multiply your offset (addr) by 2 for 16 bit values or 4 for 32 bit before adding the 12.

addr=(pointerx+(pointery*200))*4 + 12

Next, you are getting the address into 'value1' and the with the next line peeking using 'value'
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Feb 2003 23:58
Darn, took too long to post.
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 21st Feb 2003 00:01
sorry i forgot to add clred etc in the hsl --> rgb function
Munin
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location:
Posted: 21st Feb 2003 00:18
ahhhhhhh I think I will commit Hari Kiri


and ideas people?

Login to post a reply

Server time is: 2025-05-18 18:47:25
Your offset time is: 2025-05-18 18:47:25