本文整理汇总了C++中Rect::Intersection方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::Intersection方法的具体用法?C++ Rect::Intersection怎么用?C++ Rect::Intersection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rect
的用法示例。
在下文中一共展示了Rect::Intersection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Rect
Rect
Image::GetCoverageBounds ()
{
// FIXME: SL3 final only supports PixelFormatPbgra32 which makes this optimization
// obsolete - unless we keep an "has_alpha" flag with each image ?!?
return Rect ();
#if FALSE
ImageSource *source = GetSource ();
if (!source || source->GetPixelFormat () == PixelFormatPbgra32)
return Rect ();
Stretch stretch = GetStretch ();
if (stretch == StretchFill || stretch == StretchUniformToFill)
return bounds;
cairo_matrix_t matrix;
Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ());
Rect paint = Rect (0, 0, GetActualWidth (), GetActualHeight ());
image_brush_compute_pattern_matrix (&matrix,
paint.width, paint.height,
image.width, image.height, stretch,
AlignmentXCenter, AlignmentYCenter, NULL, NULL);
cairo_matrix_invert (&matrix);
cairo_matrix_multiply (&matrix, &matrix, &absolute_xform);
image = image.Transform (&matrix);
image = image.Intersection (bounds);
return image;
#endif
}
示例2:
void
Context::Push (Clip clip)
{
cairo_matrix_t matrix;
Rect box;
Top ()->GetMatrix (&matrix);
Top ()->GetClip (&box);
box = box.Intersection (clip.r);
Stack::Push (new Context::Node (Top ()->GetSurface (), &matrix, &box));
}
示例3: Push
cairo_t *
MoonEGLContext::Push (Cairo extents)
{
Target *target = Top ()->GetTarget ();
Target *cairo = target->GetCairoTarget ();
Rect box;
Top ()->GetClip (&box);
box = box.Intersection (extents.r);
if (box.IsEmpty ())
return Context::Push (extents);
if (cairo) {
Rect r = cairo->GetData (NULL);
Region *region = new Region (r);
if (region->RectIn (box) != CAIRO_REGION_OVERLAP_IN) {
ForceCurrent ();
SyncDrawable ();
}
delete region;
}
if (!target->GetCairoTarget ()) {
MoonSurface *ms;
Rect r = target->GetData (&ms);
if (HasDrawable ()) {
MoonEGLSurface *surface = new MoonEGLSurface (box.width,
box.height);
Target *cairo = new Target (surface, box);
target->SetCairoTarget (cairo);
cairo->unref ();
surface->unref ();
}
else {
// mark target contents as initialized
target->SetInit (ms);
}
ms->unref ();
}
return Context::Push (extents);
}
示例4: ClipRect
void RenderManager::ClipRect(const Rect &rect)
{
Rect r = currentClip;
if(r.dx < 0)
{
r.dx = (float32)retScreenWidth;
}
if(r.dy < 0)
{
r.dy = (float32)retScreenHeight;
}
r = r.Intersection(rect);
SetHWClip(rect);
}
示例5: specified
void
Image::Render (cairo_t *cr, Region *region, bool path_only)
{
ImageSource *source = GetSource ();
cairo_pattern_t *pattern = NULL;
cairo_matrix_t matrix;
if (!source)
return;
source->Lock ();
cairo_save (cr);
Size specified (GetActualWidth (), GetActualHeight ());
Size stretched = ApplySizeConstraints (specified);
bool adjust = specified != GetRenderSize ();
if (GetStretch () != StretchUniformToFill)
specified = specified.Min (stretched);
Rect paint = Rect (0, 0, specified.width, specified.height);
if (!path_only) {
Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ());
if (GetStretch () == StretchNone)
paint = paint.Union (image);
if (image.width == 0.0 && image.height == 0.0)
goto cleanup;
pattern = cairo_pattern_create_for_surface (source->GetSurface (cr));
image_brush_compute_pattern_matrix (&matrix, paint.width, paint.height,
image.width, image.height,
GetStretch (),
AlignmentXCenter, AlignmentYCenter, NULL, NULL);
cairo_pattern_set_matrix (pattern, &matrix);
#if MAKE_EVERYTHING_SLOW_AND_BUGGY
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
#endif
if (cairo_pattern_status (pattern) == CAIRO_STATUS_SUCCESS) {
cairo_set_source (cr, pattern);
}
cairo_pattern_destroy (pattern);
}
if (adjust) {
// FIXME: Propagate error properly
MoonError error;
specified = MeasureOverrideWithError (specified, &error);
paint = Rect ((stretched.width - specified.width) * 0.5, (stretched.height - specified.height) * 0.5, specified.width, specified.height);
}
if (!path_only)
RenderLayoutClip (cr);
paint = paint.Intersection (Rect (0, 0, stretched.width, stretched.height));
paint.Draw (cr);
if (!path_only)
cairo_fill (cr);
cleanup:
cairo_restore (cr);
source->Unlock ();
}