BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I crop non-rectangle region of bitmap?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Byungho Jeon
Guest





PostPosted: Mon Jun 21, 2004 5:05 am    Post subject: How can I crop non-rectangle region of bitmap? Reply with quote



Hi all..

I want to cut non-rectangle region of bitmap!!!
User select several point of bitmap, then cut it to new bitmap!!

It seams like `extract out-line of picture`!!!(I don't know right graphics
term!! teach me...please)
What algorithm used to implementation it?? If you can, show me the example
or releated link..

thank you for reading!!



Back to top
Peter Below (TeamB)
Guest





PostPosted: Mon Jun 21, 2004 6:09 pm    Post subject: Re: How can I crop non-rectangle region of bitmap? Reply with quote



In article <40d66c76$1 (AT) newsgroups (DOT) borland.com>, Byungho Jeon wrote:

Quote:
I want to cut non-rectangle region of bitmap!!!
User select several point of bitmap, then cut it to new bitmap!!

It seams like `extract out-line of picture`!!!(I don't know right graphics
term!! teach me...please)
What algorithm used to implementation it?? If you can, show me the example
or releated link..

You can do this by creating a clipping region from the polygon the user
created.

You start out with the points the user defined in an array of TPoint. From
that you create a region, using the Windows.CreatePolygonRgn function. If
the area on the target bitmap where the content of this polygon should end
up is not in the same place as on the source bitmap you move this region to
the proper coordinates using the OffsetRgn API function. Then use
SelectClipRgn on the target bitmap.canvas.handle to establish the clipping
region. You can now use the CopyRect method of the canvas to copy a
rectangular area of the source bitmap to the target bitmaps canvas. All
points outside the clipping region will not be changed by this operation.

To clean up you call SelectClipRgn with 0 as handle on the
bitmap.canvas.handle (this removes the clipping region) and call
Windows.DeleteObject on the region handle.

Search the newsgroup archives for the API functions mentioned to find
examples of use. Also check Earl Glynns Delphi pages, he has quite a number
of examples on graphics handling:

Earl Glynns Delphi pages
http://www.efg2.com/Lab/Library/Delphi
http://homepages.borland.com/efg2lab

Oh, you own the TeamB retirement fund $30 for excessive use of exclamation
points in a newsgroup post (I counted 6 extras at $5 each). <g>

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be



Back to top
Byungho Jeon
Guest





PostPosted: Tue Jun 22, 2004 6:07 am    Post subject: Re: How can I crop non-rectangle region of bitmap? Reply with quote




"Peter Below (TeamB)" <100113.1101 (AT) compuXXserve (DOT) com> wrote

Quote:
In article <40d66c76$1 (AT) newsgroups (DOT) borland.com>, Byungho Jeon wrote:

I want to cut non-rectangle region of bitmap!!!
User select several point of bitmap, then cut it to new bitmap!!

It seams like `extract out-line of picture`!!!(I don't know right
graphics
term!! teach me...please)
What algorithm used to implementation it?? If you can, show me the
example
or releated link..

You can do this by creating a clipping region from the polygon the user
created.

You start out with the points the user defined in an array of TPoint. From
that you create a region, using the Windows.CreatePolygonRgn function. If
the area on the target bitmap where the content of this polygon should end
up is not in the same place as on the source bitmap you move this region
to
the proper coordinates using the OffsetRgn API function. Then use
SelectClipRgn on the target bitmap.canvas.handle to establish the clipping
region. You can now use the CopyRect method of the canvas to copy a
rectangular area of the source bitmap to the target bitmaps canvas. All
points outside the clipping region will not be changed by this operation.

To clean up you call SelectClipRgn with 0 as handle on the
bitmap.canvas.handle (this removes the clipping region) and call
Windows.DeleteObject on the region handle.

Search the newsgroup archives for the API functions mentioned to find
examples of use. Also check Earl Glynns Delphi pages, he has quite a
number
of examples on graphics handling:

Earl Glynns Delphi pages
http://www.efg2.com/Lab/Library/Delphi
http://homepages.borland.com/efg2lab

Oh, you own the TeamB retirement fund $30 for excessive use of exclamation
points in a newsgroup post (I counted 6 extras at $5 each). <g

--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

==> thank you for reply Peter!!


I try to use your solution!! So.. What is mean this words..

"Oh, you own the TeamB retirement fund $30 for excessive use of exclamation
points in a newsgroup post (I counted 6 extras at $5 each). <g>"

Am I must pay TeamB retirement fund $30? Or just a joke?
I don't understand exactly!!

Regards



Back to top
Joris Van Damme
Guest





PostPosted: Tue Jun 22, 2004 9:47 am    Post subject: Re: How can I crop non-rectangle region of bitmap? Reply with quote

"Byungho Jeon" <enlight (AT) netian (DOT) com> wrote

Quote:
So.. What is mean this words..

"Oh, you own the TeamB retirement fund $30 for excessive use of
exclamation
points in a newsgroup post (I counted 6 extras at $5 each). <g>"

It's Peter's (very funny) way of saying that the exclamation marks aren't
all that necessary.

Now you also own AWare Systems at least $30 for overquoting (= quoting many
dozens of lines, to only add a few of your own, which is regarded
inefficient use of bandwidth, and does not make pleasent reading). <g>

Quote:
I don't understand exactly!!

See that '<g>' appended to what Peter said? It is a 'joke marker'. Most
people append it even if they do not mean things to actually be funny,
though, but want to disarm you and don't want you to respond seriously.
Above two <g>'s enable us nagging without you telling us we are, as does
this one: <g>.

If you'd like to read up on what exactly it is that makes us old-timers
start nagging and appending '<g>', Google on 'netiquette'. You'll quickly
see that it's not just about 'protocol', but also aids in ensuring efficient
communication.


Have a nice day,

Joris Van Damme
[email]info (AT) awaresystems (DOT) be[/email]
http://www.awaresystems.be
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html



Back to top
Nils Haeck
Guest





PostPosted: Tue Jun 22, 2004 1:55 pm    Post subject: Re: How can I crop non-rectangle region of bitmap? Reply with quote

Quote:
==> thank you for reply Peter!!

I try to use your solution!! So.. What is mean this words..

"Oh, you own the TeamB retirement fund $30 for excessive use of
exclamation
points in a newsgroup post (I counted 6 extras at $5 each). <g>"

Am I must pay TeamB retirement fund $30? Or just a joke?
I don't understand exactly!!

Regards



Why don't you understand?????????? I understand it perfectly!!!!!!!!!

(yes I'll donate to the TeamB retirement fund)

Kind regards,

Nils



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.