예제 #1
0
void RLE_Out_Ras_W_Comp::flush_image(void)
{
   if (    (! _first)   //  !! : fisrt => _w_last_x .... = rubbish
        && (_w_last_x0<_w_last_x1) // do not want to know how are handled empty lines
      )
   {
       INT wy0,wy1;
       interval_user_to_window(wy0,wy1,_u_last_y,_u_last_y+1,_tr.y,_sc.y);
       wy0 = std::max(0,wy0);
       wy1 = std::min(_sz.y,wy1);
       if (wy0 != wy1)
       {
            memcpy
            (
                _derw->_bli+_w_last_x0 * _byte_pp,
                _cpbli+_w_last_x0 * _byte_pp,
                (_w_last_x1-_w_last_x0) * _byte_pp
            );

            for (INT wy = wy0; wy < wy1 ; wy++)
                _derw->flush_bli(_w_last_x0,_w_last_x1,wy);
           _derd->disp_flush();
       }
   }
}
예제 #2
0
RLE_Out_Ras_W_Comp::RLE_Out_Ras_W_Comp
(
      const Arg_Output_Comp &  arg   ,
      const Data_El_Geom_GWin * geom ,
      Data_Elise_Raster_W     * derw ,
      Data_Elise_Palette      * pal
) :
      Out_Ras_W_Comp(arg,geom,derw,pal)
      // _u_last_y,_w_last_x0 and _w_last_x1 initialized in update when (! _first)
{

    geom->box_user_geom(_pu1,_pu2);
    _line_lut = _derd->alloc_line_buf(_pu2.x-_pu1.x+2);
    _cpbli    = _derd->alloc_line_buf(_sz.x);

    REAL tx = _tr.x;
    REAL sx = _sc.x;


    _zx  = NEW_VECTEUR(_pu1.x,_pu2.x,U_INT2);
    _wx0 = NEW_VECTEUR(_pu1.x,_pu2.x,U_INT2);

    for (INT x = _pu1.x; x<_pu2.x ; x++)
    {
        INT wx0,wx1;
        interval_user_to_window(wx0,wx1,x,x+1,tx,sx);

        wx0 = std::max(0,wx0);
        wx1 = std::min(geom->sz().x,wx1);

        _zx[x] = wx1 -wx0;
        _wx0[x] = wx0;
    }

}
예제 #3
0
void PInt_NoC_TrueC_ORW_Comp::update
(
         const Pack_Of_Pts * p,
         const Pack_Of_Pts * v
)
{
    const Std_Pack_Of_Pts<INT> * pts  = SAFE_DYNC(Std_Pack_Of_Pts<INT> *,const_cast<Pack_Of_Pts *>(p));
    const Std_Pack_Of_Pts<INT> * vals = SAFE_DYNC(Std_Pack_Of_Pts<INT> *,const_cast<Pack_Of_Pts *>(v));
    INT nb = pts->nb();
    INT * x = pts->_pts[0];
    INT * y = pts->_pts[1];

    REAL sx = _sc.x;
    REAL sy = _sc.y;

    REAL tx = _tr.x;
    REAL ty = _tr.y;

    _dep->ilutage(_derd,_coul,vals->nb(),_ddp->lut_compr(),vals->_pts);

    if ((sx == 1.0) && (sy == 1.0))
    {
         Pt2di tr ( deb_interval_user_to_window(0,tx,sx),
                    deb_interval_user_to_window(0,ty,sy)
                  );

         _pts.reset(0);
         for (int i=0; i<nb ; i++)
             _pts.qpush(El_RW_Point(x[i]+tr.x,y[i]+tr.y));

         _derw->rast_draw_col_pix(_coul,_pts.ptr(),pts->nb());
    }
    else if  (  ((INT) sx == sx)  &&  ((INT) sy == sy))
    {
         INT zx = (int) sx;
         INT zy = (int) sy;
         INT wx0 = deb_interval_user_to_window(0,tx,sx);
         INT wy0 = deb_interval_user_to_window(0,ty,sy);

         _rects.reset(0);
         for (int i=0; i<nb ; i++)
             _rects.qpush(El_RW_Rectangle(zx*x[i]+wx0,zy*y[i]+wy0,zx,zy));

         _derw->rast_draw_col_big_pixels(_coul,_rects.ptr(),_rects.nb());
    }
    else
    {
         INT wx0,wx1;
         INT wy0,wy1;

         _rects.reset(0);
         for (int i=0; i<nb ; i++)
         {
            interval_user_to_window(wx0,wx1,x[i],x[i]+1,tx,sx);
            interval_user_to_window(wy0,wy1,y[i],y[i]+1,ty,sy);
            _rects.qpush(El_RW_Rectangle(wx0,wy0,wx1-wx0,wy1-wy0));
         }

         _derw->rast_draw_col_big_pixels(_coul,_rects.ptr(),_rects.nb());
    }
}
예제 #4
0
void RLE_Out_Ras_W_Comp::update(const Pack_Of_Pts * p,const Pack_Of_Pts * v)
{
    const Std_Pack_Of_Pts<INT> * ivals
         = SAFE_DYNC(const Std_Pack_Of_Pts<INT> *,v);
    RLE_Pack_Of_Pts * rle_pack = SAFE_DYNC(RLE_Pack_Of_Pts *,const_cast<Pack_Of_Pts *>(p));

    INT nb = rle_pack->nb();
    if (! nb) return;

    INT ** vals = ivals->_pts;

     _dep->verif_values_out(vals,nb);



    INT ux0 = rle_pack->x0();
    INT ux1 = ux0 + nb;
    INT uy  = rle_pack->pt0()[1];

    REAL tx = _tr.x;
    REAL sx = _sc.x;

    INT out_wx0,out_wx1;
     // these values may get out ``slightly'' (no more than 1  user pixel) of window
    interval_user_to_window(out_wx0,out_wx1,ux0,ux1,tx,sx);
    INT wx0 =  std::max(0,out_wx0);
    INT wx1 = std::min(_sz.x,out_wx1);


    // An easy way to treat the firt call is to consider that a previous empty segment
    // was preceding;
    if (_first)
    {
       _first = false;
       _w_last_x0 = _w_last_x1 = wx0;
       _u_last_y = uy-1;
    }

    // if the curent segment is not a prolongation of previous one
    if ((_u_last_y != uy) || (_w_last_x1 != wx0))
    {
        flush_image();
       _w_last_x0 = wx0;
       _u_last_y = uy;
    }
    _w_last_x1 = wx1;


    // for optmization purpose, treat separately
    // the cases :
    //    * sx = 1      (most frequent and fast)
    //    * sx integer  (not so rare and quite quick)
    //    * other case  (should be less frequent, and more complex to handle)



    if (sx == 1.0)
    {
        //  sx = 1 : copy with an eventual offset
        _dep->lutage (_derd,_cpbli,wx0,wx1,
                      _ddp->lut_compr(),vals,wx0 - out_wx0);
    }
    else
    {
       _dep->lutage (_derd,_line_lut,0,nb,
                      _ddp->lut_compr(),vals,0);

        U_INT1 * ddbli = _cpbli + _wx0[ux0] * _byte_pp ;
        U_INT2 * _tz = _zx+ux0;

        switch (_derd->_cmod)
        {
              case Indexed_Colour :
              {
                      for (int i=0 ; i<nb ; i++)
                      {
                          INT zx = *(_tz++);
                          INT c = _line_lut[i];
                          for (INT iz = 0; iz < zx; iz ++)
                              *(ddbli++) = c;
                      }
              }
              break;

              case True_16_Colour :
              {
                 U_INT2 * ll2= (U_INT2 *) _line_lut;
                 U_INT2 * dd2= (U_INT2 *) ddbli;
                 for (int i=0 ; i<nb ; i++)
                 {
                     INT c = ll2[i];
                     INT zx = *(_tz++);
                     for (INT iz = 0; iz < zx; iz ++)
                         *(dd2++) = c;
                 }
              }
              break;

              case True_24_Colour :
              {
                  INT r,g,b;
                  U_INT1 * ll1= _line_lut;
                  INT  r_ind = _derd->_r_ind;
                  INT  g_ind = _derd->_g_ind;
                  INT  b_ind = _derd->_b_ind;

                  for (int i=0 ; i<nb ; i++)
                  {
                     INT zx = *(_tz++);
                      r = ll1[r_ind];
                      g = ll1[g_ind];
                      b = ll1[b_ind];
                      for (INT iz = 0; iz < zx; iz ++)
                      {
                          ddbli[r_ind] = r;
                          ddbli[g_ind] = g;
                          ddbli[b_ind] = b;
                          ddbli += _byte_pp;
                      }
                      ll1 += _byte_pp;
                  }
               }
               break;
       }
    }
}