Skip to main content
GameDev.net gamedev.net
🔒 Locked

Compiler calling wrong overloaded functions?

Started by VanillaSnake21 Apr 2, 2009 at 4:10 PM 7 replies 1.3k views
Original Post
VanillaSnake21
VanillaSnake21
I'm using GDI+ and I'm trying to call DrawImage() with ImageAttributes, this is what my call looks like:

grx.DrawImage(ImgIter->second.pImage, (Gdiplus::RectF*)&rc, ImgIter->second.XPos,ImgIter->second.YPos, ImgIter->second.Width, ImgIter->second.Height, Gdiplus::UnitPixel, &ia);
I get this error:


error C2664: 'Gdiplus::Status Gdiplus::Graphics::DrawImage(Gdiplus::Image *,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::REAL,Gdiplus::Unit)' : cannot convert parameter 2 from 'Gdiplus::RectF *' to 'Gdiplus::REAL'
As you can see the compiler is calling the version with almost all Reals as params, but thats not what I'm passing to the function. I tried explicitly naming (casting to themselves) the parameters, but still nothing. What could be causing this?
You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts
SiCrane
SiCrane
Graphics::DrawImage() has 18 overloads. Only one of them accepts a RectF * as the second argument, and it takes 6 parameters, not 8.
VanillaSnake21
VanillaSnake21
Quote:
Original post by SiCrane
Graphics::DrawImage() has 18 overloads. Only one of them accepts a RectF * as the second argument, and it takes 6 parameters, not 8.


So why is intellisense only showing me 16? I followed one of the layouts (version 12) that intellisense gave me.
You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts
Zahlman
Zahlman
Okay, I'll bite. What overloads does Intellisense list?
VanillaSnake21
VanillaSnake21
Quote:
Original post by Zahlman
Okay, I'll bite. What overloads does Intellisense list?


Umm, you want me to list all of them?
I'll just tell you the one I followed:

DrawImage(Gdiplus::Image*, Gdiplus::RectF, Gdiplus::REAL srcx, Gdiplus::REAL srcy, Gdiplus::REAL srcwidth, Gdiplus::REAL srcheight, Gdiplus::Unit, Gdiplus::ImageAttributes, Gdiplus::DrawImageAbbort callback = 0, void* callbackData = 0)
You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts
SiCrane
SiCrane
RectF != RectF *
VanillaSnake21
VanillaSnake21
Quote:
Original post by SiCrane
RectF != RectF *


lol... well actually int the intellisense version it says Rect&, but I was passing it a pointer, I hate these small mistakes. Thanks :)
You didn't come into this world. You came out of it, like a wave from the ocean. You are not a stranger here. -Alan Watts
Zahlman
Zahlman
What exactly is 'rc', then? Have you considered that the function expects the value by (non-const) reference because it expects to change the underlying data?
SiCrane
SiCrane
Actually, all the DrawImage() overloads that accept RectF references use const references.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.