On Saturday, 24 June 2017 at 02:52:23 UTC, Felix wrote:
I'm trying to read in just the first part of a .png file to
peek at it's width and height without loading in the whole
file. I'm using FreeImage for reading the whole file but since
it doesn't have a function to let me peek at the image
On 6/24/17 1:18 AM, H. S. Teoh via Digitalmars-d-learn wrote:
On Fri, Jun 23, 2017 at 10:10:22PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
On 06/23/2017 09:26 PM, Felix wrote:
That works, thanks!
I've just tried this, which seems cleaner:
import std.stdio;
import std.system;
import
On 06/23/2017 10:18 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Fri, Jun 23, 2017 at 10:10:22PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
On 06/23/2017 09:26 PM, Felix wrote:
That works, thanks!
I've just tried this, which seems cleaner:
import std.stdio;
import std.system;
On Fri, Jun 23, 2017 at 10:10:22PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 06/23/2017 09:26 PM, Felix wrote:
> > That works, thanks!
>
> I've just tried this, which seems cleaner:
>
> import std.stdio;
> import std.system;
> import std.bitmanip;
>
> void ensureBigEndian(T)(ref T
On 06/23/2017 09:26 PM, Felix wrote:
That works, thanks!
I've just tried this, which seems cleaner:
import std.stdio;
import std.system;
import std.bitmanip;
void ensureBigEndian(T)(ref T value) {
if (endian == Endian.littleEndian) {
value = *cast(T*)nativeToBigEndian(value).ptr;
That works, thanks!
On 06/23/2017 07:52 PM, Felix wrote:
> So I'm guessing my ubytes are in the
wrong order in the uint... how should I put them around the correct way
so that my code won't break on another machine with different endianness?
Yes, that would happen when your system is little-endian. (According to
I'm trying to read in just the first part of a .png file to peek
at it's width and height without loading in the whole file. I'm
using FreeImage for reading the whole file but since it doesn't
have a function to let me peek at the image size before loading
it all in I'm rolling my own.
I've