示例#1
0
struct raster *DebugRecieve::convert(const Raster &r) const
{
  // build-and-wrap C-raster struct pointer
  CRasterHolder crh( raster_create( r.getSize()._x, r.getSize()._y ) );
  if(crh.get()==NULL)
    return NULL;
  struct raster *rh=crh.get();  // helper

  for(unsigned int y=0; y<r.getSize()._y; ++y)
    for(unsigned int x=0; x<r.getSize()._x; ++x)
    {
      // get pixel from input image
      CGraphics::Position pos(x,y);
      CGraphics::Pixel    pix=r.getPixel(pos);

      // assign to raster
      raster_pix_set_r(rh, x,y, pix.getR() );
      raster_pix_set_g(rh, x,y, pix.getG() );
      raster_pix_set_b(rh, x,y, pix.getB() );
    };

  return crh.release();
};
示例#2
0
void RenderFrameSet::readyWRATHWidgets(PaintedWidgetsOfWRATHHandle& handle,
				       PaintInfoOfWRATH& paintInfo, int tx, int ty)
{
    RenderFrameSet_ReadyWRATHWidgets *d(RenderFrameSet_ReadyWRATHWidgets::object(this, handle));
    ContextOfWRATH::AutoPushNode autoPushRoot(paintInfo.wrath_context, d->m_root_node);

    ContextOfWRATH::AutoPushNode autoPushSkip(paintInfo.wrath_context, d->m_skip_node);
    d->m_skip_node.widget()->visible(false);

    if (paintInfo.phase != PaintPhaseForeground)
        return;
    
    RenderObject* child = firstChild();
    if (!child)
        return;

    d->m_skip_node.widget()->visible(true);

    // Add in our offsets.
    tx += x();
    ty += y();

    int rows = frameSet()->totalRows();
    int cols = frameSet()->totalCols();
    int borderThickness = frameSet()->border();

    d->m_children.hideEachObject();
    d->m_column_borders.hideEachObject();
    d->m_row_borders.hideEachObject();

    int yPos = 0;
    for (int r = 0; r < rows; r++) {
        int xPos = 0;
        for (int c = 0; c < cols; c++) {
	    PaintedWidgetsOfWRATHHandle& ch(d->m_children.getHandle(child));
	    ch.visible(true);
            child->readyWRATHWidgets(ch, paintInfo, tx, ty);
            xPos += m_cols.m_sizes[c];
            if (borderThickness && m_cols.m_allowBorder[c + 1]) {
		PaintedWidgetsOfWRATHHandle& cbh(d->m_column_borders.getHandle(child));
		cbh.visible(true);
                readyWRATHWidgetColumnBorder(cbh, paintInfo, IntRect(tx + xPos, ty + yPos, borderThickness, height()));
                xPos += borderThickness;
            }
            child = child->nextSibling();
            if (!child) {
		d->m_children.removeNonVisibleHandles();
		d->m_column_borders.removeNonVisibleHandles();
		d->m_row_borders.removeNonVisibleHandles();
                return;
	    }
        }
        yPos += m_rows.m_sizes[r];
        if (borderThickness && m_rows.m_allowBorder[r + 1]) {
	    /* It's not exactly related to the child but it matches the separation */
	    /* TODO: Improve the explanation. */
	    PaintedWidgetsOfWRATHHandle& crh(d->m_row_borders.getHandle(child));
	    crh.visible(true);
	    readyWRATHWidgetRowBorder(crh, paintInfo, IntRect(tx, ty + yPos, width(), borderThickness));
            yPos += borderThickness;
        }
    }
    d->m_children.removeNonVisibleHandles();
    d->m_column_borders.removeNonVisibleHandles();
    d->m_row_borders.removeNonVisibleHandles();
}