-
September 22nd, 2020, 04:07 PM
#16
Re: how use PlgBlt() API function?
i'm trying now testing the function:
Code:
'Convert all 3D vectors to 2D vectors(for screen): Dim i As Integer
For i = 0 To 3
Points(i) = ConvertPositon3DTo2D(NewPosition3D(i), WorldSize)
Next i
'change the brush and pen:
'FillStyle = vbFSSolid
'FillColor = vbRed
DrawStyle = DrawStyleConstants.vbInvisible
Polygon Me.hDC, Points(0), 4
Dim points2(4) As POINTAPI
points2(0) = Points(0)
points2(1) = Points(1)
points2(2) = Points(2)
points2(3) = Points(3)
PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth , Picture1.ScaleHeight , &O0, &O0, &O0
i did several tests but i only get like a line on a diagonal
i changed the points but i continue with bad results.
the points order:
- points(0) is the low-left;
- points(1) is the upper-left;
- points(2) is the upper-right;
- points(3) is the low-right;
and yes i did too:
Code:
points2(0) = Points(1)
points2(1) = Points(2)
points2(2) = Points(3)
points2(3) = Points(0)
but i get diagonal white line result
so what i'm doing wrong?
-
September 23rd, 2020, 01:40 AM
#17
Re: how use PlgBlt() API function?
Did you try
Code:
PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth , Picture1.ScaleHeight , &O0, &O0, &O0
Last edited by Arjay; September 23rd, 2020 at 07:51 AM.
Reason: Fixed up ending code tag
Victor Nijegorodov
-
September 23rd, 2020, 05:15 AM
#18
Re: how use PlgBlt() API function?
yes
Code:
Dim points2(4) As POINTAPI
points2(0) = Points(0)
points2(1) = Points(1)
points2(2) = Points(2)
points2(3) = Points(3)
PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
Last edited by Cambalinho; September 23rd, 2020 at 05:24 AM.
-
September 23rd, 2020, 07:54 AM
#19
Re: how use PlgBlt() API function?
Originally Posted by Cambalinho
yes
Code:
Dim points2(4) As POINTAPI
points2(0) = Points(0)
points2(1) = Points(1)
points2(2) = Points(2)
points2(3) = Points(3)
PlgBlt Me.hDC, points2(0), Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
Your 2nd param is different than the points2 param that Victor suggested (points2(0) is not points2).
-
September 23rd, 2020, 07:58 AM
#20
Re: how use PlgBlt() API function?
Code:
PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
error by ref argument....
-
September 23rd, 2020, 09:05 AM
#21
Re: how use PlgBlt() API function?
Originally Posted by Cambalinho
Code:
PlgBlt Me.hDC, points2, Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0
error by ref argument....
Then sorry! I just thought in C++ categories.
Victor Nijegorodov
-
September 23rd, 2020, 09:27 AM
#22
Re: how use PlgBlt() API function?
correct me anotherthing: even if i fix it, the PlgBlt() can be used on a plane? or the results will be not what we expected?
i mean drawed the texture.. like create a street
-
October 4th, 2020, 03:45 PM
#23
Re: how use PlgBlt() API function?
finally i'm using it, but i'm getting the wrong shape width..
Code:
'Get the four vectors
'Floor:
'Vector1: low-left
FillPosition3D NewPosition3D(0), Position.X, Position.Y, Position.Z
NewPosition3D(0) = Rotate(NewPosition3D(0), Rotation, RotatedPosition)
'Vector2: upper-left
FillPosition3D NewPosition3D(1), Position.X, Position.Y, Position.Z + Size.ZDepth
NewPosition3D(1) = Rotate(NewPosition3D(1), Rotation, RotatedPosition)
'Vector3: upper-right
FillPosition3D NewPosition3D(2), Position.X + Size.Width, Position.Y, Position.Z + Size.ZDepth
NewPosition3D(2) = Rotate(NewPosition3D(2), Rotation, RotatedPosition)
'Vector4: low-right
FillPosition3D NewPosition3D(3), Position.X + Size.Width, Position.Y, Position.Z
NewPosition3D(3) = Rotate(NewPosition3D(3), Rotation, RotatedPosition)
'Convert all 3D vectors to 2D vectors(for screen):
Dim i As Integer
For i = 0 To 3
Points(i) = ConvertPositon3DTo2D(NewPosition3D(i), WorldSize)
Next i
'change the brush and pen:
FillStyle = vbFSSolid
'FillColor = vbRed
DrawStyle = DrawStyleConstants.vbInvisible
Polygon Me.hdc, Points(0), 4
Dim TexturePoints(3) As POINTAPI
TexturePoints(0) = Points(1) 'upper-left
TexturePoints(1) = Points(2) 'upper-right
TexturePoints(2) = Points(0) 'low-left
If (PlgBlt(Me.hdc, TexturePoints(0), Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, &O0, &O0, &O0) = 0) Then MsgBox CStr(GetLastError())
the results:
i belive that the problem is the low-right automatic calculation.
but tell me what i'm doing wrong
-
October 7th, 2020, 02:54 PM
#24
Re: how use PlgBlt() API function?
VictorN: even not be C code... what you think about the image?
heres a pseud-rectangle(A to D):
B |-----------|C
A |-----------| D
"A pointer to an array of three points in logical space that identify three corners of the destination parallelogram. The upper-left corner of the source rectangle is mapped to the first point in this array, the upper-right corner to the second point in this array, and the lower-left corner to the third point. The lower-right corner of the source rectangle is mapped to the implicit fourth point in the parallelogram."
- so the upper-left is B;
- the upper-right is C;
- the low-left is A;
- the low-right is D... but these one is calculated automatic...
the D is automatic, but seems wrong calculated(i move and the image go to C and it's correct, but not D)... why? what i did wrong?
-
October 8th, 2020, 01:26 AM
#25
Re: how use PlgBlt() API function?
\Could you post the real coordinates of these three points (TexturePoints(0), TexturePoints(1), TexturePoints(2)) you are passing into PlgBlt?
Just use Debugger to obtain them.
Victor Nijegorodov
-
October 8th, 2020, 08:35 AM
#26
Re: how use PlgBlt() API function?
Originally Posted by VictorN
\Could you post the real coordinates of these three points (TexturePoints(0), TexturePoints(1), TexturePoints(2)) you are passing into PlgBlt?
Just use Debugger to obtain them.
debugger?
-
October 8th, 2020, 03:09 PM
#27
Re: how use PlgBlt() API function?
wow i found 1 problem: if the point have a negative value, i will get big numbers... ok these problem will be fixed. after i learn 1 math.
heres the values:
but what i did wrong with values?
Last edited by Cambalinho; October 8th, 2020 at 03:15 PM.
-
October 8th, 2020, 03:29 PM
#28
Re: how use PlgBlt() API function?
Did you try to build your figures (both from TexturePoints array and from Points) on the paper?
Victor Nijegorodov
-
October 8th, 2020, 04:22 PM
#29
Re: how use PlgBlt() API function?
no.... but i'm trying understand if the values from points() to texturepoints() are correct or not
i'm confused... the texture go to the 1st to the 2nd points without problems... i belive the 3 point can be wrong, because don't use the low-right
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|