How to exclude a rectangular area from another rectangular area

43 views
Skip to first unread message

li han

unread,
Jun 17, 2024, 10:45:30 AMJun 17
to fltk.general
Similar to this
```c++
Gdiplus::Graphics graphics(dcCompatible);

HRGN hgn1 = CreateRectRgn(m_rectTracker.m_rect.left,m_rectTracker.m_rect.top,
m_rectTracker.m_rect.right,m_rectTracker.m_rect.bottom);
Region region1(hgn1);

HRGN hgn2 = CreateRectRgn(rect.left,rect.top,
rect.right,rect.bottom);
Region region2(hgn2);

region2.Exclude(&region1);

SolidBrush  solidBrush(Color(100, 128, 128, 128));
graphics.FillRegion(&solidBrush,&region2);

DeleteObject(hgn1);
DeleteObject(hgn2);
```

Manolo

unread,
Jun 19, 2024, 6:05:11 AMJun 19
to fltk.general
If what you want to do with the HRGN object is to use it as a clip region, yes, you can
use FLTK function fl_clip_region(Fl_Region r)

It uses the operating system-specific type Fl_Region which is exactly HRGN under Windows.

Reply all
Reply to author
Forward
0 new messages