// determine the kind of transparency we need for this image: if the only alpha // values it has are 0 (transparent) and 0xff (opaque) then we can simply // create a mask for it, we should be ok with a simple mask but otherwise we // need a full blown alpha channel in wxImage // // parameters: // lines raw PNG data // x, y starting position // w, h size of the image // numColBytes number of colour bytes (1 for grey scale, 3 for RGB) // (NB: alpha always follows the colour bytes) Transparency CheckTransparency(unsigned char **lines, png_uint_32 x, png_uint_32 y, png_uint_32 w, png_uint_32 h, size_t numColBytes) { // suppose that a mask will suffice and check all the remaining alpha // values to see if it does for ( ; y < h; y++ ) { // each pixel is numColBytes+1 bytes, offset into the current line by // the current x position unsigned const char *ptr = lines[y] + (x * (numColBytes + 1)); for ( png_uint_32 x2 = x; x2 < w; x2++ ) { // skip the grey or colour byte(s) ptr += numColBytes; unsigned char a2 = *ptr++; if ( !IsTransparent(a2) && !IsOpaque(a2) ) { // not fully opaque nor fully transparent, hence need alpha return Transparency_Alpha; } } // during the next loop iteration check all the pixels in the row x = 0; } // mask will be enough return Transparency_Mask; }
void PopUpInfo::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, color); PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); }
void CHTMLSection::OnDraw( GS::CDrawContext &dc ) { HBRUSH hbr = NULL; if( GetBackgroundColours( dc.GetSafeHdc(), hbr ) ) { FillRect( dc.GetSafeHdc(), *this, hbr ); } else if( !IsTransparent() ) { if( m_pDocument ) { if( !m_pDocument->m_back.Draw( dc, *this ) ) { dc.FillRect( *this, m_pDefaults->m_crBackground ); } if( m_pDocument->m_pimgBackground ) { const int nPosX = left - GetScrollPosH(); const int nPosY = top - GetScrollPos(); DrawTiledBitmap( nPosX, nPosY, max( GetMaxWidth(), (UINT)Width() ), max( GetMaxHeight(), (UINT)Height() ), dc.GetSafeHdc(), m_pDocument->m_pimgBackground, m_nBackgroundFrame ); } } else { dc.FillRect( *this, m_pDefaults->m_crBackground ); } } CScrollContainer::OnDraw( dc ); }
NAMESPACE_UPP void StaticText::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(0, 0, sz.cx, sz.cy, SColorFace); PaintLabel(this, w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); }
void PanelView::SetOpacity(float opacity) { if (opacity_ == opacity) return; opacity_ = (opacity <= 0.0f ? 0.0001f : opacity); // Not to get a black menu area bg_effect_helper_.enabled = IsTransparent(); ForceUpdateBackground(); }
void ToolBar::Paint(Draw& w) { if(IsTransparent()) return; Value look = style->look; if(!IsNull(style->arealook) && (arealook < 0 ? InFrame() : arealook)) { PaintBarArea(w, this, style->arealook, GetScreenRect().bottom); look = Null; } PaintBar(w, style->breaksep, look); }
void SizeGrip::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(sz, SColorFace); if(GuiPlatformHasSizeGrip()) { TopWindow *q = dynamic_cast<TopWindow *>(GetTopCtrl()); if(q && !q->IsMaximized() && q->IsSizeable()) { Size isz = CtrlsImg::SizeGrip().GetSize(); w.DrawImage(sz.cx - isz.cx, sz.cy - isz.cy, CtrlsImg::SizeGrip()); } } }
void MenuBar::Paint(Draw& w) { if(IsTransparent()) return; if(GetParent()) if(!IsNull(style->arealook) && (arealook < 0 ? InFrame() : arealook)) { PaintBarArea(w, this, style->arealook, (GetAlign() != BAR_TOP) ? GetScreenRect().bottom : Null); PaintBarArea(w, this, style->arealook); PaintBar(w, style->breaksep, Null); } else PaintBar(w, style->breaksep, style->look); else PaintBar(w, style->breaksep, style->popupbody, style->popupiconbar, Nvl(leftgap, style->leftgap)); }
void CHTMLSection::OnTimer( int nTimerID ) { if( nTimerID == m_nBackgroundTimerID && !IsTransparent() ) { m_nBackgroundFrame++; if( m_nBackgroundFrame == m_pDocument->m_pimgBackground->GetFrameCount() ) m_nBackgroundFrame = 0; UnregisterTimerEvent( m_nBackgroundTimerID ); m_nBackgroundTimerID = RegisterTimerEvent( this, m_pDocument->m_pimgBackground->GetFrameTime( m_nBackgroundFrame ) ); ForceRedraw(); } else { CScrollContainer::OnTimer( nTimerID ); } }
/***************************************************************************** * Function - Run * DESCRIPTION: Called by operating system to give time to redraw *****************************************************************************/ void NumberQuantity::Run(void) { if (!IsVisible()) { return; } // Only quantity should be transparent since number may frequently change mpQuantity->SetTransparent(IsTransparent()); AdjustClientAreas(); if (!mValid) { mpNumber->Invalidate(); mpQuantity->Invalidate(); mValid = true; } mpNumber->Run(); mpQuantity->Run(); }
void PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry const& geo = GetGeometry(); UpdateBackground(); bool overlay_mode = InOverlayMode(); GfxContext.PushClippingRectangle(geo); if (IsTransparent()) { nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); if (BackgroundEffectHelper::blur_type != BLUR_NONE) { bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(); } else { bg_blur_texture_ = bg_effect_helper_.GetRegion(); } if (bg_blur_texture_.IsValid()) { nux::TexCoordXForm texxform_blur_bg; texxform_blur_bg.flip_v_coord = true; texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); texxform_blur_bg.uoffset = geo.x / static_cast<float>(geo_absolute.width); texxform_blur_bg.voffset = geo.y / static_cast<float>(geo_absolute.height); nux::ROPConfig rop; rop.Blend = false; rop.SrcBlend = GL_ONE; rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; GfxContext.PushClippingRectangle(geo); #ifndef NUX_OPENGLES_20 if (GfxContext.UsingGLSLCodePath()) gPainter.PushDrawCompositionLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, WindowManager::Default().average_color(), nux::LAYER_BLEND_MODE_OVERLAY, true, rop); else gPainter.PushDrawTextureLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, true, rop); #else gPainter.PushDrawCompositionLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, WindowManager::Default().average_color(), nux::LAYER_BLEND_MODE_OVERLAY, true, rop); #endif GfxContext.PopClippingRectangle(); } if (overlay_mode && !Settings::Instance().GetLowGfxMode()) { nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_darken_layer_.get()); GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); nux::TexCoordXForm refine_texxform; int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint); refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); GfxContext.QRP_1Tex(refine_x_pos, geo.y, bg_refine_tex_->GetWidth(), bg_refine_tex_->GetHeight(), bg_refine_tex_->GetDeviceTexture(), refine_texxform, nux::color::White); GfxContext.QRP_1Tex(refine_x_pos + bg_refine_tex_->GetWidth(), geo.y, geo.width, geo.height, bg_refine_single_column_tex_->GetDeviceTexture(), refine_texxform, nux::color::White); } } if (!overlay_mode || !GfxContext.UsingGLSLCodePath()) nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_layer_.get()); GfxContext.PopClippingRectangle(); if (needs_geo_sync_) { SyncGeometries(); needs_geo_sync_ = false; } }
// convert data from RGB to wxImage format static void CopyDataFromPNG(wxImage *image, unsigned char **lines, png_uint_32 width, png_uint_32 height, int color_type) { Transparency transparency = Transparency_None; // only non NULL if transparency == Transparency_Alpha unsigned char *alpha = NULL; // RGB of the mask colour if transparency == Transparency_Mask // (but init them anyhow to avoid compiler warnings) unsigned char rMask = 0, gMask = 0, bMask = 0; unsigned char *ptrDst = image->GetData(); if ( !(color_type & PNG_COLOR_MASK_COLOR) ) { // grey image: GAGAGA... where G == grey component and A == alpha for ( png_uint_32 y = 0; y < height; y++ ) { const unsigned char *ptrSrc = lines[y]; for ( png_uint_32 x = 0; x < width; x++ ) { unsigned char g = *ptrSrc++; unsigned char a = *ptrSrc++; // the first time we encounter a transparent pixel we must // decide about what to do about them if ( !IsOpaque(a) && transparency == Transparency_None ) { // we'll need at least the mask for this image and // maybe even full alpha channel info: the former is // only enough if we have alpha values of 0 and 0xff // only, otherwisewe need the latter transparency = CheckTransparency ( lines, x, y, width, height, 1 ); if ( transparency == Transparency_Mask ) { // let's choose this colour for the mask: this is // not a problem here as all the other pixels are // grey, i.e. R == G == B which is not the case for // this one so no confusion is possible rMask = 0xff; gMask = 0; bMask = 0xff; } else // transparency == Transparency_Alpha { alpha = InitAlpha(image, x, y); } } switch ( transparency ) { case Transparency_Mask: if ( IsTransparent(a) ) { *ptrDst++ = rMask; *ptrDst++ = gMask; *ptrDst++ = bMask; break; } // else: !transparent // must be opaque then as otherwise we shouldn't be // using the mask at all wxASSERT_MSG( IsOpaque(a), wxT("logic error") ); // fall through case Transparency_Alpha: if ( alpha ) *alpha++ = a; // fall through case Transparency_None: *ptrDst++ = g; *ptrDst++ = g; *ptrDst++ = g; break; } } } } else // colour image: RGBRGB... { for ( png_uint_32 y = 0; y < height; y++ ) { const unsigned char *ptrSrc = lines[y]; for ( png_uint_32 x = 0; x < width; x++ ) { unsigned char r = *ptrSrc++; unsigned char g = *ptrSrc++; unsigned char b = *ptrSrc++; unsigned char a = *ptrSrc++; // the logic here is the same as for the grey case except // where noted if ( !IsOpaque(a) && transparency == Transparency_None ) { transparency = CheckTransparency ( lines, x, y, width, height, 3 ); if ( transparency == Transparency_Mask ) { FindMaskColour(lines, width, height, rMask, gMask, bMask); } else // transparency == Transparency_Alpha { alpha = InitAlpha(image, x, y); } } switch ( transparency ) { case Transparency_Mask: if ( IsTransparent(a) ) { *ptrDst++ = rMask; *ptrDst++ = gMask; *ptrDst++ = bMask; break; } else // !transparent { // must be opaque then as otherwise we shouldn't be // using the mask at all wxASSERT_MSG( IsOpaque(a), wxT("logic error") ); // if we couldn't find a unique colour for the // mask, we can have real pixels with the same // value as the mask and it's better to slightly // change their colour than to make them // transparent if ( r == rMask && g == gMask && b == bMask ) { r++; } } // fall through case Transparency_Alpha: if ( alpha ) *alpha++ = a; // fall through case Transparency_None: *ptrDst++ = r; *ptrDst++ = g; *ptrDst++ = b; break; } } } } if ( transparency == Transparency_Mask ) { image->SetMaskColour(rMask, gMask, bMask); } }
void LabelBox::Paint(Draw& w) { Size sz = GetSize(); if(!IsTransparent()) w.DrawRect(sz, SColorFace); Size lsz = GetLabelSize(); int d = lsz.cy >> 1; bool hline = sz.cy < 2 * Draw::GetStdFontCy(); bool vline = sz.cx < 2 * Draw::GetStdFontCy(); int ty = hline ? (sz.cy - lsz.cy) / 2 : 0; Size ts = PaintLabel(w, d + 2, ty, sz.cx, lsz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); w.Begin(); w.ExcludeClip(d, ty, ts.cx + 4, ts.cy); if(GUI_GlobalStyle() >= GUISTYLE_XP || !IsNull(color)) { if(hline) { d = sz.cy / 2; w.DrawRect(0, d - 1, sz.cx, 1, SColorLight); w.DrawRect(0, d, sz.cx, 1, SColorShadow); w.DrawRect(0, d + 1, sz.cx, 1, SColorLight); } else if(vline) { d = sz.cx / 2; w.DrawRect(d - 1, 0, 1, sz.cy, SColorLight); w.DrawRect(d, 0, 1, sz.cy, SColorShadow); w.DrawRect(d + 1, 0, 1, sz.cy, SColorLight); } else { Color c = Nvl(color, LabelBoxColor); w.DrawRect(0, d + 2, 1, sz.cy - d - 4, c); w.DrawRect(sz.cx - 1, d + 2, 1, sz.cy - d - 4, c); w.DrawRect(2, sz.cy - 1, sz.cx - 4, 1, c); w.DrawRect(2, d, sz.cx - 4, 1, c); w.DrawRect(1, d + 1, 2, 1, c); w.DrawRect(1, d + 2, 1, 1, c); w.DrawRect(sz.cx - 3, d + 1, 2, 1, c); w.DrawRect(sz.cx - 2, d + 2, 1, 1, c); w.DrawRect(1, sz.cy - 2, 2, 1, c); w.DrawRect(1, sz.cy - 3, 1, 1, c); w.DrawRect(sz.cx - 3, sz.cy - 2, 2, 1, c); w.DrawRect(sz.cx - 2, sz.cy - 3, 1, 1, c); } } else { if(hline) { d = sz.cy / 2; w.DrawRect(0, d, sz.cx, 1, SColorShadow); w.DrawRect(0, d + 1, sz.cx, 1, SColorLight); } else if(vline) { d = sz.cx / 2; w.DrawRect(d, 0, 1, sz.cy, SColorShadow); w.DrawRect(d - 1, 1, 0, sz.cy, SColorLight); } else { w.DrawRect(1, d, sz.cx - 2, 1, SColorShadow); w.DrawRect(1, d + 1, sz.cx - 2, 1, SColorLight); w.DrawRect(0, d, 1, sz.cy - d - 1, SColorShadow); w.DrawRect(1, d + 1, 1, sz.cy - d - 2, SColorLight); w.DrawRect(sz.cx - 2, d, 1, sz.cy - d, SColorShadow); w.DrawRect(sz.cx - 1, d, 1, sz.cy - d, SColorLight); w.DrawRect(1, sz.cy - 2, sz.cx - 2, 1, SColorShadow); w.DrawRect(1, sz.cy - 1, sz.cx - 2, 1, SColorLight); } } w.End(); }
FriBidiChar* shape_arabic(FriBidiChar * str, int len) { CharRep crep; CombCharRep combcrep; FriBidiChar * shaped = (FriBidiChar *) malloc(sizeof(FriBidiChar) * (len + 1)); int writeCount = 0; for (int i = 0; i < len; i++) { FriBidiChar current = str[i]; if (CharacterMapContains(current)) { FriBidiChar prev = NIL; FriBidiChar next = NIL; int prevID = i - 1; int nextID = i + 1; /* Transparent characters have no effect in the shaping process. So, ignore all the transparent characters that are BEFORE the current character. */ for (; prevID >= 0; prevID--) if (!IsTransparent(str[prevID])) break; if ((prevID < 0) || !CharacterMapContains(prev = str[prevID]) || (!((crep = GetCharRep(prev)).mInitial != NIL) && !(crep.mMedial != NIL))) prev = NIL; /* Transparent characters have no effect in the shaping process. So, ignore all the transparent characters that are AFTER the current character. */ for (; nextID < len; nextID++) if (!IsTransparent(str[nextID])) break; if ((nextID >= len) || !CharacterMapContains(next = str[nextID]) || (!((crep = GetCharRep(next)).mMedial != NIL) && !((crep = GetCharRep(next)).mFinal != NIL) && (next != 0x0640))) next = NIL; /* Combinations */ if (current == 0x0644 && next != NIL && (next == 0x0622 || next == 0x0623 || next == 0x0625 || next == 0x0627)) { combcrep = GetCombCharRep(current, next); if (prev != NIL) { shaped[writeCount++] = combcrep.mFinal; } else { shaped[writeCount++] = combcrep.mIsolated; } i++; continue; } crep = GetCharRep(current); /* Medial */ if (prev != NIL && next != NIL && crep.mMedial != NIL) { shaped[writeCount++] = crep.mMedial; continue; /* Final */ } else if (prev != NIL && crep.mFinal != NIL) { shaped[writeCount++] = crep.mFinal; continue; /* Initial */ } else if (next != NIL && crep.mInitial != NIL) { shaped[writeCount++] = crep.mInitial; continue; } /* Isolated */ shaped[writeCount++] = crep.mIsolated; } else { shaped[writeCount++] = current; } } shaped[writeCount] = NIL; return shaped; }
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) { GuiLock __; LEVELCHECK(w, this); LTIMING("CtrlPaint"); Rect rect = GetRect().GetSize(); Rect orect = rect.Inflated(overpaint); if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect)) return; w.PushContext(); //glPushMatrix(); ApplyTransform(TS_BEFORE_CTRL_PAINT); Ctrl *q; Rect view = rect; for(int i = 0; i < frame.GetCount(); i++) { LEVELCHECK(w, NULL); frame[i].frame->FramePaint(w, view); view = frame[i].view; } Rect oview = view.Inflated(overpaint); bool hasviewctrls = false; bool viewexcluded = false; for(q = firstchild; q; q = q->next) if(q->IsShown()) if(q->InFrame()) { if(!viewexcluded && IsTransparent() && q->GetRect().Intersects(view)) { w.Begin(); w.ExcludeClip(view); viewexcluded = true; } LEVELCHECK(w, q); Point off = q->GetRect().TopLeft(); w.Offset(off); q->CtrlPaint(w, clip - off); w.End(); } else hasviewctrls = true; if(viewexcluded) w.End(); //DOLEVELCHECK; if(!oview.IsEmpty() && oview.Intersects(clip)) { LEVELCHECK(w, this); if(cliptobounds) w.Clip(overpaint ? oview : view); w.Offset(view.left, view.top); Paint(w); PaintCaret(w); w.End(); if(hasviewctrls && !view.IsEmpty()) { Rect cl = clip & view; for(q = firstchild; q; q = q->next) if(q->IsShown() && q->InView()) { Rect rr(q->popup ? clip : cl); LEVELCHECK(w, q); Rect qr = q->GetRect(); Point off = qr.TopLeft() + view.TopLeft(); Rect ocl = cl - off; if(ocl.Intersects(Rect(qr.GetSize()).Inflated(overpaint))) { w.Offset(off); q->CtrlPaint(w, rr - off); w.End(); } } } if(cliptobounds) w.End(); } ApplyTransform(TS_AFTER_CTRL_PAINT); //glPopMatrix(); w.PopContext(); }
Rect Ctrl::GetOpaqueRect() { return IsTransparent() ? Rect(0, 0, 0, 0) : GetSize(); }
void DetailList::AddMaterial( Material &m ) { char s[100]; // handle too many materials: if( fnMats == MAX_MATS ) throw GeneralError( "Too many materials!" ); // handle duplicate materials: for( int i = 0; i < fnMats; i++ ) if( !strcmp( m.fName, faMats[i].fName ) ) { if( !(faMats[i] == m) ) { sprintf( s, "Material '%s' conflicts with prior material '%s'", m.fName, faMats[i].fName ); throw GeneralError( s ); } // identical duplicate found // return without adding duplicate: return; } // if textured, get the actual texture bitmap and add to sheets: if( m.fTextured ) { strcpy( m.fTextureFile, m.fRawTextureFile ); GFXBitmap * pBmp = GFXBitmap::load( m.fRawTextureFile ); if( pBmp ) { // if texture is translucent, pack the alpha info into it: if( m.fTextureHasAlpha ) { GFXBitmap *pAlpha = GFXBitmap::load( m.fAlphaFile ); if( !pAlpha ) { delete pBmp; sprintf( s, "Alpha file missing: '%s'", m.fAlphaFile ); throw GeneralError( s ); } Alphatize( pBmp, pAlpha ); delete pAlpha; // save alphatized bitmap with .pab extension: if( strchr( m.fTextureFile, '.' ) ) strcpy( strchr( m.fTextureFile, '.' ), ".pab" ); else strcat( m.fTextureFile, ".pab" ); pBmp->write( m.fTextureFile ); } m.fTransparent = IsTransparent( pBmp ); delete pBmp; } else { sprintf( s, "Texture file missing: '%s'", m.fRawTextureFile ); throw GeneralError( s ); } } // See if TSMaterial is identical to another: m.MakeTSMaterial( &faTSMats[fnTSMats] ); for( int tm = 0; tm < fnTSMats; tm++ ) if( !memcmp( &m, &faTSMats[tm], sizeof( TSMaterial ) ) ) { // if same as a previous TSMaterial, don't duplicate m.fTSMaterialIndex = tm; break; } // allow no duplicates in TSMaterials: if( m.fTSMaterialIndex == -1 ) m.fTSMaterialIndex = fnTSMats++; // add all materials here which are unique (if only by name) in 3dStudio: faMats[fnMats++] = m; // display material attributes: //m.Dump(); }
void Ctrl::CtrlPaint(SystemDraw& w, const Rect& clip) { GuiLock __; LEVELCHECK(w, this); LTIMING("CtrlPaint"); Rect rect = GetRect().GetSize(); Rect orect = rect.Inflated(overpaint); if(!IsShown() || orect.IsEmpty() || clip.IsEmpty() || !clip.Intersects(orect)) return; Ctrl *q; Rect view = rect; for(int i = 0; i < frame.GetCount(); i++) { LEVELCHECK(w, NULL); frame[i].frame->FramePaint(w, view); view = frame[i].view; } Rect oview = view.Inflated(overpaint); bool hasviewctrls = false; bool viewexcluded = false; for(q = firstchild; q; q = q->next) if(q->IsShown()) if(q->InFrame()) { if(!viewexcluded && IsTransparent() && q->GetRect().Intersects(view)) { w.Begin(); w.ExcludeClip(view); viewexcluded = true; } LEVELCHECK(w, q); Point off = q->GetRect().TopLeft(); w.Offset(off); q->CtrlPaint(w, clip - off); w.End(); } else hasviewctrls = true; if(viewexcluded) w.End(); DOLEVELCHECK; if(!oview.IsEmpty()) { if(oview.Intersects(clip) && w.IsPainting(oview)) { LEVELCHECK(w, this); if(overpaint) { w.Clip(oview); w.Offset(view.left, view.top); Paint(w); PaintCaret(w); w.End(); w.End(); } else { w.Clipoff(view); Paint(w); PaintCaret(w); w.End(); } } } if(hasviewctrls && !view.IsEmpty()) { Rect cl = clip & view; w.Clip(cl); for(q = firstchild; q; q = q->next) if(q->IsShown() && q->InView()) { LEVELCHECK(w, q); Rect qr = q->GetRect(); Point off = qr.TopLeft() + view.TopLeft(); Rect ocl = cl - off; if(ocl.Intersects(Rect(qr.GetSize()).Inflated(overpaint))) { w.Offset(off); q->CtrlPaint(w, cl - off); w.End(); } } w.End(); } }
void PanelView::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) { nux::Geometry const& geo = GetGeometry(); bool overlay_mode = InOverlayMode(); int bgs = 1; GfxContext.PushClippingRectangle(geo); GfxContext.GetRenderStates().SetBlend(true); GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); if (bg_blur_texture_.IsValid() && IsTransparent()) { nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); nux::TexCoordXForm texxform_blur_bg; texxform_blur_bg.flip_v_coord = true; texxform_blur_bg.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); texxform_blur_bg.uoffset = geo.x / static_cast<float>(geo_absolute.width); texxform_blur_bg.voffset = geo.y / static_cast<float>(geo_absolute.height); nux::ROPConfig rop; rop.Blend = false; rop.SrcBlend = GL_ONE; rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; #ifndef NUX_OPENGLES_20 if (GfxContext.UsingGLSLCodePath()) gPainter.PushCompositionLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, WindowManager::Default().average_color(), nux::LAYER_BLEND_MODE_OVERLAY, true, rop); else gPainter.PushTextureLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, true, rop); #else gPainter.PushCompositionLayer(GfxContext, geo, bg_blur_texture_, texxform_blur_bg, nux::color::White, WindowManager::Default().average_color(), nux::LAYER_BLEND_MODE_OVERLAY, true, rop); #endif bgs++; if (overlay_mode) { if (Settings::Instance().GetLowGfxMode()) { rop.Blend = false; auto const& bg_color = WindowManager::Default().average_color(); bg_darken_layer_.reset(new nux::ColorLayer(bg_color, false, rop)); } nux::GetPainter().PushLayer(GfxContext, geo, bg_darken_layer_.get()); bgs++; nux::Geometry refine_geo = geo; int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint); refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); refine_geo.x = refine_x_pos; refine_geo.width = bg_refine_tex_->GetWidth(); if (!Settings::Instance().GetLowGfxMode()) { nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_layer_.get()); bgs++; refine_geo.x += refine_geo.width; refine_geo.width = geo.width; nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_single_column_layer_.get()); bgs++; } } } if (!overlay_mode || !GfxContext.UsingGLSLCodePath()) gPainter.PushLayer(GfxContext, geo, bg_layer_.get()); if (overlay_mode && !Settings::Instance().GetLowGfxMode()) { // apply the shine nux::TexCoordXForm texxform; texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); nux::ROPConfig rop; rop.Blend = true; rop.SrcBlend = GL_DST_COLOR; rop.DstBlend = GL_ONE; nux::GetPainter().PushTextureLayer(GfxContext, geo, panel_sheen_->GetDeviceTexture(), texxform, nux::color::White, false, rop); } layout_->ProcessDraw(GfxContext, force_draw); gPainter.PopBackground(bgs); GfxContext.GetRenderStates().SetBlend(false); GfxContext.PopClippingRectangle(); }