public void setIntensities(float r0, float g0, float b0, float a0,
                             float r1, float g1, float b1, float a1) {
    a_array[0] = (a0 * 253f + 1.0f) * 65536f;
    a_array[1] = (a1 * 253f + 1.0f) * 65536f;

    // check if we need alpha or not?
    if ((a0 != 1.0f) || (a1 != 1.0f)) {
      INTERPOLATE_ALPHA = true;
      m_drawFlags |= R_ALPHA;
    } else {
      INTERPOLATE_ALPHA = false;
      m_drawFlags &= ~R_ALPHA;
    }

    // extra scaling added to prevent color "overflood" due to rounding errors
    r_array[0] = (r0 * 253f + 1.0f) * 65536f;
    r_array[1] = (r1 * 253f + 1.0f) * 65536f;

    g_array[0] = (g0 * 253f + 1.0f) * 65536f;
    g_array[1] = (g1 * 253f + 1.0f) * 65536f;

    b_array[0] = (b0 * 253f + 1.0f) * 65536f;
    b_array[1] = (b1 * 253f + 1.0f) * 65536f;

    // check if we need to interpolate the intensity values
    if (r0 != r1) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_COLOR;

    } else if (g0 != g1) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_COLOR;

    } else if (b0 != b1) {
      INTERPOLATE_RGB = true;
      m_drawFlags |= R_COLOR;

    } else {
      // when plain we use the stroke color of the first vertex
      m_stroke = 0xFF000000 |
        ((int)(255*r0) << 16) | ((int)(255*g0) << 8) | (int)(255*b0);
      INTERPOLATE_RGB = false;
      m_drawFlags &= ~R_COLOR;
    }
  }