[Gdiplus 11/15] Implement GdipCreateRegionRect

Huw Davies huw at codeweavers.com
Wed Jul 9 09:41:36 CDT 2008

On Wed, Jul 09, 2008 at 11:58:23AM +0100, Huw Davies wrote:
> This doesn't look right.  See the GdipGetRegionData tests (and extend
> them to add paths), these are supposed to help understanding how
> regions are stored.  It looks to me that a region is stored as a
> sequence of rects and paths that are combined with various CombineMode
> ops.

Hi Adam,

In fact you want to store the region elements as a binary tree,
something like this:

typedef enum element_type
    rect_element = 0x10000000,
} element_type_t;

typedef struct region_element
    DWORD type_or_op; /* One of the CombineModes or element_type_t */
        GpRectF rect;
        GpPath *path;
            struct region_element *first;
            struct region_element *second;
        } operands;
    } elem_data;
} region_element_t;

struct GpRegion
    region_element_t root;

A region element is either a rect, path or a combining op (in which
case it has two children, 'first' and 'second').  The data returned by
GdipGetRegionData is then basically what happens if you walk the tree,
favouring the 'first' node at every branch.

Does that make sense?

Huw Davies
huw at codeweavers.com

More information about the wine-devel mailing list