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 / point() command too slow, need faster?/ Tell how many lines in file?

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 18th Sep 2005 06:16
http://forum.thegamecreators.com/?m=forum_view&t=8125&b=10

aboce is a link to another older thread, but I don't get what the dll is, or what it does, or how to use it, (is it internal, or already on every computer?). I need to scan a image for all pixels to make someting with (its a surprise for now). I have a code working already, but it is really slow. Although I'm not sure if its working by pasting the image back onto the screen yet, I'll have to check later. For now I have all the values write to a file, which brings my second question.

How do you tell how many lines are in a file? When writing myh values to a file, there could be 10,000 (estimate) lines in the file (for a 100x100 image). It also could be as low a 36 (a 5x5 (including 0) image and again another estimate).

In case you don't know what my questions are, here they are:

1. Is there a faster way to scan and write all the rgb points on a screen?

2. How can I tell how many lines there are in a file?

------------------------
Visit my website of games
http://www.dabip.co.nr!
Leeorg
19
Years of Service
User Offline
Joined: 5th Jul 2005
Location:
Posted: 18th Sep 2005 11:23
Why don't you write your image into a memblock?
There is a MAKE MEMBLOCK FROM BITMAP command. If you specify zero as the bitmap the screen will be copied into a memblock.
According to the instruction manual, the bitmap info is recorded as wdith(DWORD), height(DWORD), Depth(DWORD) and the rest is data (BYTES) - i.e. the pixels being stored
You can obtain the size of the memblock, skip past the DWORD data within the memblock and alter the bytes (i.e. the image) bit by bit.
Though I am not entirely sure what altering them would do - you will have to experiment.
Once you have finished manipulating your memblock, you can MAKE BITMAP FROM MEMBLOCK
If you make this BITMAP 0 then it should alter the screen, after a SYNC command that is.
So that should be Q1 answered.
Q2...
If you have your memblock you can save that to a file by creating a file, (destroy an old one if it exists), make it a .dat file.
Use the command WRITE MEMBLOCK <file number>,<memblock number>
Close your file and hey presto the memblock is now stored as joe bloggs.dat
I think you are after the number of bytes, i.e number of pixels in your image, you can obtain the width and height of the bitmap and using the BITMAP WIDTH and BITMAP HEIGHT commands, multiply them together to get the number of pixels in your bitmap.
Hope this of use.
Any Q's pls ask!
Yours
Lee
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 18th Sep 2005 20:06
No, I need to know EXACTLY where certain colored pixels are on a screen.here is my code (so far):



http://forum.thegamecreators.com/?m=forum_view&t=19043&b=10

JessTicular made this and I'm not sure how to read his code. That is ALMOST what I want to do but instead write the rgb to a file. You would go across until you hit the end then you would go down 1 row and do the same until there aren't anymore. I would then read it and try re-creating the image to see if it would work. (this is just to test, this is not what I'm trying to make).

Thanks, though. I'll still try your memblock thing. I've never used memblocks before so this will be good for me.

------------------------
Visit my website of games
http://www.dabip.co.nr!
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 24th Sep 2005 03:33
Can't anyone help me?

------------------------
Visit my website of games
http://www.dabip.co.nr!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Sep 2005 05:49 Edited at: 24th Sep 2005 05:49
I'm not totally sure what you are after.

OK, you want read in the pixels from an image on the screen right?

Where is/was the image from? If it's a bmp image file that you load and display, then you can read the information you want straight in from disk without having to display it.

Using this method, you can read the image header which contains all the info you need like image width and height, number of colours etc. followed by the pixel RGB data.

TDK_Man

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 24th Sep 2005 07:50
GREAT! how would I do that?

------------------------
Visit my website of games
http://www.dabip.co.nr!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Sep 2005 19:48
I'll dig out the code for you...

TDK_Man

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 1st Oct 2005 07:20
Find it yet?

Visit my website of games http://www.dabip.co.nr!

Visit http://www.madmanhosting.tk For a GREAT web host visit MAD MAN HOSTING
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Oct 2005 22:09
Sorry VGM - completely slipped my mind!

Going through all my source code at the moment and sorting it out - will be posting a lot up on the web site that I'm sorting out as I write (http://www.matedit.com).

As soon as I come across it I will post it here...

TDK_Man

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Oct 2005 04:27
Sorry for the delay. Found it eventually!

The code below opens a bmp file (just alter the filename), then loads the pixel data into an array which has been dimensioned to the size of the image.

After it has loaded, it tells you the width, height and colour depth of the image and waits for you to press a key.

When you do, it creates the image on screen from the data in the array.

My guess is that you don't need that anyway as you seemed to only want to know the number of lines in an image already on the hard disk and this will tell you that without actually displaying it...



TDK_Man

dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 3rd Oct 2005 04:42
TDk, Check your email, I'll ask you a question real quick, what I'm doing, I really want to keep a secret until I get enough done to where it works.

Visit my website of games http://www.dabip.co.nr!

Visit http://www.madmanhosting.tk For a GREAT web host visit MAD MAN HOSTING

Login to post a reply

Server time is: 2025-05-22 13:56:49
Your offset time is: 2025-05-22 13:56:49