EXPORT_C void CHuiCanvasGc::Clip(const TRect& aClipRect) { if (!iGc) { return; } switch (iClipMode) { case EHuiCanvasClipModeNormal: case EHuiCanvasClipModeDelayed: { if (iClippingRegion.Count()) { CancelClipping(); } if (!aClipRect.IsEmpty()) { iTempRegion.Clear(); iTempRegion.AddRect(aClipRect); ClipRegion(iTempRegion); } break; } case EHuiCanvasClipModeNone: default: { // Do nothing break; } } }
void DirectX9::StartClip() { Flush(); m_pDevice->SetRenderState( D3DRS_SCISSORTESTENABLE, TRUE ); const Gwen::Rect & rect = ClipRegion(); RECT r; r.left = ceil( ( ( float ) rect.x ) * Scale() ); r.right = ceil( ( ( float )( rect.x + rect.w ) ) * Scale() ); r.top = ceil( ( float ) rect.y * Scale() ); r.bottom = ceil( ( ( float )( rect.y + rect.h ) ) * Scale() ); m_pDevice->SetScissorRect( &r ); }
void OpenGL::StartClip() { Flush(); Gwen::Rect rect = ClipRegion(); // OpenGL's coords are from the bottom left // so we need to translate them here. { GLint view[4]; glGetIntegerv( GL_VIEWPORT, &view[0] ); rect.y = view[3] - ( rect.y + rect.h ); } glScissor( rect.x * Scale(), rect.y * Scale(), rect.w * Scale(), rect.h * Scale() ); glEnable( GL_SCISSOR_TEST ); };
void Gwen::Renderer::SFML2::StartClip() { Flush(); Gwen::Rect rect = ClipRegion(); float x = rect.x, y = rect.y, w = rect.w, h = rect.h; // OpenGL's coords are from the bottom left // so we need to translate them here. y = m_Height - ( y + h ); float scale = Scale(); glEnable( GL_SCISSOR_TEST ); glScissor( x * scale, y * scale, w * scale, h * scale ); }
KernelBitmap* GalleryLineDragInfo::GetSolidDragMask() { // Note we abuse this call (like our base class abuses this call) to create the bitmap // itself. We don't use DragMask itself anymore (i.e. it stays NULL) if (!DragMask && !TheBitmap) { DocView *View = DocView::GetCurrent(); if (View == NULL) { return NULL; } Spread *pSpread = View->FindEnclosingSpread(OilCoord(0,0)); if (pSpread == NULL) { return NULL; } // Find the size of the rendered item. DocRect ClipRegion(0,0, 750*100, 750*50); // ClipRegion.lo.x = ClipRegion.lo.y = 0; // SourceItem->GetSize(c_eLineAttrDragTextPos, &ClipRegion.hi.x, &ClipRegion.hi.y); Matrix ConvertMatrix; FIXED16 ViewScale = 1; wxScreenDC DisplayDC; double dpi = (double) OSRenderRegion::GetFixedDCPPI(DisplayDC).GetWidth(); GRenderBitmap* pMaskRegion = new GRenderBitmap(ClipRegion, ConvertMatrix, ViewScale, 32, dpi); pMaskRegion->SetDoCompression(TRUE); // misnamed call to indicate we want transparency pMaskRegion->AttachDevice(View, &DisplayDC, pSpread); // Make a Mask Bitmap pMaskRegion->StartRender(); SourceItem->Render(pMaskRegion, ClipRegion, c_eLineAttrDragTextPos); pMaskRegion->StopRender(); OILBitmap* pOilMaskBmp = pMaskRegion->ExtractBitmap(); TheBitmap = new KernelBitmap(pOilMaskBmp, TRUE); delete pMaskRegion; } return BitmapDragInformation::GetSolidDragMask(); }
void ClanLib::StartClip() { Gwen::Rect rect = ClipRegion(); m_Target.set_cliprect(clan::Rect(rect.x * Scale(), rect.y * Scale(), rect.w * Scale(), rect.h * Scale())); };
void GDIPlus::StartClip() { const Gwen::Rect& rect = ClipRegion(); graphics->SetClip( Gdiplus::Rect( rect.x * Scale(), rect.y* Scale(), rect.w* Scale(), rect.h* Scale() ), Gdiplus::CombineMode::CombineModeReplace ); }
void SDL2Renderer::StartClip() { const Gwen::Rect &rect = ClipRegion(); const SDL_Rect clip = { rect.x,rect.y, rect.w,rect.h }; SDL_RenderSetClipRect(m_renderer, &clip); }
void Chowdren::StartClip() { Gwen::Rect rect = ClipRegion(); Render::enable_scissor(rect.x * Scale(), rect.y * Scale(), rect.w * Scale(), rect.h * Scale()); };