• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TRegion类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TRegion的典型用法代码示例。如果您正苦于以下问题:C++ TRegion类的具体用法?C++ TRegion怎么用?C++ TRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TRegion类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: checkSegments

  //! Elimina i segmenti che non sono contenuti all'interno dello stroke!!!
  void checkSegments(std::vector<TAutocloser::Segment> &segments,
                     TStroke *stroke, const TRasterCM32P &ras,
                     const TPoint &delta) {
    TVectorImage vi;
    TStroke *app = new TStroke();
    *app         = *stroke;
    app->transform(TTranslation(convert(ras->getCenter())));
    vi.addStroke(app);
    vi.findRegions();
    std::vector<TAutocloser::Segment>::iterator it = segments.begin();
    for (; it < segments.end(); it++) {
      if (it == segments.end()) break;

      int i;
      bool isContained = false;
      for (i = 0; i < (int)vi.getRegionCount(); i++) {
        TRegion *reg = vi.getRegion(i);
        if (reg->contains(convert(it->first + delta)) &&
            reg->contains(convert(it->second + delta))) {
          isContained = true;
          break;
        }
      }
      if (!isContained) {
        it = segments.erase(it);
        if (it != segments.end() && it != segments.begin())
          it--;
        else if (it == segments.end())
          break;
      }
    }
  }
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:33,代码来源:rastertapetool.cpp


示例2: getRasterPoint

/*-- (StylePickerTool内で)LineとAreaを切り替えてPickできる。mode: 0=Area, 1=Line, 2=Line&Areas(default)  --*/
int StylePicker::pickStyleId(const TPointD &pos, double radius2, int mode) const
{
	int styleId = 0;
	if (TToonzImageP ti = m_image) {
		TRasterCM32P ras = ti->getRaster();
		TPoint point = getRasterPoint(pos);
		if (!ras->getBounds().contains(point))
			return -1;
		TPixelCM32 col = ras->pixels(point.y)[point.x];

		switch (mode) {
		case 0: //AREAS
			styleId = col.getPaint();
			break;
		case 1: //LINES
			styleId = col.getInk();
			break;
		case 2: //ALL (Line & Area)
		default:
			styleId = col.isPurePaint() ? col.getPaint() : col.getInk();
			break;
		}
	} else if (TRasterImageP ri = m_image) {
		const TPalette *palette = m_palette.getPointer();
		if (!palette)
			return -1;
		TRaster32P ras = ri->getRaster();
		if (!ras)
			return -1;
		TPoint point = getRasterPoint(pos);
		if (!ras->getBounds().contains(point))
			return -1;
		TPixel32 col = ras->pixels(point.y)[point.x];
		styleId = palette->getClosestStyle(col);
	} else if (TVectorImageP vi = m_image) {
		// prima cerca lo stile della regione piu' vicina
		TRegion *r = vi->getRegion(pos);
		if (r)
			styleId = r->getStyle();
		// poi cerca quello della stroke, ma se prima aveva trovato una regione, richiede che
		// il click sia proprio sopra la stroke, altrimenti cerca la stroke piu' vicina (max circa 10 pixel)
		const double maxDist2 = (styleId == 0) ? 100.0 * radius2 : 0;
		bool strokeFound;
		double dist2, w, thick;
		UINT index;
		//!funzionerebbe ancora meglio con un getNearestStroke che considera
		//la thickness, cioe' la min distance dalla outline e non dalla centerLine
		strokeFound = vi->getNearestStroke(pos, w, index, dist2);
		if (strokeFound) {
			TStroke *stroke = vi->getStroke(index);
			thick = stroke->getThickPoint(w).thick;
			if (dist2 - thick * thick < maxDist2) {
				assert(stroke);
				styleId = stroke->getStyle();
			}
		}
	}
	return styleId;
}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:60,代码来源:stylepicker.cpp


示例3: Update

