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 / smaller memblock image to bigger memblock image

Author
Message
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 29th Jun 2009 06:51 Edited at: 29th Jun 2009 06:54
Alright, I have an image in a memblock that is 320x320 and I made a new memblock that is 2560x1920.

How would I be able to copy the smaller image to the larger image multiple times, without distorting how the the smaller looks when it is copied to the big one.

The problem I'm having is that in a memblock, you don't find positions by an X and Y coordinate, you find them by the position in a memblock which is just 1 number. So, the width of my small picture would be 320 and the width of my big picture would be 2560. If I try to do a simple For next loop, once the number passes 652(I have to include the 12 memblock positions storing width, height, and depth and that a word is 2 bytes each). It will be on the second row of the smaller image and the first row of the bigger image. I need a way so that when I'm copying the smaller to the bigger, the position I'm getting off the smaller stays on the same row and just keeps resetting itself to the beginning of that row until I go to the second row of the larger image. Then, get it to allow me to also go to the second row of the smaller image. And just keep repeating the process until I've got to the last memblock position on the bigger image.

If you don't understanding what I'm trying to explain then I'll try and whip up some code to show you.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 29th Jun 2009 08:55
I hope this helps, if you have more specific questions feel free to ask.
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 29th Jun 2009 16:02 Edited at: 29th Jun 2009 16:03
not sure its possible to make that without distortion, since the x and y scales are different

and I havent read ashingdas post but you can use a pair of for-next loops with x and y to find the position:



There are only 10 kinds of people in the world, those who understand binary and those who dont
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jun 2009 22:33
You have to convert the number into [X,Y] values, it'll be much easier. Now are you wanting to tile this image throughout the larger one? Or just copy it once to a specific location in the bigger image? Either way it's quite simple. There would be no distortion unless you're enlarging the image, in which case it would just get a fuzzy or blurred.

[url="http://dbcc.zimnox.com"][/url]
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 30th Jun 2009 03:10
I would do something like spread the pixels from the small image to cover the large image

Small Image (3x3)
a a a
a a a
a a a

Large Image (5x5)
a b a b a
b c b c b
a b a b a
b c b c b
a b a b a


The {a} values are the original pixel colours, the {b} values are the average of the adjacent {a}'s, and the {c}'s are the average of the adjacent {b}'s.

TGC Forum - converting error messages into sarcasm since 2002.
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 30th Jun 2009 03:38 Edited at: 30th Jun 2009 03:41
@Phaelax
I want to tile it.

BTW I'm using a depth of 16 for the images not 32
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 30th Jun 2009 07:31
16 bit means you'll use word instead of dword. I've modify this to work in that mode.

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 30th Jun 2009 07:36
but then how to you get rgb, xcept you would need a special versio of the rgbr,rgbg,rgbb function set

ok now I get why 16 bit is less color than 32, theres half as many possible colors in it so technically every other color in 32 bit is left out of 16

There are only 10 kinds of people in the world, those who understand binary and those who dont
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 30th Jun 2009 08:12
To get the rgb you have to convert it from the 2 bits.





To write it back you have to convert it into 2 bits again.

That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 30th Jun 2009 17:57
........wow how did u learn this stuff?

There are only 10 kinds of people in the world, those who understand binary and those who dont
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 30th Jun 2009 18:26 Edited at: 30th Jun 2009 18:27
Quote: "how did u learn this stuff?"

I learned it on this forum . I had a few post out for it, Latch help a great deal.

Login to post a reply

Server time is: 2024-05-20 12:02:38
Your offset time is: 2024-05-20 12:02:38