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 Professional Discussion / Cant find any help for "coordinates" in command GET IMAGE x,x,x,x,x

Author
Message
Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 18th Sep 2010 19:04
Good day,

I am new to the forum and hope I post this at the right place !

The command GET IMAGE is followed by the "coordinates" (I guess one call it like that).

(Example: get image 1,1,1,570,270)

Now how can I know what numbers to insert and what the editor is finally cutting outside ???

I understand the first 1 ! This I read in the tutorials but nowhere I can find how to work with the other numbers !!!
(the other numbers are - right side - left - up & down BUT how to figure out where the real location is ??)

Is there a program for me to help or does it work like a formula ???

I am thankful for any help !!

-----------------------------------------------------------------
when someone has a good site/tutorial for exactly THIS matter, please feel free to help me out
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Sep 2010 20:04
GET IMAGE Image,Left,Top,Right,Bottom,Mode

So to grab a 640x480 image:
GET IMAGE 1,0,0,640,480,1

You have to grab one extra pixel, so it's inclusive.

Health, Ammo, and bacon and eggs!
Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 18th Sep 2010 20:08
hmm... so when I have one of this 32x32 bmp images & those are divided into 4 areas then how do I select the upper left one or the other parts ??

The same when I have (like I found on an other site) an LARGE Image with MANY small images in it - how do I pick now one specific part out ???

what do you mean by 1 extra pixel (at the end of your command) ??

THANKS for your fast help !!!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Sep 2010 00:46
Your first sentence could be read many ways, so I won't bother trying to work out what you meant.

If you have a bitmap, and the images are 16x16 on it, then the start coordinates, both x and y, will be on a multiple of 16 and the end coordinates will be that same number plus another 16.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Sep 2010 01:20 Edited at: 19th Sep 2010 01:22
Quote: "Now how can I know what numbers to insert and what the editor is finally cutting outside ???"


Like Van B showed it's based on the current resolution. If your screen side is 640x480 (the default for Darkbasic Pro usually). You have 0 to 640 pixels across and 0 to 480 pixels down. When we say x and y in any code "x" usually means the horizontal coordinate and "y" usually means the vertical coordinate. Many commands use coordinates to determine where things are placed on the screen.



In the above code it randomly picks coordinates to make a line. In the LINE statement if you change the first number and third numbers RND() commands from 640 to 320 instead the lines will only be between 0 and 320 horizontally (leaving half the screen blank).

Quote: "when someone has a good site/tutorial for exactly THIS matter, please feel free to help me out "


To see good tutorials for newbies check out TDKs Tutorials:
http://forum.thegamecreators.com/?m=forum_view&t=99497&b=10

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Sep 2010 02:04
Quote: "You have 0 to 640 pixels across and 0 to 480 pixels down."


No you don't. The pixels you are grabbing are numbered 0 to 639 across (i.e. 640 pixels in total - count it on your fingers if you have to) and 0 to 479 down (i.e. 480 pixels in total). The numbers 640 and 480 are actually one greater then the index position of the final pixel. So, for example, if you wanted to grab a 32x32 image starting with pixel (10, 10) you would use

get image imageId, 10, 10, 42, 42, 1

The final flag 1 ensures the image isn't stretched or modified. The first pixel used will be at position (10, 10) and the final one will be pixel (41, 41) making a total of 32x32 pixels.

The original poster just needs to decide which are the first and last pixels in each direction and remember to add one to the ones corresponding to the bottom left hand corner. They also need to remember that pixels are numbered across and down so the top left corner pixel is the lowest numbered.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Sep 2010 03:14
Quote: "No you don't. The pixels you are grabbing are numbered 0 to 639 across (i.e. 640 pixels in total - count it on your fingers if you have to) and 0 to 479 down (i.e. 480 pixels in total). "


Hahaha I know. My only excuse is I was trying to rush through the message because my lunch was getting cold.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Sep 2010 16:31
I know the feeling - I'm waiting for the microwave to "ping" right this minute.
Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 19th Sep 2010 16:42
So thank you for your time and help !

I have to think about all when I am back home but have one more question.

Attached to this post is a JPEG (should be *.bmp but doesnt matter for the example) and I would like to see ONE example of how to load the "V", the "+" and the "R" as image.

(image size = 225*225 - this is the same like x*y ?!, right)

I would be happy about a snippet for grabbing this 4 parts as sprites..

like:

load image "xxx.bmp",1,1
sprite 1,xxx,xxx,xxx,xxx,1
set sprite 1,0,1
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Sep 2010 19:46 Edited at: 19th Sep 2010 19:47
The four corner pixels are

(x,y) = (0,0) - the top left pixel
(x,y) = (224,0) - top right
(x,y) = (0,224) - bottom left
(x,y) = (224,224) - bottom right

So, to pick out the 5th character from the left in the 3rd row from the top, the "8", you need something like the following which assumes the character occupies a block of 22x22 pixels:



However, it's your image so only you will know how the characters are laid out - if it's not your image then neither you nor I will know and you can find the four corners of each character as well as I or anyone else. The simple fact that 225 is not a multiple of 10 is a complicating factor and a quick glance suggests each character is about 22x22 pixels in size.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 01:10
@ Green Gandalf:

I just thought of a great idea... a computer desk with an integrated fridge, microwave, and toaster oven.


@ Shaovanlin

If that's the original size of the bitmap font it's extremely small. That gradient background isn't going to help matters either. It needs to be a solid color so you can make it transparent in your program. In most bitmap fonts you grab every single character with either a FOR/NEXT loop or use CREATE ANIMATED SPRITE... you don't use specific coordinates to grab each letter. And you really shouldn't use .jpg or .bmp... use .png so you can use transparencies.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Sep 2010 13:18
Quote: "I just thought of a great idea... a computer desk with an integrated fridge, microwave, and toaster oven"


A few other mod cons would be handy too.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 18:23
Quote: "A few other mod cons would be handy too."


Yeah that would be cool. I looked up "desk modding" and found a couple of computers inside desks (not exactly what we talked about). Even though I like sci-fi I like the first one more.





Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 20th Sep 2010 19:09
okay THANKS guys - I GOT IT !



Now I know how to grab all the parts I want and have an example code.
More I didn't want



Have a great day and the thread can be closed (if this is here handled like that)!
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Sep 2010 21:34
You're welcome.

Please excuse us for enjoying ourselves on your thread while we waited for your response.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 20th Sep 2010 21:54
Quote: "More I didn't want"


You gotta admit those desks are cool.


Quote: "Please excuse us for enjoying ourselves on your thread while we waited for your response."


Hahaha yeah.

Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 21st Sep 2010 15:57
yeah* they are creative

This one is good for your purposes



then you can put all you need in a nice comfortable way on it
Shaovanlin
15
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 21st Sep 2010 16:07
ahhh**

here is it !

http://www.geeky-gadgets.com/the-desktop-microwave-30-04-2010/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+geeky-gadgets+%28Geeky+Gadgets%29

so subtopic "Eating on the desk" finished
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 22nd Sep 2010 00:55
I love the desk but that microwave is a bit small. It's still amazing though. I love any technology.

CJB
Valued Member
22
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 2nd Oct 2010 23:26
I love the way it is PC controlled via USB! A boring old timer just wouldn't cut it!

Login to post a reply

Server time is: 2026-07-24 23:12:41
Your offset time is: 2026-07-24 23:12:41