Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

105 Neutral

About programering

  • Rank
    Advanced Member

Personal Information

  • Interests
  1. programering

    [ Win32 | DevIL ] Cannot get ilutWinLoadImage to work

    Turns out that I found the documented solution for this problem while goggling once again though I took myself a long time to try looking(through numerous unsuccessive search queries) for it and solving it by myself before starting this topic. So typical. But I'll provide the source for it so that others that might encounter the same problem can benefit from this one: via http://forums.codegu...SetBitmapBits() Now Solved. Edit: Actually the solution will be in this case: (the correct Win32 API call procedures to get ilutWinLoadImage to work) hdc = GetDC(NULL); // or: hdc = l_hWndDC; hdcMem = CreateCompatibleDC(hdc); hBitmap = ilutWinLoadImage(L"TheImage.bmp",hdc); // <-- a HDC retrieved by GetDC of your destination DC, Not by CreateCompatibleDC. SelectObject(hdcMem, hBitmap); BitBlt(l_hWndDC,100,100,240,40,hdcMem,0,0,SRCCOPY); // And don't forgetting to release and delete the respective HDC's when done with them.
  2. Hi. I am having a trouble to properly load an image with the DevIL's ilutWinLoadImage(hDC)function. On my first attempt with displaying the loaded image it didn't show up at all. But later I managed to get the image to display but now just in black&white though it originally is in colors. Here is an approximately holistic idea of how I try to get it to work, taken from my originally very messed up code: In my function that loads the image HBITMAP/HDC: m_hImageDC = CreateCompatibleDC(NULL); // Seemed to be required before passing it. m_hImageBmp = ilutWinLoadImage(L"TheImage.bmp",m_hImageDC); SelectObject(m_hImageDC, m_hImageBmp); // <-- This was added in the second attempt which got it to show up, but just in b&w. In the WindowProc's WM_PAINT msg of the window to display the image: case WM_PAINT: l_hWndDC = BeginPaint(p_hWnd, &paintstruct); BitBlt(l_hWndDC, 100, 100, 240, 40, l_drawContext->GetTheImageHDC(), 0, 0, SRCCOPY); EndPaint(p_hWnd, &paintstruct); What procedures(additionally Win32 function calls) do you usually have to make to get this ilutWinLoadImage(hDC) to work as it is supposed to? Thanks.
  3. programering

    Static allocated smart pointer

    Quote:Original post by jyk What language(s) do you have in mind? C Plus Plus of coarse. Quote:Original post by jyk Also, when and under what circumstances does the statically allocated object get deallocated? (And what precisely do you mean by statically allocated?) Can you give an example? For example if the object to be used for my smart pointer(ObjectToBeUsed) is an actual instance member within another object(SourceObject). That's what I thought statically allocation was(If that's right?). Like this: class SourceObject { ObjectToBeUsed testSource; // Its origin is here. }; So when a SourceObject instance is deallocated, a such smart pointer of mine with this testSource as target shall be notified and set its internal raw pointer to NULL. Is there a way to check if an address is deallocated?
  4. I've got an idea to invent a smart pointer for static allocated objects. I need it because I want the pointer itself to be reseted to NULL when the source it points to become deallocated. So is it possible to detect its deallocation.
  5. programering

    using shared_ptr from an actual object

    If it's global?
  6. If one have an actual object and a shared_ptr or any other boost smart pointer. Can one assign the shared_ptr from the actual object? Like so showed in this example: using namespace boost; // A class that contains the shared_ptr: class PtrContainer { PtrContainer() {} void set(SomeObject &refObj) { shared_ptr<SomeObject> ptrObj(&refObj); set(ptrObj); } void set(shared_ptr<SomeObject> ptrObj) { this->ptrObj = ptrObj; } shared_ptr<SomeObject> ptrObj; }; // Usage: int main(int argc, char *argv[]) { SomeObject actualObject; // The actual object. PtrContainer ptrContainer; ptrContainer.set(actualObject); return 0; }
  7. programering

    smart pointer without COW feature

    But does any smart pointers uses COW then?
  8. programering

    smart pointer without COW feature

    I thought it have it when one other shared_ptr instance is modified.
  9. I need to know what boost smart pointer or what else to use. I would need such a kind as boost::shared_ptr but without the Copy On Write feature.
  10. programering

    UML program.

    I have begun to use Dia now and "drawing" my base code project structure. But what I don't know how to do is to set a member as static. How do I do that. It is translated into swedish though.
  11. programering

    UML program.

    Thanks for the info. I probably need such programs ease my development.
  12. programering

    UML program.

    Quote:Original post by freeworld google starUML, it's very clean (sorta ugly colors), but does very well. It was the one I've already had. But I didn't understand it.
  13. programering

    UML program.

    I think I need a simple UML modeling program for building up the technical structure for my projects. I've downloaded and tried StarUML but I didn't quite understand it. I've tried to find UML educational videos on youtube but didn't find any(Maybe I didn't use the right keywords). I know there's usual tutorials in text, but the fact is it is very difficult for me to read and they consists of very much text. So if you know of any educational tutorials or such in video format it would be very helpful. What I need is a simple begginer level UML modeling program or video tutorials that explain how to use those other more advanced standard level UML programs. Thanks.
  14. programering

    Alpha + alpha calculation

    Quote:Original post by DeathRay2K That can only reduce the alpha, whereas you want to increase it when you layer semi-transparent stuff. I think it's more like this: AlphaResult = AlphaBase + (255 - AlphaBase) * (AlphaAdditional / 255) I'm assuming by alpha you mean opacity and not transparency, so 255 is completely opaque, and 0 is completely transparent. Yes, that is exactly how I meant, and so is this. The way I figured it out now, is the way I realized it must be; That it only can reduce alpha is the logic when there comes an additional alpha. But thank you DeathRay for your contribution as an alternative. Rate+
  15. programering

    Alpha + alpha calculation

    I think it must be: AlphaResult = AlphaBase * (AlphaAdditional / 255);
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!