Guest User

Untitled

a guest
Feb 21st, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. public static void drawShadedLine(int[] dest, int dest_off, int start_x, int end_x, int color_index, int grad) {
  2. int color;
  3. int loops;
  4. int off = 0;
  5. if (restrict_edges) {
  6. if (end_x > Graphics2D.viewportRx) {
  7. end_x = Graphics2D.viewportRx;
  8. }
  9. if (start_x < 0) {
  10. color_index -= start_x * off;
  11. start_x = 0;
  12. }
  13. }
  14. if (start_x < end_x) {
  15. dest_off += start_x;
  16. color_index += off * start_x;
  17. //if(1 != 1)//if the below code is dead only textured parts of models appear
  18. if (notTextured) {//ifNontexturedModel?
  19. loops = end_x - start_x >> 2;
  20. if (loops > 0) {
  21. off = (grad - color_index) * anIntArray1468[loops] >> 15;
  22. } else {
  23. off = 0;
  24. }
  25. if (alpha == 0) {
  26. if (loops > 0) {
  27. do {
  28. color = hsl2rgb[color_index >> 8];
  29. color_index += off;
  30. dest[dest_off++] = color;
  31. dest[dest_off++] = color;
  32. dest[dest_off++] = color;
  33. dest[dest_off++] = color;
  34. } while (--loops > 0);
  35. }
  36. loops = end_x - start_x & 0x3;
  37. if (loops > 0) {
  38. color = hsl2rgb[color_index >> 8];
  39. do {
  40. dest[dest_off++] = color;
  41. }
  42. while (--loops > 0);
  43. }
  44. } else {
  45. int src_alpha = alpha;
  46. int dest_alpha = 256 - alpha;
  47. if (loops > 0) {
  48. do {
  49. color = hsl2rgb[color_index >> 8];
  50. color_index += off;
  51. color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
  52. * dest_alpha >> 8 & 0xff00));
  53. int i = dest[dest_off];
  54. dest[dest_off++] = (color
  55. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  56. * src_alpha >> 8 & 0xff00));
  57. i = dest[dest_off];
  58. dest[dest_off++] = (color
  59. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  60. * src_alpha >> 8 & 0xff00));
  61. i = dest[dest_off];
  62. dest[dest_off++] = (color
  63. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  64. * src_alpha >> 8 & 0xff00));
  65. i = dest[dest_off];
  66. dest[dest_off++] = (color
  67. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  68. * src_alpha >> 8 & 0xff00));
  69. } while (--loops > 0);
  70. }
  71. loops = end_x - start_x & 0x3;
  72. if (loops > 0) {
  73. color = hsl2rgb[color_index >> 8];
  74. color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
  75. * dest_alpha >> 8 & 0xff00));
  76. do {
  77. int i = dest[dest_off];
  78. dest[dest_off++] = (color
  79. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  80. * src_alpha >> 8 & 0xff00));
  81. } while (--loops > 0);
  82. }
  83. }
  84. } else {
  85. int col_off = (grad - color_index) / (end_x - start_x);
  86. loops = end_x - start_x;
  87. if (alpha == 0) {
  88. do {
  89. dest[dest_off++] = hsl2rgb[color_index >> 8];
  90. color_index += col_off;
  91. } while (--loops > 0);
  92. } else {
  93. int src_alpha = alpha;
  94. int dest_alpha = 256 - alpha;
  95. do {
  96. color = hsl2rgb[color_index >> 8];
  97. color_index += col_off;
  98. color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
  99. * dest_alpha >> 8 & 0xff00));
  100. int i = dest[dest_off];
  101. dest[dest_off++] = (color
  102. + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
  103. * src_alpha >> 8 & 0xff00));
  104. } while (--loops > 0);
  105. }
  106. }
  107. }
  108. }
Add Comment
Please, Sign In to add comment