mix mode and processing the mix mode

This is a discussion on mix mode and processing the mix mode within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to process a variable called mix with type MIX: Code: MIX mix; According to the documentation, the information ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    222

    mix mode and processing the mix mode

    I'm trying to process a variable called mix with type MIX:
    Code:
    MIX mix;
    According to the documentation, the information mix contains the following description:
    The mix mode defines how the incoming pattern should be mixed with the data that is already on the device surface. The MIX data type consists of two binary raster operation (ROP2) values packed into a single ULONG. The lowest-order byte defines the foreground raster operation; the next byte defines the background raster operation. For more information about raster operation codes, see the Microsoft Windows SDK documentation.
    I'm guessing that this value contains 2 bytes, one to define the foreground raster operation, the other one to define the background raster operation. How would one separate mix into lower and upper byte and process the flags?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    memcpy it to a char array and read it.

    http://faq.cprogramming.com/cgi-bin/...&id=1043284351
    Last edited by robwhit; 07-22-2008 at 09:20 PM.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    That sounds kinda ambiguous. Isn't a ULONG 4 bytes, typically? In which case, either it means the lowest-order 'WORD', not 'byte'; or it means the upper 2 bytes are ignored/reserved.

    If it's the lowest 2 bytes, you can do:
    Code:
    BYTE low = (BYTE)mix;
    BYTE high = (BYTE)(0xff & mix);
    If it's divided into 2 WORDs, you can do:
    Code:
    WORD low = (WORD)mix;
    WORD high = (WORD)(0xffff & mix);
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    222
    I actually found some macros in the DDK that helped me processed what I wanted to do. Thank you all for your suggestions.

Popular pages Recent additions subscribe to a feed

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