Thread

Little Help, Big Thanks (Sdk)

Little Help, Big Thanks // Sdk

1  |  

rough diamond

Apr 26, 2001, 8:57pm
Sure, this is a little detail for people who have experience, but after two
weeks and a couple thousand lines of code, 7 errors don't make me glad.
Especially when they're from a downloaded library, not my code.

C:\AShot\Test\Test.cpp(280) : error C2227: left of '->sy' must point to
class/struct/union

I know it looks like it comes from Test.cpp, but this is really a problem
with the gd graphics library. Anyone with experience wanna tell me what's
wrong?

-RD

ananas

Apr 26, 2001, 9:46pm
I already told you it is not an error in GD.

Check the syntax of gdImageSX(), the argument is not of
the required type. It needs an image handle I think, not
an integer.

loaded = gdImageGetPixel(in, gdImageSX(int(current->x/78.125)),
gdImageSY(int(current->y/78.125)) );

this makes not too much sense. I can only guess what you want
to do, maybe something like this :

loaded = gdImageGetPixel(in, int (gdImageSX(in) / 78.125),
int (gdImageSY(in) / 78.125) );


[View Quote] --
"_
|
/\
\ /
__/ /_

rough diamond

Apr 26, 2001, 10:14pm
So you can understand... current->x is their placement in the world, and
/78.125 is what it'll take to fit it on to a 256x256 pixel JPEG.... what I
was imagining this would do was make integer "loaded" equal to the color at
X, Y, where x is current->x/78.125 (int'd in case the division comes out
unevenly), and y is the same. I'm pretty sure I'm using it right, tho may be
wrong.
-RD
[View Quote]

ananas

Apr 26, 2001, 10:39pm
From gd.h :

#define gdImageSX(im) ((im)->sx)
#define gdImageSY(im) ((im)->sy)

This clearly tells me that these two macros want a
gdImageStruct pointer, not an integer as you supply it.

The two macro functions return the total size of the
image and do not know anything about your x and y.

Reading your description it sounds as if you should
have written it like this :

loaded = gdImageGetPixel(in, int(current->x/78.125),
int(current->y/78.125) );

The total size of the image is supplied in the first
argument of gdImageGetPixel(), this information is part
of the (gdImageStruct *) in - at least "in" should be
of this type.

[View Quote] --
"_
|
/\
\ /
__/ /_

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn