transferring GDI attributes.

This is a discussion on transferring GDI attributes. within the Windows Programming forums, part of the Platform Specific Boards category; I have a situation where I need to copy the GDI attrb's of one HDC to another, but I'm seeing ...

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,657

    transferring GDI attributes.

    I have a situation where I need to copy the GDI attrb's of one HDC to another, but I'm seeing no way to do this. I even tried this (though I knew it wouldn't work):

    Code:
    int saved = SaveDC(hdc);
    RestoreDC(another, saved);
    Any ideas?



    ITSA
    Socket Library!

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I'm a little surprised that your method didn't work. I suppose you will have to do them one at a time instead.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,657
    Unfortunately, you're probably right.



    ITSA
    Socket Library!

  4. #4
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    What are you trying to do? Render to a 'compatible' DC? If so just try this from MSDN:
    The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device.

    HDC CreateCompatibleDC(
    HDC hdc // handle to DC
    );
    Parameters
    hdc
    [in] Handle to an existing DC. If this handle is NULL, the function creates a memory DC compatible with the application's current screen.
    Return Values
    If the function succeeds, the return value is the handle to a memory DC.

    If the function fails, the return value is NULL.

    Windows NT/2000/XP: To get extended error information, call GetLastError.

    Remarks
    A memory DC exists only in memory. When the memory DC is created, its display surface is exactly one monochrome pixel wide and one monochrome pixel high. Before an application can use a memory DC for drawing operations, it must select a bitmap of the correct width and height into the DC. To select a bitmap into a DC, use the CreateCompatibleBitmap function, specifying the height, width, and color organization required.

    When a memory DC is created, all attributes are set to normal default values. The memory DC can be used as a normal DC. You can set the attributes; obtain the current settings of its attributes; and select pens, brushes, and regions.

    The CreateCompatibleDC function can only be used with devices that support raster operations. An application can determine whether a device supports these operations by calling the GetDeviceCaps function.

    When you no longer need the memory DC, call the DeleteDC function.

    ICM: If the DC that is passed to this function is enabled for Independent Color Management (ICM), the DC created by the function is ICM-enabled. The source and destination color spaces are specified in the DC.

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,657
    No, I'm talking about transferring GDI attributes, such as the raster, fill, and mapping modes, etc.



    ITSA
    Socket Library!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows GDI vs. Java Graphics
    By Perspective in forum Windows Programming
    Replies: 7
    Last Post: 05-07-2007, 10:05 AM
  2. MURK - a small preview
    By Mario F. in forum Game Programming
    Replies: 27
    Last Post: 12-18-2006, 07:22 AM
  3. GDI object lifetime and C++ object lifetime
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 06-16-2006, 05:26 AM
  4. Unable to List Files Attributes on EXT2
    By Maragato in forum C Programming
    Replies: 16
    Last Post: 08-11-2004, 12:30 PM
  5. Whats Peoples Problem With the GDI?
    By MicroFiend in forum Game Programming
    Replies: 6
    Last Post: 07-28-2003, 07:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21