123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|401|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Curiosity has overtaken me

Page : 1 Prev 2
Next
Sat, 28 Apr 2007, 14:56
Paul
yup, it can
A little tip, do .jpg last, I've heard it's the most difficult to do.
Sat, 28 Apr 2007, 14:58
Blitz3Dman
ARG my head hurts...

can the demo version load .png?

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sat, 28 Apr 2007, 15:09
bram32
No, the demo can't load images.
In the manual it says:
The demo version of Blitz Basic supports BMP files; the full retail version of Blitz Basic supports JPG and PNG format as well

However, this host:
imageho.st/
allows for .bmp
Sat, 28 Apr 2007, 15:11
Blitz3Dman
How about B3D?
Sat, 28 Apr 2007, 15:14
bram32
Ow .. ah, I didn't see that .. I have b3d, so I suppose they mean that.
Sat, 28 Apr 2007, 15:57
Blitz3Dman
Oh...

well, I suppose sownloading them, storing in a file that it's been downloaded so it doesn't continue to do it each execution would be interesting.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 04:56
Paul
This doesn't solve the original problem with downloading the files though.
If anyone has any ideas on how to make get the downloading to work then i'd like to know... please
Sun, 29 Apr 2007, 05:54
Blitz3Dman
If anybody can find webpages that specifically are for file structure of images and are easy to understand and will tell me they are saved as a byte, a short, a long (which hopefully not cause I'd also need to write a function for blitz to read and write longs ), an integer, a string, or a float, or somthing mysterious that's not any of those, and has an English explanation of what it does, I'll try and work on the program to read that image format.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 07:32
bram32
@Paul, try the BlitzGet function. I seem to be able to download the file with it. The link is in the second post of this thread.
@Blitz3Dman, maybe I don't understand the problem correctly, but if you upload a bitmap to that page, right-click on the picture, choose properties and copy the url, you can download the file as a .bmp.
If you want to download the file directly into memory: the data in a BMP file can be read as bytes. If you save it as a 24-bit bitmap, each byte is one color channel (RGB). However, you would need to skip the header information first. You can look up the size of the BMP header in google.

Another approach would be taking a look at BlitzGet. It works in the same manner as the above code, but it strips the TCP header information to read the size of the file, and it is capable of downloading the BMP onto disk without modifying the code.
With the command 'FileType' you can check if the file is downloaded allready. I have to go now, but if you still have trouble with it I could maybe help later on.
Sun, 29 Apr 2007, 07:37
Blitz3Dman
Hmm... what I mean is, I want to make a command exactly the same as loadimage, and then loadanimimage which, instead of checking for the file on your disk, it finds it online and stores it in memory. Not on your computer but for example, loadimage reads an image once and then you can do whatever with it. I want this command to grab an online image so people can make small games with no images in the file because they uploaded them to the internet, take, for example, using the {img} tag. It finds the online data and constructs an image from it. THat's exactly what I want to do, except in Blitz. In fact, if Jayenkai doesn't mind, I think I'd like to have a peek at the web code used to do that.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 10:04
Paul
Ill have a look at the glitzget and get back when(and if) i get anything working

|edit|
yay, got it to work, don't see the reason to use anything else since this seems to work better than anything I could do.
Sun, 29 Apr 2007, 13:54
bram32
Here, this is what I got so far .. it downloads a .bmp from somewhere (files from imageho.st didn't work ) and draws it onto the screen with writepixelfast:

Sun, 29 Apr 2007, 14:02
Blitz3Dman
Alright, there's .bmp!

except, it didn't seem to be detecting the imageheight and width bytes...

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 14:18
Blitz3Dman
Ok, I've done some tests and concluded that image width and height are stored as shorts in bytes 20&21 and bytes 24&25, respectively.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 14:19
bram32
(edit) Ah .. okay .. you solved it .. Nice work !
Sun, 29 Apr 2007, 14:25
Blitz3Dman
Wait, hold on I think it uses bytes if it's under 256 wide or high, lemme do some more tests...

|edit| no, I think I had it right. now to find out what the other 20 or so bytes are for :/ |edit|

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 14:36
Blitz3Dman
Aha! Thank you, wikipedia! they are stored as integers in bytes 18,19,20,21 and 22,23,24,25.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 15:27
Blitz3Dman
ALRIGHT! WOOHOO!

Ok, the .bmp file format has been done.

this reads an image on the drive. I'm implementing it into the online function now.



And this is the online code and it is great!

(and the image is supposed to be upside down like that, right?)



-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Sun, 29 Apr 2007, 18:36
bram32
nice .. you can flip the image using:
ScaleImage wwwimg, 1, -1
HandleImage wwwimg, 0, 0
Also, I think the r,b and g are reversed somehow.
But, it seems to work, so good job! Now all you need is a host for the picutres, right? Maybe you could try using ifastnet.com ? It is free and has no banners. It is possible to upload your images onto it.
Sun, 29 Apr 2007, 20:36
JL235
It's probably upside down because the lines in a .bmp are stored in reverse order. The data in the line itself is not stored in reverse order (I think it's like that), just the order of the lines.

So the first line you read is actually the last, and the last is actually the first.

I'd also recommend that you draw the image correctly, rather then use scale image to flip it. Using scale image may cause artifacts in the image, and it will be slower.
Mon, 30 Apr 2007, 05:06
Blitz3Dman
Yea, I just found that out. And imageho.st does work!

the values are stored bgr and from top to bottom.

|edit| bottom to top, I mean |edit|





|edit| I was using imageheight instead of width when subtracting to draw bottom to top. I've fixed that now.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Mon, 30 Apr 2007, 05:26
Paul
Nice, Works perfectly here
Mon, 30 Apr 2007, 06:17
Jayenkai
Lately we've learned that the speed some things run is ludicrously different, depending on the system. But.. Is that program really supposed to take that long?



Things are quicker if you Bulk-Read, so I re-wrote a little section to buffer 2500 * 3's, then draw, then repeat.
(Hope you don't mind)

-=-=-
''Load, Next List!''
Mon, 30 Apr 2007, 06:24
Blitz3Dman
Yes, I know it's that slow , and I was going to speed it up a bit after I finished my WW entry.

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Mon, 30 Apr 2007, 06:32
Jayenkai
That's good to know.. I was worried my PC might be doing odd things, but at least it's not drawing 30 seconds after it's meant to have finished

-=-=-
''Load, Next List!''
Mon, 30 Apr 2007, 13:49
Blitz3Dman
Watch the debuglug, it tells you what's happening

-=-=-
There are 10 kinds of people in this world -

( Insert 16 remarks about to what extent people know hex here )
Page : 1 Prev 2
Next