Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Selba Ward  (Read 30273 times)

0 Members and 1 Guest are viewing this topic.

salianifo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Selba Ward
« Reply #120 on: May 21, 2017, 10:57:54 pm »
Are you planning on adding a feature to the Nine Patch to allow multiple stretching sections? Something along the lines of what this post on StackOverflow is trying to achieve?

Hapax

  • Hero Member
  • *****
  • Posts: 2694
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #121 on: May 22, 2017, 02:40:32 pm »
There are currently no plans to expand Nine Patch to have more than nine patches although it can be a consideration for the future.

Note that it can be achieved by displaying Nine Patches together.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter

Hapax

  • Hero Member
  • *****
  • Posts: 2694
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Selba Ward
« Reply #122 on: August 07, 2017, 05:17:52 pm »
Update!

Elastic Sprite (wiki)
v1.1
Added ability to use perspective interpolation instead of bi-linear interpolation.

Bi-linear interpolation can look 'rubbery' but remains evenly distributed and edges match easily. Note that lines can be bent (notice the red diagonal squares 0-9 in the examples below); then again, it is technically a similar method to calculating bezier curves...
Perspective interpolation adjusts the apparent 3D rotation of the quad to match the vertices' positions. This is similar to Photoshop's free transform's individual corner manipulation. Note that distribution is no longer even and edges will not match so easily.

Compare below.

Bi-linear:


Perspective:



One additional thing to note is that the RGB components of the sprite's colour are disabled when drawn using perspective interpolation; the alpha is used as normal.
The reason for this is because an extra "weight" float per vertex that would be interpolated like other vertex attributes is needed. Since SFML's vertex format is rigid and only has 2d position and texture co-ordinates, this value could not be passed through a spare. This led to the decision to encode the float into the three colour (RGB) components of the sprite's colour.
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter