Solved

Using ExtCreateRegion

Posted on 1998-11-23
2
1,126 Views
Last Modified: 2010-10-05
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
Comment
Question by:Aleq
  • 2
2 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1347701
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1347702
Hi Aleq, I post this article from Borland's groups as an answer:
"...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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 80
Correct Component for Shopping Cart. 2 105
I want to use librsync in my Delphi backup application. 3 50
DBCtrlGrid, Delphi, Scroll 8 14
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question