new Stretch Method, Stretch a Trapezoid but not a Retangle.

new Stretch Method,  Stretch a Trapezoid  but not a Retangle.

i have been looking codes to Stretch a Trapezoid for a long time. Is there anyone can help me ?

i have a bitmap(ABmp), i draw a Trapezoid(Trapezoid_A) on it, the top and the bottom of the Trapezoid  always parallel

Y_axis,

then i move the top of the Trapezoid   to any position(the length of the top keeps no change,and it always parallel Y_axis ).

now  a new Trapezoid(Trapezoid_B) formed by old bottom and the new top(the area of Trapezoid_B may less /more than the area

of Trapezoid_A ). what i need is Stretch Trapezoid_A into Trapezoid_B.

the function may like this
//****************************************************************
NewStretch(ABmp:TBitmap;                      //the source bitmap
           ATrapezoid:Array of TPoint;     //Old Trapezoid
           BTrapezoid:Array of TPoint;     //New Trapezoid
           BBmp:TBitmap                       //the Dest bitmap
           )
//****************************************************************

by the way, the speed of the function is important, i have wrote one ,but it's too slow to use.
and you can use any component.

could you give me the code?

thank you in advance
bloodbirdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel PASQUIERFreelance Project ManagerCommented:
that is not very clear. What do you want ? to stretch the ATrapezoid shape in ABmp into BTrapezoid in BBmp ?
If ATrapezoid and BTrapezoid can be ANY kind of 4-points array, this would involve arduous calculation.
If you limit that to 2 sides // to X-axis (not Y, as you say it's top & bottom of it), then it would be better to say that your parameters are not 2 4-arrays of points but :

    x1,y1 ---x2
  /               |  h
x3______x4

describing your 1st trapezoid, and DX, DH the transformation where the new trapezoid would be :
x1'=x1+DX
y1'=y1+DH
x2'=x2+DX
// and since bottom line does not move :
x3'=x3
x4'=x4

which means that this is a normal stretch in height followed by a side-way shift (I don't know the correct term for this, think about pisa tower)

is that correct ?

what happens to other pixels (outside the trapezoid) in you dest bitmap ? all white ? what kind of pixel transformation do you want : closest pixel from source, pixel color calculation based on pixel resize & blending ? This alone will have huge impact on the quality of the result and the time to compute
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bloodbirdAuthor Commented:
epasquier:  i am very sorry for response you so slowly , that's because i post this question in a wrong place, i should post it in delphi programming zone ,this is the realted link
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_25688579.html

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.