static void fxDodgeProcessSubject (CompWindow *wCur, Region wRegion, Region dodgeRegion, Bool alwaysInclude) { XRectangle rect; rect.x = WIN_X(wCur); rect.y = WIN_Y(wCur); rect.width = WIN_W(wCur); rect.height = WIN_H(wCur); Region wCurRegion = XCreateRegion(); if (!wCurRegion) return; XUnionRectWithRegion(&rect, &emptyRegion, wCurRegion); if (!alwaysInclude) { Region intersectionRegion = XCreateRegion(); if (intersectionRegion) { XIntersectRegion(wRegion, wCurRegion, intersectionRegion); if (!XEmptyRegion(intersectionRegion)) XUnionRegion(dodgeRegion, wCurRegion, dodgeRegion); XDestroyRegion (intersectionRegion); } } else XUnionRegion(dodgeRegion, wCurRegion, dodgeRegion); XDestroyRegion (wCurRegion); }
static void clonePreparePaintScreen(CompScreen * s, int msSinceLastPaint) { int i; CLONE_SCREEN(s); if (cs->grab) { if (cs->grabIndex) { cs->offset -= msSinceLastPaint * 0.005f; if (cs->offset < 0.0f) cs->offset = 0.0f; } else { cs->offset += msSinceLastPaint * 0.005f; if (cs->offset >= 1.0f) cs->offset = 1.0f; } } UNWRAP(cs, s, preparePaintScreen); (*s->preparePaintScreen) (s, msSinceLastPaint); WRAP(cs, s, preparePaintScreen, clonePreparePaintScreen); for (i = 0; i < cs->nClone; i++) { CompOutput *src = &s->outputDev[cs->clone[i].src]; CompOutput *dst = &s->outputDev[cs->clone[i].dst]; int dx, dy; dx = dst->region.extents.x1 - src->region.extents.x1; dy = dst->region.extents.y1 - src->region.extents.y1; if (s->damageMask & COMP_SCREEN_DAMAGE_REGION_MASK) { if (src->width != dst->width || src->height != dst->height) { XSubtractRegion(&dst->region, &emptyRegion, cs->clone[i].region); XUnionRegion(s->damage, cs->clone[i].region, s->damage); XSubtractRegion(&src->region, &emptyRegion, cs->clone[i].region); } else { XSubtractRegion(s->damage, &dst->region, cs->clone[i].region); XOffsetRegion(cs->clone[i].region, dx, dy); XUnionRegion(s->damage, cs->clone[i].region, s->damage); XSubtractRegion(s->damage, &src->region, cs->clone[i].region); XOffsetRegion(cs->clone[i].region, -dx, -dy); } } else { XSubtractRegion(&src->region, &emptyRegion, cs->clone[i].region); } } }
/* Generates a region containing free space (here the * active window counts as free space). The region argument * is the start-region (ie: the output dev). */ static Region smartputEmptyRegion (CompWindow *window, Region region) { CompScreen *s = window->screen; CompWindow *w; Region newRegion, tmpRegion; XRectangle tmpRect; newRegion = XCreateRegion (); if (!newRegion) return NULL; tmpRegion = XCreateRegion (); if (!tmpRegion) { XDestroyRegion (newRegion); return NULL; } XUnionRegion (region, newRegion, newRegion); for (w = s->windows; w; w = w->next) { EMPTY_REGION (tmpRegion); if (w->id == window->id) continue; if (w->invisible || w->hidden || w->minimized) continue; if (w->wmType & CompWindowTypeDesktopMask) continue; if (w->wmType & CompWindowTypeDockMask) { if (w->struts) { XUnionRectWithRegion (&w->struts->left, tmpRegion, tmpRegion); XUnionRectWithRegion (&w->struts->right, tmpRegion, tmpRegion); XUnionRectWithRegion (&w->struts->top, tmpRegion, tmpRegion); XUnionRectWithRegion (&w->struts->bottom, tmpRegion, tmpRegion); XSubtractRegion (newRegion, tmpRegion, newRegion); } continue; } tmpRect.x = w->serverX - w->input.left; tmpRect.y = w->serverY - w->input.top; tmpRect.width = w->serverWidth + w->input.right + w->input.left; tmpRect.height = w->serverHeight + w->input.top + w->input.bottom; XUnionRectWithRegion (&tmpRect, tmpRegion, tmpRegion); XSubtractRegion (newRegion, tmpRegion, newRegion); } XDestroyRegion (tmpRegion); return newRegion; }
void sXClipPushUpdate() { sVERIFY(ClipIndex<MAX_CLIPS); ClipIndex++; XUnionRegion(UpdateRegion,EmptyRegion,ClipStack[ClipIndex]); sChangedRegions(); }
/* lpStruct - Destination Region */ DWORD DrvRegionsUnionRegion(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct) { XUnionRegion((Region)dwParm1, (Region)dwParm2, (Region)lpStruct); return (DWORD)(XEmptyRegion((Region)lpStruct)? NULLREGION:COMPLEXREGION); }
EAPI Eina_Bool ecore_x_xregion_union(Ecore_X_XRegion *dst, Ecore_X_XRegion *r1, Ecore_X_XRegion *r2) { LOGFN(__FILE__, __LINE__, __FUNCTION__); return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; } /* ecore_x_xregion_union */
CompRegion CompRegion::united (const CompRect &r) const { CompRegion rv; rv.priv->makeReal (); XUnionRegion (handle (), r.region (), rv.handle ()); return rv; }
Bool apc_region_combine( Handle self, Handle other_region, int rgnop) { PRegionSysData r2; int d; Bool ok = true; r2 = GET_REGION(other_region); if ( rgnop == rgnopCopy ) { if ( REGION ) XDestroyRegion( REGION ); REGION = XCreateRegion(); XUnionRegion( REGION, r2->region, REGION); HEIGHT = r2-> height; return true; } d = HEIGHT - r2-> height; if ( d > 0 ) XOffsetRegion( r2-> region, 0, d); else XOffsetRegion( REGION, 0, -d); switch (rgnop) { case rgnopIntersect: XIntersectRegion( REGION, r2->region, REGION); break; case rgnopUnion: XUnionRegion( REGION, r2->region, REGION); break; case rgnopXor: XXorRegion( REGION, r2->region, REGION); break; case rgnopDiff: XSubtractRegion( REGION, r2->region, REGION); break; default: ok = false; } if ( d > 0 ) XOffsetRegion( r2-> region, 0, -d); else HEIGHT = r2-> height; return ok; }
Bool apc_gp_set_region( Handle self, Handle rgn) { DEFXX; Region region; PRegionSysData r; if ( PObject( self)-> options. optInDrawInfo) return false; if ( !XF_IN_PAINT(XX)) return false; if (rgn == nilHandle) { Rect r; r. left = 0; r. bottom = 0; r. right = XX-> size. x - 1; r. top = XX-> size. y - 1; return apc_gp_set_clip_rect( self, r); } r = GET_REGION(rgn); XClipBox( r-> region, &XX-> clip_rect); XX-> clip_rect. y += XX-> size. y - r-> height; XX-> clip_mask_extent. x = XX-> clip_rect. width; XX-> clip_mask_extent. y = XX-> clip_rect. height; if ( XX-> clip_rect. width == 0 || XX-> clip_rect. height == 0) { Rect r; r. left = -1; r. bottom = -1; r. right = -1; r. top = -1; return apc_gp_set_clip_rect( self, r); } region = XCreateRegion(); XUnionRegion( region, r-> region, region); /* offset region if drawable is buffered */ XOffsetRegion( region, XX-> btransform. x, XX-> size.y - r-> height - XX-> btransform. y); /* otherwise ( and only otherwise ), and if there's a X11 clipping, intersect the region with it. X11 clipping must not mix with the buffer clipping */ if (( !XX-> udrawable || XX-> udrawable == XX-> gdrawable) && XX-> paint_region) XIntersectRegion( region, XX-> paint_region, region); XSetRegion( DISP, XX-> gc, region); if ( XX-> flags. kill_current_region) XDestroyRegion( XX-> current_region); XX-> flags. kill_current_region = 1; XX-> current_region = region; XX-> flags. xft_clip = 0; #ifdef USE_XFT if ( XX-> xft_drawable) prima_xft_update_region( self); #endif #ifdef HAVE_X11_EXTENSIONS_XRENDER_H if ( XX-> argb_picture ) XRenderSetPictureClipRegion(DISP, XX->argb_picture, region); #endif return true; }
void damageScreenRegion (CompScreen *screen, Region region) { if (screen->allDamaged) return; XUnionRegion (screen->damage, region, screen->damage); }
void PrivateRegion::makeReal () { if (region) return; region = XCreateRegion (); if (box.numRects) XUnionRegion (CompRegion ().handle (), &box, region); }
// Union region r with this one FXRegion FXRegion::operator+(const FXRegion& r) const { FXRegion res; #ifdef WIN32 CombineRgn((HRGN)res.region,(HRGN)region,(HRGN)r.region,RGN_OR); #else XUnionRegion((Region)region,(Region)r.region,(Region)res.region); #endif return res; }
// Construct new region copied from region r FXRegion::FXRegion(const FXRegion& r){ #ifdef WIN32 region=(void*)CreateRectRgn(0,0,0,0); CombineRgn((HRGN)region,(HRGN)r.region,(HRGN)region,RGN_COPY); #else region=XCreateRegion(); XUnionRegion((Region)r.region,(Region)region,(Region)region); #endif }
static PyObject * region_UnionRegion(PaxRegionObject *self, PyObject *args) { PaxRegionObject *r; if (!PyArg_ParseTuple(args, "O!", &PaxRegionType, &r)) return NULL; XUnionRegion(self->region, r->region, self->region); Py_INCREF(Py_None); return Py_None; }
/* dwParm1 - Region to set empty */ DWORD DrvRegionsSetRegionEmpty(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct) { static Region EmptyRegion; if (EmptyRegion == None) EmptyRegion = XCreateRegion(); XUnionRegion(EmptyRegion, EmptyRegion, (Region)dwParm1); return (DWORD)NULLREGION; }
Bool XftDrawSetClip (XftDraw *draw, Region r) { Region n = 0; if (!r && !draw->clip) return True; if (r) { n = XCreateRegion (); if (n) { if (!XUnionRegion (n, r, n)) { XDestroyRegion (n); return False; } } } if (draw->clip) { XDestroyRegion (draw->clip); } draw->clip = n; if (draw->render_able) { XRenderPictureAttributes pa; if (n) { XRenderSetPictureClipRegion (draw->dpy, draw->render.pict, n); } else { pa.clip_mask = None; XRenderChangePicture (draw->dpy, draw->render.pict, CPClipMask, &pa); } } if (draw->core_set) { XGCValues gv; if (n) XSetRegion (draw->dpy, draw->core.draw_gc, n); else { gv.clip_mask = None; XChangeGC (draw->dpy, draw->core.draw_gc, GCClipMask, &gv); } } return True; }
// Union region r with this one FXRegion& FXRegion::operator+=(const FXRegion& r){ #ifdef WIN32 CombineRgn((HRGN)region,(HRGN)region,(HRGN)r.region,RGN_OR); #else Region res=XCreateRegion(); XUnionRegion((Region)region,(Region)r.region,res); XDestroyRegion((Region)region); region=res; #endif return *this; }
/* dwParm2 - Destination Region */ DWORD DrvRegionsCopyRegion(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct) { static Region EmptyRegion; if (EmptyRegion == None) EmptyRegion = XCreateRegion(); XUnionRegion((Region)dwParm1, EmptyRegion,(Region)dwParm2); return (DWORD)(XEmptyRegion((Region)dwParm2)? NULLREGION:COMPLEXREGION); }
// Assign region r to this one FXRegion& FXRegion::operator=(const FXRegion& r){ #ifdef WIN32 CombineRgn((HRGN)region,(HRGN)r.region,(HRGN)r.region,RGN_COPY); #else if(region!=r.region){ XDestroyRegion((Region)region); region=XCreateRegion(); XUnionRegion((Region)r.region,(Region)region,(Region)region); } #endif return *this; }
CompRegion::CompRegion (const CompRegion &c) { priv = new PrivateRegion (); priv->box = c.priv->box; if (priv->box.rects) priv->box.rects = &priv->box.extents; if (c.priv->region) { priv->region = XCreateRegion (); XUnionRegion (CompRegion ().handle (), c.priv->region, priv->region); } }
Region get_merged_region(LEAFPTR actual_region) { Region merged; merged = XCreateRegion(); /*Compute the union of all the regions that has been merged*/ while (actual_region!=NULL) { XUnionRegion (merged,(actual_region->leaf_ptr)->region,merged); actual_region=actual_region->next; } return(merged); }
void X11Graphics::drawGraphics( const OSGraphics &rGraphics, int xSrc, int ySrc, int xDest, int yDest, int width, int height ) { const X11Graphics& rGraph = (X11Graphics&)rGraphics; // check and adapt to source if needed if( !checkBoundaries( 0, 0, rGraph.getWidth(), rGraph.getHeight(), xSrc, ySrc, width, height ) ) { msg_Err( getIntf(), "nothing to draw from graphics source" ); return; } // check destination if( !checkBoundaries( 0, 0, m_width, m_height, xDest, yDest, width, height ) ) { msg_Err( getIntf(), "out of reach destination! pls, debug your skin" ); return; } // Source drawable Drawable src = rGraph.getDrawable(); // Create the mask for transparency Region voidMask = XCreateRegion(); XRectangle rect; rect.x = xSrc; rect.y = ySrc; rect.width = width; rect.height = height; Region clipMask = XCreateRegion(); XUnionRectWithRegion( &rect, voidMask, clipMask ); Region mask = XCreateRegion(); XIntersectRegion( rGraph.getMask(), clipMask, mask ); XDestroyRegion( clipMask ); XDestroyRegion( voidMask ); XOffsetRegion( mask, xDest - xSrc, yDest - ySrc ); // Copy the pixmap XSetRegion( XDISPLAY, m_gc, mask ); XCopyArea( XDISPLAY, src, m_pixmap, m_gc, xSrc, ySrc, width, height, xDest, yDest ); // Add the source mask to the mask of the graphics Region newMask = XCreateRegion(); XUnionRegion( m_mask, mask, newMask ); XDestroyRegion( mask ); XDestroyRegion( m_mask ); m_mask = newMask; }
void X11Graphics::drawGraphics( const OSGraphics &rGraphics, int xSrc, int ySrc, int xDest, int yDest, int width, int height ) { if( width == -1 ) { width = rGraphics.getWidth(); } if( height == -1 ) { height = rGraphics.getHeight(); } // Source drawable Drawable src = ((X11Graphics&)rGraphics).getDrawable(); // Create the mask for transparency Region voidMask = XCreateRegion(); XRectangle rect; rect.x = xSrc; rect.y = ySrc; rect.width = width; rect.height = height; Region clipMask = XCreateRegion(); XUnionRectWithRegion( &rect, voidMask, clipMask ); Region mask = XCreateRegion(); XIntersectRegion( ((X11Graphics&)rGraphics).getMask(), clipMask, mask ); XDestroyRegion( clipMask ); XDestroyRegion( voidMask ); XOffsetRegion( mask, xDest - xSrc, yDest - ySrc ); // Copy the pixmap XSetRegion( XDISPLAY, m_gc, mask ); XCopyArea( XDISPLAY, src, m_pixmap, m_gc, xSrc, ySrc, width, height, xDest, yDest ); // Add the source mask to the mask of the graphics Region newMask = XCreateRegion(); XUnionRegion( m_mask, mask, newMask ); XDestroyRegion( mask ); XDestroyRegion( m_mask ); m_mask = newMask; }
bool wxRegion::DoUnionWithRegion( const wxRegion& region ) { wxCHECK_MSG( region.Ok(), false, wxT("invalid region") ); if (!m_refData) { m_refData = new wxRegionRefData(); M_REGIONDATA->m_region = XCreateRegion(); } else { AllocExclusive(); } XUnionRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); return true; }
void sClipPush() { sVERIFY(ClipIndex<MAX_CLIPS); if(ClipIndex) XUnionRegion(ClipStack[ClipIndex],EmptyRegion,ClipStack[ClipIndex+1]); else { sRect client; XRectangle rect; sGetClientArea(client); rect.x = 0; rect.y = 0; rect.width = client.x1; rect.height = client.y1; XUnionRectWithRegion(&rect,EmptyRegion,ClipStack[ClipIndex+1]); } ClipIndex++; sChangedRegions(); }
CompRegion & CompRegion::operator= (const CompRegion &c) { priv->box = c.priv->box; if (priv->box.rects) priv->box.rects = &priv->box.extents; if (c.priv->region) { if (!priv->region) priv->region = XCreateRegion (); XUnionRegion (CompRegion ().handle (), c.priv->region, priv->region); } else { if (priv->region) { XDestroyRegion (priv->region); priv->region = NULL; } } return *this; }
bool wxRegion::Union( const wxRegion& region ) { #if 0 if (region.IsNull()) return FALSE; if (!m_refData) { m_refData = new wxRegionRefData(); M_REGIONDATA->m_region = XCreateRegion(); } else { AllocExclusive(); } XUnionRegion( M_REGIONDATA->m_region, M_REGIONDATA_OF(region)->m_region, M_REGIONDATA->m_region ); #endif return TRUE; }
/* * Kreslení */ static void expose(XExposeEvent *event) { Region region, region1, region2; XRectangle rect; if(event->count > 0) return; /* Kreslit jen po poslední události v øadì */ XDrawArc(display, topwin, my_gc, 20, 20, topwin_w - 40, topwin_h - 40, 0, 360 * 64); region = XCreateRegion(); region1 = XCreateRegion(); region2 = XCreateRegion(); rect.x = rect.y = 0; rect.width = 100; rect.height = topwin_w - 60; XUnionRectWithRegion(&rect, region, region1); rect.width = 20; rect.height = 10; XUnionRectWithRegion(&rect, region2, region); XOffsetRegion(region, 50, 100); XSubtractRegion(region1, region, region2); XDestroyRegion(region); region = XCreateRegion(); rect.width = 100; rect.height = 30; XUnionRectWithRegion(&rect, region, region1); XOffsetRegion(region1, (int)topwin_w - 120, -30 + ((int)topwin_h - 40) / 2); XUnionRegion(region1, region2, region); XSetRegion(display, my_gc, region); XDestroyRegion(region); XDestroyRegion(region1); XDestroyRegion(region2); XSetClipOrigin(display, my_gc, 20, 20); XFillArc(display, topwin, my_gc, 20, 20, topwin_w - 40, topwin_h - 40, 0, 360 * 64); XSetClipMask(display, my_gc, None); /* Zru¹it oøezávání */ }
void X11Graphics::drawBitmap( const GenericBitmap &rBitmap, int xSrc, int ySrc, int xDest, int yDest, int width, int height, bool blend ) { // Get the bitmap size if necessary if( width == -1 ) { width = rBitmap.getWidth(); } else if( width > rBitmap.getWidth() ) { msg_Dbg( getIntf(), "bitmap width too small (%i)", rBitmap.getWidth() ); width = rBitmap.getWidth(); } if( height == -1 ) { height = rBitmap.getHeight(); } else if( height > rBitmap.getHeight() ) { msg_Dbg( getIntf(), "bitmap height too small (%i)", rBitmap.getHeight() ); height = rBitmap.getHeight(); } // Nothing to draw if width or height is null if( width == 0 || height == 0 ) { return; } // Safety check for debugging purpose if( xDest + width > m_width || yDest + height > m_height ) { msg_Dbg( getIntf(), "bitmap too large" ); return; } // Get a buffer on the image data uint8_t *pBmpData = rBitmap.getData(); if( pBmpData == NULL ) { // Nothing to draw return; } // Get the image from the pixmap XImage *pImage = XGetImage( XDISPLAY, m_pixmap, xDest, yDest, width, height, AllPlanes, ZPixmap ); if( pImage == NULL ) { msg_Dbg( getIntf(), "XGetImage returned NULL" ); return; } char *pData = pImage->data; // Get the padding of this image int pad = pImage->bitmap_pad >> 3; int shift = ( pad - ( (width * XPIXELSIZE) % pad ) ) % pad; // Mask for transparency Region mask = XCreateRegion(); // Get a pointer on the right X11Display::makePixel method X11Display::MakePixelFunc_t makePixelFunc = ( blend ? m_rDisplay.getBlendPixel() : m_rDisplay.getPutPixel() ); // Skip the first lines of the image pBmpData += 4 * ySrc * rBitmap.getWidth(); // Copy the bitmap on the image and compute the mask for( int y = 0; y < height; y++ ) { // Skip uninteresting bytes at the beginning of the line pBmpData += 4 * xSrc; // Flag to say whether the previous pixel on the line was visible bool wasVisible = false; // Beginning of the current visible segment on the line int visibleSegmentStart = 0; for( int x = 0; x < width; x++ ) { uint8_t b = *(pBmpData++); uint8_t g = *(pBmpData++); uint8_t r = *(pBmpData++); uint8_t a = *(pBmpData++); // Draw the pixel (m_rDisplay.*makePixelFunc)( (uint8_t*)pData, r, g, b, a ); pData += XPIXELSIZE; if( a > 0 ) { // Pixel is visible if( ! wasVisible ) { // Beginning of a visible segment visibleSegmentStart = x; } wasVisible = true; } else { // Pixel is transparent if( wasVisible ) { // End of a visible segment: add it to the mask addHSegmentInRegion( mask, visibleSegmentStart, x, y ); } wasVisible = false; } } if( wasVisible ) { // End of a visible segment: add it to the mask addHSegmentInRegion( mask, visibleSegmentStart, width, y ); } pData += shift; // Skip uninteresting bytes at the end of the line pBmpData += 4 * (rBitmap.getWidth() - width - xSrc); } // Apply the mask to the graphics context XOffsetRegion( mask, xDest, yDest ); XSetRegion( XDISPLAY, m_gc, mask ); // Copy the image on the pixmap XPutImage( XDISPLAY, m_pixmap, m_gc, pImage, 0, 0, xDest, yDest, width, height); XDestroyImage( pImage ); // Add the bitmap mask to the global graphics mask Region newMask = XCreateRegion(); XUnionRegion( mask, m_mask, newMask ); XDestroyRegion( m_mask ); m_mask = newMask; XDestroyRegion( mask ); }
wxRegionRefData(const wxRegionRefData& refData) { m_region = XCreateRegion(); XUnionRegion( refData.m_region, m_region, m_region ); }