Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Shape non-rectangular region? — Gideros Forum

Shape non-rectangular region?

truyen_guava7truyen_guava7 Member
edited October 2012 in General questions
Hi everyone,

I'm making a paint-liked app using Shape in gideros. i just want to ask is there anyway we could set a non-rect region for the shape?

Thank you and sorry for my bad English. :D

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    Hello,
    sorry don't really understand what you mean.

    Could you draw an example or something? :)

    With Shape object you can create any shapes.
  • OZAppsOZApps Guru
    Accepted Answer
    if you want a free hand lasso tool that can create non-rect free form shapes, you need to note the points and draw a polygon joining them all.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • truyen_guava7truyen_guava7 Member
    edited October 2012
    I mean in Gideros we have Shape:setRegion function which is use to set a rectangle region to draw shape inside. i want the same thing but in various form like triangle.
    thank you. :)
  • oh, my bad. setRegion is for TextureRegion object only. maybe i'll think of another way. Thanks, you guys! :D
  • john26john26 Maintainer
    Shapes allow you to draw arbitrary filled polygons. For example, here is how I draw an octagon (colour "color") with a border (colour "scolor"):
    local block=Shape.new()
    block:setFillStyle(Shape.SOLID,color)
    block:setLineStyle(swidth, scolor, 1)
     
    block:beginPath()
    block:moveTo(-width/2+crad,-height/2)
    block:lineTo( width/2-crad,-height/2)
     
    block:lineTo( width/2,-height/2+crad)
    block:lineTo( width/2, height/2-crad)
     
    block:lineTo( width/2-crad, height/2)
    block:lineTo(-width/2+crad, height/2)
     
    block:lineTo(-width/2, height/2-crad)
    block:lineTo(-width/2,-height/2+crad)
     
    block:closePath()
    block:endPath()
    You can also fill with a texture instead of a solid fill.
Sign In or Register to comment.