Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void drawShadedLine(int[] dest, int dest_off, int start_x, int end_x, int color_index, int grad) {
- int color;
- int loops;
- int off = 0;
- if (restrict_edges) {
- if (end_x > Graphics2D.viewportRx) {
- end_x = Graphics2D.viewportRx;
- }
- if (start_x < 0) {
- color_index -= start_x * off;
- start_x = 0;
- }
- }
- if (start_x < end_x) {
- dest_off += start_x;
- color_index += off * start_x;
- //if(1 != 1)//if the below code is dead only textured parts of models appear
- if (notTextured) {//ifNontexturedModel?
- loops = end_x - start_x >> 2;
- if (loops > 0) {
- off = (grad - color_index) * anIntArray1468[loops] >> 15;
- } else {
- off = 0;
- }
- if (alpha == 0) {
- if (loops > 0) {
- do {
- color = hsl2rgb[color_index >> 8];
- color_index += off;
- dest[dest_off++] = color;
- dest[dest_off++] = color;
- dest[dest_off++] = color;
- dest[dest_off++] = color;
- } while (--loops > 0);
- }
- loops = end_x - start_x & 0x3;
- if (loops > 0) {
- color = hsl2rgb[color_index >> 8];
- do {
- dest[dest_off++] = color;
- }
- while (--loops > 0);
- }
- } else {
- int src_alpha = alpha;
- int dest_alpha = 256 - alpha;
- if (loops > 0) {
- do {
- color = hsl2rgb[color_index >> 8];
- color_index += off;
- color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
- * dest_alpha >> 8 & 0xff00));
- int i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- } while (--loops > 0);
- }
- loops = end_x - start_x & 0x3;
- if (loops > 0) {
- color = hsl2rgb[color_index >> 8];
- color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
- * dest_alpha >> 8 & 0xff00));
- do {
- int i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- } while (--loops > 0);
- }
- }
- } else {
- int col_off = (grad - color_index) / (end_x - start_x);
- loops = end_x - start_x;
- if (alpha == 0) {
- do {
- dest[dest_off++] = hsl2rgb[color_index >> 8];
- color_index += col_off;
- } while (--loops > 0);
- } else {
- int src_alpha = alpha;
- int dest_alpha = 256 - alpha;
- do {
- color = hsl2rgb[color_index >> 8];
- color_index += col_off;
- color = (((color & 0xff00ff) * dest_alpha >> 8 & 0xff00ff) + ((color & 0xff00)
- * dest_alpha >> 8 & 0xff00));
- int i = dest[dest_off];
- dest[dest_off++] = (color
- + ((i & 0xff00ff) * src_alpha >> 8 & 0xff00ff) + ((i & 0xff00)
- * src_alpha >> 8 & 0xff00));
- } while (--loops > 0);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment