Correct serrated or burr losangle after drawing a diamond polygon
David McFarlane
mcfarla9 at msu.edu
Thu Jan 9 19:24:20 UTC 2014
Hmm. I normally decline to look at extensive code samples or
attached programs, but you made it very easy and I was curious. So I
ran your code, and indeed got bad jagged edges for the diamonds. I
thought I could just attribute this to low Display resolution (640 x
480 default), but got the same bad results at all other resolutions
(max 1680 x 1050 on my machine), working with either EP1 or EP2. So
it seems that the E-Basic Canvas.Polygon command simply does not do a
good job of anti-aliasing (see
http://en.wikipedia.org/wiki/Spatial_anti-aliasing for background information).
Instead, you should make image files for your diamond and other
shapes, then simply load those images to the Display as needed. This
has the advantage that you can use good software to prepare your
images and it will simplify your E-Basic code as you can simply
redraw the same image to different defined locations.
Come to think of this, using image files and Slides, you should be
able to do this with no E-Basic code at all (I should have thought of
this first, as this is the norma E-Prime way!). Just make a Slide
with SlideImage sub-objects to hold your square and diamond images,
then use attribute references from a List to assign the Position X &
Y properies for each of those sub-objects. Easy-peasy (as long as
you do not need too many diamond angles)!
-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (https://twitter.com/EPrimeMaster )
/----
Stock reminder: 1) I do not work for PST. 2) PST's trained staff
take any and all questions at https://support.pstnet.com , and they
strive to respond to all requests in 24-48 hours, so make full use of
it. 3) In addition, PST offers several instructional videos on their
YouTube channel (http://www.youtube.com/user/PSTNET ). 4) If you do
get an answer from PST staff, please extend the courtesy of posting
their reply back here for the sake of others.
\----
At 1/8/2014 09:56 AM Wednesday, Camila Gomes Victorino wrote:
>I have a binary decision making task where the subject needs to find
>out the diamond or losangle in one of the two sides. In the other
>one, there is a square and it needs to be identical to the diamond
>(just the angle position changes). I tried to draw the losangle and
>it worked, the problem is that the stimulus appears with serrated or
>burr sides. I tried to fix it putting the cnvs.penwidth and
>modifying it but it changes a lot the diamond and it needs to be
>identical to the square. I do not know how to fix it and get the
>serrated burrs out.
>
>I wrote the code as this:
>
> 'Declare variables
>Dim r, centerX, centerY As Integer
>
>'Create canvas
>Set cnvs = Display.Canvas
>cnvs.FillColor = CColor("White")
>cnvs.Clear
>
>'Create fixation point
>cnvs.TextColor = CColor ("black")
>cnvs.FontName = "Courier New"
>cnvs.FontSize = "18"
>cnvs.FontBold = CLogical("Yes")
>cnvs.Text 313, 228, "+"
>
>'Create gray squares
>cnvs.Pencolor = CColor("Gray")
>cnvs.Fillcolor = CColor("White")
>cnvs.Rectangle 255, 205, 55, 62
>cnvs.Rectangle Display.XRes -310, 205, 55, 62
>
>'Show targets
>cnvs.Pencolor = CColor("black")
>cnvs.Fillcolor = CColor("black")
>If c.getattrib("Target") = "Diamond" Then
>'Write a left diamond
>Dim P (4) As Point
>P(0).x = 280
>P(0).y = 218
>P(1).x = 296
>P(1).y = 239
>P(2).x = 280
>P(2).y = 256
>P(3).x = 265
>P(3).y = 239
>cnvs.Polygon P, 4
>
>cnvs.Rectangle 345, 222, 25, 30
>Else
>'Write a Rectangle
>cnvs.Rectangle 270, 222, 25, 30
>'Write a Diamond
>
>Dim L (4) As Point
>L(0).x = 357
>L(0).y = 218
>L(1).x = 373
>L(1).y = 239
>L(2).x = 357
>L(2).y = 256
>l(3).x = 342
>L(3).y = 239
>cnvs.Polygon L, 4
>
>
>End If
>
>Sleep (1000)
>
>Thank you!
>Best regards,
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/52cef766.0b39320a.4770.3876SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.
More information about the Eprime
mailing list