private void drawLine_color(int x0, int y0, int dt,
                              int length, boolean vertical)  {
    int offset = 0;

    int ir = (int) m_r0;
    int ig = (int) m_g0;
    int ib = (int) m_b0;

    if (vertical) {
      length += y0;
      for (int j = 0x8000 + (x0<<16); y0 <= length; ++y0) {
        offset = y0 * SCREEN_WIDTH + (j>>16);
        m_pixels[offset] = 0xFF000000 |
          ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16));
        if (m_zbuffer != null) m_zbuffer[offset] = m_z0;
        ir += dr;
        ig += dg;
        ib += db;
        j +=dt;
      }

    } else {  // horizontal
      length += x0;
      for (int j = 0x8000 + (y0<<16); x0 <= length; ++x0) {
        offset = (j>>16) * SCREEN_WIDTH + x0;
        m_pixels[offset] = 0xFF000000 |
          ((ir & 0xFF0000) | ((ig >> 8) & 0xFF00) | (ib >> 16));
        if (m_zbuffer != null) m_zbuffer[offset] = m_z0;
        ir += dr;
        ig += dg;
        ib += db;
        j += dt;
      }
    }
  }