Guest User

Untitled

a guest
Mar 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. type SVG struct { <SVG INFO> }
  2. type Dimension struct { Width float64, Height float64}
  3. type Coordinate struct { X float64, Y float64}
  4. type Emoji struct { Name string, ID string, Size Dimension, Center Coordinate, Graphic SVG }
  5. type Logo struct { Size Dimension, AnchorPoints []Coordinate, NumOfPoints int, Graphic DVG }
  6. type EmojiBase struct { size Dimension, center Coordinate}
  7. type LogoBase struct { size Dimension }
  8. type Nanoji_Logo struct { Emojis []Emoji, BaseLogo Logo }
  9.  
  10. emoji_base_spec := EmojiBase{ Size : Dimension{Width: 32.00, Height: 32.00}, Center : Coordinate{X: 16, Y: 16} }
  11. logo_base_size := Dimension{Width: 224.5, Height: 961}
  12.  
  13.  
  14. //Scaling Emoji to fit the base dimension of the Nanoji Logo
  15. func (e *Emoji) EmojiBaseDimension(b EmojiBase){
  16. select e.name{
  17. case : "tongue_out"
  18. e.Size *= b.Size
  19. e.Center = CenterOffset(b.Center, <x>, <y>)
  20. case : "devil"
  21. e.Size *= b.Size
  22. e.Center = CenterOffset(b.Center, <x>, <y>)
  23. case : "angel"
  24. e.Size *= b.Size
  25. e.Center = CenterOffset(b.Center, <x>, <y>)
  26.  
  27. /* -----------------------------------------------------
  28. Insert other edge cases
  29. ----------------------------------------------------- */
  30. default:
  31. e.Size = emoji_base_dimension
  32. e.Center = emoji_base_center
  33. }
  34. }
  35.  
  36. //Modify Center of Edge Case Emojis
  37. func CenterOffset(originalCenter Coordinate, x_offset float64, y_offset float64) (offset_center Coordinate){
  38. offset_ceter = Coordinate{ X: originalCenter.X + x_offset, Y: originalCenter.Y + y_offset}
  39.  
  40. return offset_center
  41. }
  42.  
  43. //Resize Logo to new specs
  44. func (l *Logo) NewDimensions(newLogoWidth float64){
  45. percentChange = newLogoWidth / l.Size.Width
  46.  
  47. l.Size.Width *= (l.Size.Width * percentChange)
  48. l.Size.Height *= (l.Size.Height * percentChange)
  49.  
  50. //Scaling All Anchor points
  51. for i := 0; i < l.NumOfPoints; i++{
  52. l.AnchorPoints[i].X *= (l.AnchorPoints[i].X * percentChange)
  53. 1.AnchorPoints[i].Y *= (1.AnchorPoints[i].Y * percentChange)
  54. }
  55. }
  56.  
  57. //Resize emote to fit perfectly with new logo size
  58. func (e *Emoji) NewDimensions(newLogoWidth int, oldLogo LogoBase, b EmojiBase){
  59.  
  60. e.EmojiBaseDimension(b EmojiBase)
  61. percentChange = newLogoWidth / oldLogo.Width
  62.  
  63. e.Size.Width *= (e.Size.Width * percentChange)
  64. e.Size.Height *= (e.Size.Height * percentChange)
  65. e.Center.X *= (e.Center.X * percentChange)
  66. e.Center.Y *= (e.Center.Y * percentChange)
  67.  
  68. }
  69.  
  70. //Create New Nanoji SVG from BaseLogo and Emoji(s)
  71. func CreateNanoji (e Emoji, l Logo) (n Nanoji){
  72. //TO BE WRITTEN
  73. }
Add Comment
Please, Sign In to add comment