Double to int errors

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Double to int errors

Post by chili » July 5th, 2012, 2:12 pm

Hehe, in most cases there probably won't be that much of a difference LuX, so don't worry about it. ;)

About the file sizes
Think about it: a pixel in ram is 4 bytes, whereas the text string "0xFF544437" is 10 chars = 10 bytes. What's wrong with saving the file as a .png?
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Double to int errors

Post by Asimov » July 5th, 2012, 2:23 pm

Hi Lux,

If the image you are converting is maybe a jpg or png they are compressed fileformats. Perhaps the file you are saving out is uncompressed which would give you an increase in file size.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Double to int errors

Post by LuX » July 5th, 2012, 2:31 pm

chili wrote:What's wrong with saving the file as a .png?
Nothing... Just... experimenting. I like pixels and hex system, I want to try things out with them. I was wondering if I could load the text file pixels directly to D3DCOLOR.

@Asimov, I converted a .bmp, but the difference of the same picture in jpg or png is only marginal.



I took a look what the internet has to offer an I found this: ofstream img ("Image.hex", ios::hex); Should save the image in hex format, rather than actual characters. I tried it, but I doesn't seem to generate a file for me... Same with "ios::binary" works, but that makes the file even bigger : -/
ʕ •ᴥ•ʔ

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Double to int errors

Post by LuX » July 5th, 2012, 2:43 pm

This actually gave me an idea, to the old method where we added images as a list of put pixels, how about no upload them as a list of pixel to buffer like: "gfx.ImageBuffer[0] = 0xFFFF1616;" and so on. It's probably smarter to add resource files, but a nice alternative? All you needed to do is make a separate class to hold the lists and then call them on initialization.
ʕ •ᴥ•ʔ

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Double to int errors

Post by Asimov » July 5th, 2012, 3:52 pm

Hi Lux,

Have you tried adding a resource file and loading it with Gdi, it ain't easy. I have been tryiing for weeks LOL. There are very few resources on the net to help with this as well LOL.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Double to int errors

Post by chili » July 6th, 2012, 9:05 am

You guys need to work harder at your Google-fu. :lol:
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Double to int errors

Post by Asimov » July 6th, 2012, 10:27 am

Hi Chill,

My google-fu keeps getting directed to this page
http://www.codeproject.com/Articles/353 ... -using-GDI

but I don't understand a word of it LOL.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Double to int errors

Post by chili » July 6th, 2012, 11:32 am

Looks like a good page to me. ;)
Chili

Post Reply