void RWindows::Update(const TRegion& aRgn,const TSize& aSize)
	{
	if(aRgn.CheckError())
		UpdateRect(TRect(aSize),aSize);
	else
		for(TInt count=0;count<aRgn.Count();count++)
			UpdateRect(aRgn[count],aSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:8,代码来源:WINS.CPP


示例4: IsClipped

CHuiCanvasGc::TClipRectVisibility CHuiCanvasGc::IsClipped(const TRect& aRect, const TRegion& aClippingRegion) const
    {
    TClipRectVisibility isClipped = EFullyOutside;
    if (!aClippingRegion.Count())
        {
        return EFullyInside;
        }
    
    if (!aRect.IsEmpty() && aClippingRegion.Count())
        {    
#if 0            
        TBool test = EFalse;        
        if (test)
            {
            for (TInt i=0; i<aClippingRegion.Count(); i++)
                {
#ifdef _DEBUG
                RDebug::Print(_L("aClippingRegion Rect: %d %d %d %d"), 
                        aClippingRegion[i].iTl.iX, 
                        aClippingRegion[i].iTl.iY,
                        aClippingRegion[i].iBr.iX,
                        aClippingRegion[i].iBr.iY);
#endif
                }                            
            }
#endif        
        
        if (aClippingRegion.Intersects(aRect))
            {            
            iTempRegion.Clear();
            iTempRegion2.Clear();

            iTempRegion.AddRect(aRect);
            
            iTempRegion2.Intersection(aClippingRegion, iTempRegion);
            iTempRegion2.Tidy();
            
            // Assume it is only partially inside region -> Clipped
            isClipped = EPartialOverlap;
            
            if (iTempRegion2.Count() == 1)
                {
                if (iTempRegion2[0] == aRect)
                    {
                    // Fully inside region -> Not clipped
                    isClipped = EFullyInside;    
                    }                
                }
            
            }
        else
            {
            // No overlap -> aRect is completely outside region -> Clipped
            isClipped = EFullyOutside;    
            }                    
        }
    return isClipped;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:58,代码来源:huicanvasgc.cpp


示例5: CheckRectRegion

void TestRRegion::CheckRectRegion(const TRegion& region,const TRect& rect)
// Check the region matches the rectangle
	{
	const TRect* rlist;

	if (rect.IsEmpty())
		test(region.Count()==0);
	else
		{
		test(region.Count()==1);
		rlist=region.RectangleList();
		test(rlist[0]==rect);
		test(region[0]==rect);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:15,代码来源:t_regn.cpp


示例6: LogRegion

void CDataWrapperBase::LogRegion(const TDesC& aMessage, const TRegion& aRegion)
	{
	INFO_PRINTF2(KLogRegion, &aMessage);
	TInt	indCount = aRegion.Count();
	if ( indCount==0 )
		{
		INFO_PRINTF1(KLogEmpty);
		}
	else
		{
		const TRect*	rect=aRegion.RectangleList();
		for ( TInt index=0; index<indCount; ++index )
			{
			INFO_PRINTF6(KLogRegionsRect, index, rect[index].iTl.iX, rect[index].iTl.iY, rect[index].iBr.iX, rect[index].iBr.iY);
			}
		}
	}
开发者ID:fedor4ever,项目名称:default,代码行数:17,代码来源:DataWrapperBase.cpp


示例7: dsaRect

void CMMFTestVideoDecodeHwDevice::SetScreenClipRegion(const TRegion& aRegion)
	{
	TRect dsaRect(KTestDSARectA, KTestDSARectB, KTestDSARectC, KTestDSARectD);
	TRegionFix<1> dsaReg(dsaRect);

	__ASSERT_ALWAYS(dsaReg.BoundingRect() == aRegion.BoundingRect(), 
		DevVideoDecoderPanic(EDecoderPanicScreenClipRegion)); 
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:8,代码来源:decoder.cpp


示例8: GetRegionFromConfig

TBool CDataWrapperBase::GetRegionFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TRegion& aResult)
	{
	TBuf<KMaxTestExecuteCommandLength>	tempStore;
	TRect								rect;

	aResult.Clear();
	TBool	moreData=ETrue;
	for ( TInt index=0; moreData; )
		{
		tempStore.Format(KFormatFieldNumber, &aKeyName, ++index);
		moreData=GetRectFromConfig(aSectName, tempStore, rect);
		if ( moreData )
			{
			aResult.AddRect(rect);
			}
		}

	return aResult.Count()>0;
	}
开发者ID:fedor4ever,项目名称:default,代码行数:19,代码来源:DataWrapperBase.cpp


示例9: CalcRedrawRegion

void CWsSpriteBase::CalcRedrawRegion(const TRegion& aSourceRegion, TRegion& aTarget) const
	{
	aTarget.Copy(aSourceRegion);
	if (ClipSprite())
		{
		TPoint origin(0,0);
		if(iWin)
			origin = iWin->Origin();
		TRect rect(iBasePos + origin + iClipOffset, iClipSize);
		aTarget.ClipRect(rect);
		}
	aTarget.ClipRect(RootWindow()->Abs());

	// Only need to draw if the region being redrawn overlaps the sprite
	const TRect spriteRect(Pos(), iSize);
	STACK_REGION spriteRegion;
	spriteRegion.AddRect(spriteRect);
	aTarget.Intersect(spriteRegion);
	spriteRegion.Close();
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:20,代码来源:SPRITE.CPP


示例10: MarkDirtyAndSchedule

/** 
This function updates the window's dirty region and schedules a redraw if needed.
Only used when the screen is run in CHANGETRACKING mode. 
@param aRegion in window coordinates
*/
void CWsBackedUpWindow::MarkDirtyAndSchedule(const TRegion& aRegion)
	{
	WS_ASSERT_DEBUG(Screen()->ChangeTracking(),EWsPanicNoChangetracking);
	
	if(!aRegion.IsEmpty())
		{
		iWsWin->AddDirtyWindowRegion(aRegion);
		if (iWsWin->IsActive() && iWsWin->IsVisible())
			{
			Screen()->ScheduleWindow(iWsWin);
			}
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:18,代码来源:backedupwindow.cpp


示例11: CalcFloatingSpriteRgn

void CWsSpriteManager::CalcFloatingSpriteRgn( TRegion& aResultRgn, const TRect& aDefaultRect )
	{
	aResultRgn.Clear();
	for (TInt i=0 ; i<iFloatingSprites.Count() && !aResultRgn.CheckError(); i++)
		{
		CWsSpriteBase* sprite = iFloatingSprites[i]; 
		if ( sprite->CanBeSeen() && ( sprite->IsActive() || sprite->IsActivated() ) )
			{
			aResultRgn.AddRect( sprite->Rect() );
			}
		}
	aResultRgn.Tidy();
	if ( aResultRgn.CheckError() && iFloatingSprites.Count() > 0 )
		{
		aResultRgn.Clear();
		aResultRgn.AddRect( aDefaultRect );
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:18,代码来源:SPRITE.CPP


示例12: doDraw

void RWsTextCursor::doDraw(CFbsBitGc* aGc, const TRegion& aRegion)
	{
	TRegionFix<1> justInCase;
	const TRegion *pr= &aRegion;
	if (aRegion.CheckError())
		{
		justInCase.AddRect(iWin->AbsRect());
		pr= &justInCase;
		}
	if (!pr->IsEmpty())
		{
		aGc->SetUserDisplayMode(iWin->DisplayMode());
		aGc->SetDitherOrigin(iWin->Origin());
		aGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
		switch (iType)
			{
			case TTextCursor::ETypeRectangle:
				{
				aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
				aGc->SetPenStyle(CGraphicsContext::ENullPen);
				aGc->SetBrushColor(iColor);
				}
				break;
			case TTextCursor::ETypeHollowRectangle:
				{
				aGc->SetBrushStyle(CGraphicsContext::ENullBrush);
				aGc->SetPenStyle(CGraphicsContext::ESolidPen);
				aGc->SetPenColor(iColor);
				}
				break;
			default:
				WS_PANIC_ALWAYS(EWsPanicInvalidCursorType);
			}
		aGc->SetClippingRegion(pr);
		aGc->DrawRect(RectRelativeToScreen());
		aGc->SetUserDisplayMode(ENone);

		TWindowServerEvent::NotifyScreenDrawingEvent(pr);
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:40,代码来源:TCURSOR.CPP


示例13: stroke_autofill_learn

void stroke_autofill_learn(const TVectorImageP &imgToLearn, TStroke *stroke) {
  if (!imgToLearn || !stroke || stroke->getControlPointCount() == 0) return;
  TVectorImage appImg;
  TStroke *appStroke = new TStroke(*stroke);
  appImg.addStroke(appStroke);
  appImg.findRegions();

  double pbx, pby;
  double totalArea = 0;
  pbx = pby = 0;

  if (!regionsReference.isEmpty()) regionsReference.clear();

  int i, j, index = 0;

  for (i = 0; i < (int)imgToLearn->getRegionCount(); i++) {
    TRegion *currentRegion = imgToLearn->getRegion(i);
    for (j = 0; j < (int)appImg.getRegionCount(); j++) {
      TRegion *region = appImg.getRegion(j);
      if (contains(region, currentRegion)) {
        scanRegion(currentRegion, index, regionsReference, region->getBBox());
        index++;
        int k, subRegionCount = currentRegion->getSubregionCount();
        for (k = 0; k < subRegionCount; k++) {
          TRegion *subRegion = currentRegion->getSubregion(k);
          if (contains(region, subRegion))
            scanSubRegion(subRegion, index, regionsReference,
                          region->getBBox());
        }
      }
    }
  }

  QMap<int, Region>::Iterator it;
  for (it = regionsReference.begin(); it != regionsReference.end(); it++) {
    pbx += it.value().m_barycentre.x;
    pby += it.value().m_barycentre.y;
    totalArea += it.value().m_area;
  }

  if (totalArea > 0)
    referenceB = TPointD(pbx / totalArea, pby / totalArea);
  else
    referenceB = TPointD(0.0, 0.0);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:45,代码来源:autofillpli.cpp


示例14: rect_autofill_learn

void rect_autofill_learn(const TVectorImageP &imgToLearn, const TRectD &rect)

{
  if (rect.getLx() * rect.getLy() < MIN_SIZE) return;

  double pbx, pby;
  double totalArea = 0;
  pbx = pby = 0;

  if (!regionsReference.isEmpty()) regionsReference.clear();

  int i, index = 0, regionCount = imgToLearn->getRegionCount();
  for (i = 0; i < regionCount; i++) {
    TRegion *region = imgToLearn->getRegion(i);
    if (rect.contains(region->getBBox())) {
      scanRegion(region, index, regionsReference, rect);
      index++;
    }
    int j, subRegionCount = region->getSubregionCount();
    for (j = 0; j < subRegionCount; j++) {
      TRegion *subRegion = region->getSubregion(j);
      if (rect.contains(subRegion->getBBox()))
        scanSubRegion(subRegion, index, regionsReference, rect);
    }
  }

  QMap<int, Region>::Iterator it;
  for (it = regionsReference.begin(); it != regionsReference.end(); it++) {
    pbx += it.value().m_barycentre.x;
    pby += it.value().m_barycentre.y;
    totalArea += it.value().m_area;
  }

  if (totalArea > 0)
    referenceB = TPointD(pbx / totalArea, pby / totalArea);
  else
    referenceB = TPointD(0.0, 0.0);
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:38,代码来源:autofillpli.cpp


示例15: raster

//!Converts a TVectorImage into a TRasterImage. The input vector image
//!is transformed through the passed affine \b aff, and put into a
//!TRasterImage strictly covering the bounding box of the transformed
//!vector image. The output image has its lower-left position in the
//!world reference specified by the \b pos parameter, which is granted to
//!be an integer displacement of the passed value. Additional parameters
//!include an integer \b enlarge by which the output image is enlarged with
//!respect to the transformed image's bbox, and the bool \b transformThickness
//!to specify whether the transformation should involve strokes' thickensses
//!or not.
TRasterImageP TRasterImageUtils::vectorToFullColorImage(
	const TVectorImageP &vimage, const TAffine &aff, TPalette *palette,
	const TPointD &outputPos, const TDimension &outputSize,
	const std::vector<TRasterFxRenderDataP> *fxs, bool transformThickness)
{
	if (!vimage || !palette)
		return 0;

	//Transform the vector image through aff
	TVectorImageP vi = vimage->clone();
	vi->transform(aff, transformThickness);

	//Allocate the output ToonzImage
	TRaster32P raster(outputSize.lx, outputSize.ly);
	raster->clear();
	TRasterImageP ri(raster);
	ri->setPalette(palette->clone());

	//Shift outputPos to the origin
	vi->transform(TTranslation(-outputPos));

	int strokeCount = vi->getStrokeCount();
	std::vector<int> strokeIndex(strokeCount);
	std::vector<TStroke *> strokes(strokeCount);
	int i;
	for (i = 0; i < strokeCount; ++i) {
		strokeIndex[i] = i;
		strokes[i] = vi->getStroke(i);
	}
	vi->notifyChangedStrokes(strokeIndex, strokes);

	int maxStyleId = palette->getStyleCount() - 1;
	for (i = 0; i < (int)vi->getRegionCount(); ++i) {
		TRegion *region = vi->getRegion(i);
		fastAddPaintRegion(ri, region, tmin(maxStyleId, region->getStyle()), maxStyleId);
	}

	set<int> colors;
	if (fxs) {
		for (i = 0; i < (int)fxs->size(); i++) {
			SandorFxRenderData *sandorData = dynamic_cast<SandorFxRenderData *>((*fxs)[i].getPointer());
			if (sandorData && sandorData->m_type == BlendTz) {
				std::string indexes = toString(sandorData->m_blendParams.m_colorIndex);
				std::vector<std::string> items;
				parseIndexes(indexes, items);
				PaletteFilterFxRenderData paletteFilterData;
				insertIndexes(items, &paletteFilterData);
				colors = paletteFilterData.m_colors;
				break;
			}
		}
	}

	for (i = 0; i < strokeCount; ++i) {
		TStroke *stroke = vi->getStroke(i);

		bool visible = false;
		int styleId = stroke->getStyle();
		TColorStyleP style = palette->getStyle(styleId);
		assert(style);
		int colorCount = style->getColorParamCount();
		if (colorCount == 0)
			visible = true;
		else {
			visible = false;
			for (int j = 0; j < style->getColorParamCount() && !visible; j++) {
				TPixel32 color = style->getColorParamValue(j);
				if (color.m != 0)
					visible = true;
			}
		}
		if (visible)
			fastAddInkStroke(ri, stroke, TRectD(), 1, true);
	}
	return ri;
}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:86,代码来源:trasterimageutils.cpp


示例16: rect_autofill_apply

bool rect_autofill_apply(const TVectorImageP &imgToApply, const TRectD &rect,
                         bool selective) {
  if (rect.getLx() * rect.getLy() < MIN_SIZE) return false;

  if (regionsReference.size() <= 0) return false;

  double pbx, pby;
  double totalArea = 0;
  pbx = pby = 0.0;

  if (!regionsWork.isEmpty()) regionsWork.clear();

  int i, index = 0, regionCount = imgToApply->getRegionCount();
  for (i = 0; i < regionCount; i++) {
    TRegion *region = imgToApply->getRegion(i);
    TRectD bbox     = region->getBBox();
    if (rect.contains(bbox)) {
      scanRegion(region, index, regionsWork, rect);
      index++;
    }
    int j, subRegionCount = region->getSubregionCount();
    for (j = 0; j < subRegionCount; j++) {
      TRegion *subRegion = region->getSubregion(j);
      if (rect.contains(subRegion->getBBox()))
        scanSubRegion(subRegion, index, regionsWork, rect);
    }
  }

  if (regionsWork.size() <= 0) return false;

  QMap<int, Region>::Iterator it;
  for (it = regionsWork.begin(); it != regionsWork.end(); it++) {
    pbx += it.value().m_barycentre.x;
    pby += it.value().m_barycentre.y;
    totalArea += it.value().m_area;
  }

  workB = TPointD(pbx / totalArea, pby / totalArea);

  std::vector<MatchingProbs> probVector;

  RegionDataList::Iterator refIt, workIt;
  for (refIt = regionsReference.begin(); refIt != regionsReference.end();
       refIt++)
    for (workIt = regionsWork.begin(); workIt != regionsWork.end(); workIt++)
      assignProbs(probVector, refIt.value(), workIt.value(), refIt.key(),
                  workIt.key());

  bool filledRegions = false;
  for (refIt = regionsReference.begin(); refIt != regionsReference.end();
       refIt++) {
    int to = 0, from = 0;
    int valore = 0;
    do
      valore = match(probVector, from, to);
    while ((regionsWork[to].m_match != -1 ||
            regionsReference[from].m_match != -1) &&
           valore > 0);
    if (valore > AMB_TRESH) {
      regionsWork[to].m_match        = from;
      regionsReference[from].m_match = to;
      regionsWork[to].m_styleId      = regionsReference[from].m_styleId;
      TRegion *reg                   = regionsWork[to].m_region;
      if (reg && (!selective || selective && reg->getStyle() == 0)) {
        reg->setStyle(regionsWork[to].m_styleId);
        filledRegions = true;
      }
    }
  }
  return filledRegions;
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:71,代码来源:autofillpli.cpp


示例17: stroke_autofill_apply

bool stroke_autofill_apply(const TVectorImageP &imgToApply, TStroke *stroke,
                           bool selective) {
  if (!imgToApply || !stroke || stroke->getControlPointCount() == 0)
    return false;
  TVectorImage appImg;
  TStroke *appStroke = new TStroke(*stroke);
  appImg.addStroke(appStroke);
  appImg.findRegions();

  if (regionsReference.size() <= 0) return false;

  double pbx, pby;
  double totalArea = 0;
  pbx = pby = 0.0;

  if (!regionsWork.isEmpty()) regionsWork.clear();

  int i, j, index = 0;

  for (i = 0; i < (int)imgToApply->getRegionCount(); i++) {
    TRegion *currentRegion = imgToApply->getRegion(i);
    for (j = 0; j < (int)appImg.getRegionCount(); j++) {
      TRegion *region = appImg.getRegion(j);
      if (contains(region, currentRegion)) {
        scanRegion(currentRegion, index, regionsWork, region->getBBox());
        index++;
        int k, subRegionCount = currentRegion->getSubregionCount();
        for (k = 0; k < subRegionCount; k++) {
          TRegion *subRegion = currentRegion->getSubregion(k);
          if (contains(region, subRegion))
            scanSubRegion(subRegion, index, regionsWork, region->getBBox());
        }
      }
    }
  }

  if (regionsWork.size() <= 0) return false;

  QMap<int, Region>::Iterator it;
  for (it = regionsWork.begin(); it != regionsWork.end(); it++) {
    pbx += it.value().m_barycentre.x;
    pby += it.value().m_barycentre.y;
    totalArea += it.value().m_area;
  }

  workB = TPointD(pbx / totalArea, pby / totalArea);

  std::vector<MatchingProbs> probVector;

  RegionDataList::Iterator refIt, workIt;
  for (refIt = regionsReference.begin(); refIt != regionsReference.end();
       refIt++)
    for (workIt = regionsWork.begin(); workIt != regionsWork.end(); workIt++)
      assignProbs(probVector, refIt.value(), workIt.value(), refIt.key(),
                  workIt.key());

  bool filledRegions = false;
  for (refIt = regionsReference.begin(); refIt != regionsReference.end();
       refIt++) {
    int to = 0, from = 0;
    int valore = 0;
    do
      valore = match(probVector, from, to);
    while ((regionsWork[to].m_match != -1 ||
            regionsReference[from].m_match != -1) &&
           valore > 0);
    if (valore > AMB_TRESH) {
      regionsWork[to].m_match        = from;
      regionsReference[from].m_match = to;
      regionsWork[to].m_styleId      = regionsReference[from].m_styleId;
      TRegion *reg                   = regionsWork[to].m_region;
      if (reg && (!selective || selective && reg->getStyle() == 0)) {
        reg->setStyle(regionsWork[to].m_styleId);
        filledRegions = true;
      }
    }
  }
  return filledRegions;
}
开发者ID:walkerka,项目名称:opentoonz,代码行数:79,代码来源:autofillpli.cpp


示例18: CachedDraw

// TODO: effect area should be reduced if aClipRegion is smaller than aDisplayRect.
TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha)
    {
#ifdef HUIFX_TRACE    
    RDebug::Print(_L("CHuiFxEffect::CachedDraw - 0x%x"), this);
#endif    
    iFramesDrawn++;
    if (!CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces))
        {
        return EFalse;
        }
            
    
    CHuiFxRenderbuffer* target = NULL;
    
    // Prepare all layers
    TRect displayArea = aGc.DisplayArea();
    TRect targetArea = aDisplayRect;
    targetArea.Intersection(displayArea);

    if (targetArea.Width() <= 0 || targetArea.Height() <= 0)
        {
        // Not visible
        return ETrue;
        }

    if (!iEngine || !iRoot)
        {
        return EFalse;
        }

    if (iEngine->LowMemoryState())
        {
        // No memory, no effects.
        return EFalse;
        }
    
    // Check if margins are allowed to be used for this effect
    if (EffectFlags() & KHuiFxEffectDisableMarginsFlag)
        {
        iRoot->EnableMargin(EFalse);
        }

    // Check if surface pixels are to be used for this effect in all layers.
    if (EffectFlags() & KHuiFxEnableBackgroundInAllLayers)
        {
        iRoot->SetAlwaysReadSurfacePixels(ETrue);
        }
    
    iRoot->SetTargetRect(targetArea);
    iRoot->SetSourceRect(targetArea);        
    iRoot->SetDisplayArea(displayArea);
    
    TRAPD(err, iRoot->PrepareDrawL(*iEngine));
    
    if (err != KErrNone)
        {
        return EFalse;
        }

    if (IsCachedRenderTargetSupported() && IsCachedRenderTargetPreferred())
        {
        // Background needs to be captured from surface if effect uses background AND 
        // Visual is transparent or margin is enabled AND
        // Background has not been disabled with a effect specific flag
        TBool enableBackground = IsAppliedToBackground() && (!aOpaque || iRoot->IsMarginEnabled()) && !(EffectFlags() & KHuiFxDisableBackground);
        
        if (EffectFlags() & KHuiFxEnableBackgroundInAllLayers)
            {
            enableBackground = ETrue;
            }
        
        TBool useFrozenBackground = (EffectFlags() & KHuiFxFrozenBackground);
        
        // Check if cache is up-to date or does it need to be refreshed
        TBool cachedRenderTargetNeedsRefresh = (iRoot->Changed() || aRefreshCachedRenderTarget || (enableBackground && !useFrozenBackground));
        if (!iCachedRenderTarget || (iCachedRenderTarget && iCachedRenderTarget->Size() !=  iRoot->VisualRect().Size())) 
            {
            cachedRenderTargetNeedsRefresh = ETrue;
            }

        // Try to apply also margins, we cannot just use aDisplayRect directly
        TRect targetRect = iRoot->VisualRect();
        
        // Size is always same as target rect. It contains margins if those are enabled.
        TSize cachedRenderTargetSize = targetRect.Size();        
                
        // Prepare cached offscreen render target
        PrepareCachedRenderTarget(targetRect.iTl, cachedRenderTargetSize, cachedRenderTargetNeedsRefresh, enableBackground);
        
        // If it is available, then lets do it 
        if (iCachedRenderTarget)
            {
            // Disable clipping, otherwise strange things happen.
            aGc.Disable(CHuiGc::EFeatureClipping);             
            if (cachedRenderTargetNeedsRefresh)
                {
                // Render to cached render target
                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget, aHasSurface);                
#ifdef HUIFX_TRACE    
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:101,代码来源:HuiFxEffect.cpp


示例19: ClipRegion

EXPORT_C void CHuiCanvasGc::ClipRegion(const TRegion& aClipRegion)
    {
    if (!iGc)
       {
       return;    
       }

    switch (iClipMode)
        {
        case EHuiCanvasClipModeNormal:
            {
            // If previous clipping region set, cancel it first.
            if (iClippingRegion.Count())
                {
                CancelClipping();    
                }
                
            // Set new region, ignore empty rects if any
            for (TInt i=0; i < aClipRegion.Count(); i++)
                {
                if (!aClipRegion[i].IsEmpty())
                    {
                    iClippingRegion.AddRect(aClipRegion[i]);    
                    }                                        
                }
            
            iClippingRegion.Tidy();
            
            if (iClippingRegion.Count() == 1)
                {
                // If only one rect, then do simple clipping...                    
                iGc->Enable(CHuiGc::EFeatureClipping);
                iGc->PushClip();
                iGc->Clip(iClippingRegion[0]);                
                }
            else if (iClippingRegion.Count() > 1)
                {
                // ...otherewise must do region clipping.
                iGc->Enable(CHuiGc::EFeatureClipping);
                iGc->PushClip();
                if (MaxNumberOfClipRects() > 1)
                    {
                    iGc->Clip(iClippingRegion);                    
                    }
                else
                    {
                    // region clipping is not available, try boundingrect
                    iGc->Clip(iClippingRegion.BoundingRect());                                        
                    }
                }
            else
                {
                // No clip rects set, do nothing here.    
                }                                
            break;
            }
        case EHuiCanvasClipModeDelayed:
            {
            // If previous clipping region set, cancel it first.
            if (iClippingRegion.Count())
                {
                CancelClipping();    
                }
                
            // Set new region, ignore empty rects if any
            for (TInt i=0; i < aClipRegion.Count(); i++)
                {
                if (!aClipRegion[i].IsEmpty())
                    {
                    iClippingRegion.AddRect(aClipRegion[i]);    
                    }                    
                }

            iClippingRegion.Tidy();
            break;    
            }
        case EHuiCanvasClipModeNone:
        default:
            {
            // Do nothing            
            break;    
            }
        }    
    }  
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:84,代码来源:huicanvasgc.cpp



注:本文中的TRegion类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TRegistry类代码示例发布时间:2022-05-31
下一篇:
C++ TRefCountPtr类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap