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 

TImage Appending Images

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





PostPosted: Fri Oct 27, 2006 7:00 pm    Post subject: TImage Appending Images Reply with quote



Guys,
I have a TImage in my program. It loads images from TWAIN
(Scanner). It works!

But now I need to input two pages within the same file.
What happen? I call the scanner and it send the image of the first page
to my TImage. Itīs right! But what I need is to append the 2nd page to
the same Timage, creating one unique file, with both images inside.
Like bellow:

TImage := Page 1 Page 2 TImage := TImage +
Page2;
---------------- ----------------
--------------------------------
| | | | |
|
| | | | |
A |
| A | + | B | = |
------------------------------ |
| | | | |
|
| | | | |
B |
---------------- ----------------
--------------------------------

Is there anyway to create it?

Thank you,

Alexandre Moraes
Back to top
Marcelo Grossi
Guest





PostPosted: Fri Oct 27, 2006 7:23 pm    Post subject: Re: TImage Appending Images Reply with quote



There was a post with the same inquiry, look for "2 images into 1". Its just
a few posts up from this one ...

Basically you have to create a TGraphic big enough to fit both pages and
then assign it to the TImage. The answer to that post I mentioned is as
follows:

"Ken" <ninken (AT) gmail (DOT) com> wrote in message
news:452d0d9d$1 (AT) newsgroups (DOT) borland.com...
Quote:
I'm looking to take 2 bmp images size 320x240 and put them side by side as
one bmp image.

How would I go about doing this? I've tried streaming them to a new bmp
image, but got no where
with it!

Make a new bitmap 640x240 in size, and canvas.draw() both of them on it?"


Cheers,

Marcelo Grossi

"Sanmoraes" <sanmoraes (AT) ig (DOT) com.br> escreveu na mensagem
news:1161957642.128535.41920 (AT) h48g2000cwc (DOT) googlegroups.com...
Guys,
I have a TImage in my program. It loads images from TWAIN
(Scanner). It works!

But now I need to input two pages within the same file.
What happen? I call the scanner and it send the image of the first page
to my TImage. Itīs right! But what I need is to append the 2nd page to
the same Timage, creating one unique file, with both images inside.
Like bellow:

TImage := Page 1 Page 2 TImage := TImage +
Page2;
---------------- ----------------
--------------------------------
| | | | |
|
| | | | |
A |
| A | + | B | = |
------------------------------ |
| | | | |
|
| | | | |
B |
---------------- ----------------
--------------------------------

Is there anyway to create it?

Thank you,

Alexandre Moraes
Back to top
Sanmoraes
Guest





PostPosted: Sun Oct 29, 2006 7:03 pm    Post subject: Re: TImage Appending Images Reply with quote



Marcelo, thank you for your answer, but this is the problem!!!

How could I do that? I really donīt know. Iīve tried with Canvas, but
the top I got was to place the second page upon the page 1. I need one
after other. I talked about two page, but Iīll have cases with 10
pages and more.

Regards,

Alexandre Moraes

------------------------------------------------------------------------------------

Marcelo Grossi escreveu:

Quote:
There was a post with the same inquiry, look for "2 images into 1". Its just
a few posts up from this one ...

Basically you have to create a TGraphic big enough to fit both pages and
then assign it to the TImage. The answer to that post I mentioned is as
follows:

"Ken" <ninken (AT) gmail (DOT) com> wrote in message
news:452d0d9d$1 (AT) newsgroups (DOT) borland.com...
I'm looking to take 2 bmp images size 320x240 and put them side by side as
one bmp image.

How would I go about doing this? I've tried streaming them to a new bmp
image, but got no where
with it!

Make a new bitmap 640x240 in size, and canvas.draw() both of them on it?"


Cheers,

Marcelo Grossi

"Sanmoraes" <sanmoraes (AT) ig (DOT) com.br> escreveu na mensagem
news:1161957642.128535.41920 (AT) h48g2000cwc (DOT) googlegroups.com...
Guys,
I have a TImage in my program. It loads images from TWAIN
(Scanner). It works!

But now I need to input two pages within the same file.
What happen? I call the scanner and it send the image of the first page
to my TImage. Itīs right! But what I need is to append the 2nd page to
the same Timage, creating one unique file, with both images inside.
Like bellow:

TImage := Page 1 Page 2 TImage := TImage +
Page2;
---------------- ----------------
--------------------------------
| | | | |
|
| | | | |
A |
| A | + | B | = |
------------------------------ |
| | | | |
|
| | | | |
B |
---------------- ----------------
--------------------------------

Is there anyway to create it?

Thank you,

Alexandre Moraes
Back to top
JD
Guest





PostPosted: Sun Oct 29, 2006 10:54 pm    Post subject: Re: TImage Appending Images Reply with quote

"Sanmoraes" <sanmoraes (AT) ig (DOT) com.br> wrote:
Quote:

How could I do that?

I would suggest that you use a temporary TBitmap that you
later Assign to the TImage.Picture and then destroy.

Let's assume the all of the source images are 10x20. If you
have 2 images, the TBitmap needs to be sized to 20x40 to
accomidate them.

Now, certainly you can see how to calculate where the images
should go inside the TBitmap so all you need to do if set a
TRect that describes the target area. For example, the first
would be Rect(0,0,19,39) and the second would be (20,0,39,39).

Now use the same method to describe a TRect for the source
Rect(0,0,19,39).

Now use TCanvas.CopyRect.

Quote:
[...] I talked about two page, but I'll have cases with 10
pages and more.

Well, that's a different animal because bitmaps have a limit.
I would suggest that instead of the above approach, you use a
TScrollBox with a TPaintBox. Size the TPaintBox to be the same
as the combined images, position it at (0,0) and add an
OnPaint event to it.

In the OnPaint event, you would use TCanvas.CopyRect just like
the above but with a little complex approach. You'll need to
check the TScrollBox's horizontal scroll position to calculate
the TRect's and determine which image to use as the source.

~ JD
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.