Solved

Using ExtCreateRegion

Posted on 1998-11-23
1,102 Views
Hi.
I'm looking for simple example using ExtCreateRegion.
I don't know how to parse the rectangles to this functions.
3 rectangles will be enough to demonstrate this problem.
Thanx!
0
Question by:Aleq
• 2

LVL 5

Expert Comment

ID: 1347701
0

LVL 5

Accepted Solution

ronit051397 earned 50 total points
ID: 1347702
"...Here is some sample code (it is not optimized):

FRegion:=CreateRectRgn(0,0, 0,0);
try
for i:=0 to FBitmap.Height-1 do
begin
for j:=R.Left to R.Right-1 do
begin
C:=FBitmap.Canvas.Pixels[j,i];
if C<>TransColor then
begin
Rgn1:=CreateRectRgn(j-R.Left,i,succ(j-R.Left),succ(i));
Rgn2:=CopyRgn(FRegion);
CombineRgn(FRegion,Rgn2,Rgn1,RGN_OR);
DeleteObject(Rgn1);
DeleteObject(Rgn2)
end
end
end
except
DeleteObject(FRegion);
FRegion:=0
end

Here is CopyRgn function:

function CopyRgn(Rgn:hRgn):hRgn;
var RData:PRgnData;
sz:integer;
begin
Result:=0;
if Rgn=0 then exit;
sz:=GetRegionData(Rgn,0,nil);
if sz=0 then exit;
GetMem(RData,sz);
try
GetRegionData(Rgn,sz,RData);
Result:=ExtCreateRegion(nil,sz,RData^);
finally
FreeMem(RData)
end;
end;
."
0

Featured Post

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.