void TextComponent::render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const { // get font to use Font* font; try { font = d_fontPropertyName.empty() ? (d_font.empty() ? srcWindow.getFont() : FontManager::getSingleton().getFont(d_font)) : FontManager::getSingleton().getFont(srcWindow.getProperty(d_fontPropertyName)); } catch (UnknownObjectException&) { font = 0; } // exit if we have no font to use. if (!font) return; HorizontalTextFormatting horzFormatting = d_horzFormatPropertyName.empty() ? d_horzFormatting : FalagardXMLHelper::stringToHorzTextFormat(srcWindow.getProperty(d_horzFormatPropertyName)); VerticalTextFormatting vertFormatting = d_vertFormatPropertyName.empty() ? d_vertFormatting : FalagardXMLHelper::stringToVertTextFormat(srcWindow.getProperty(d_vertFormatPropertyName)); // calculate final colours to be used ColourRect finalColours; initColoursRect(srcWindow, modColours, finalColours); // decide which string to render. const String& renderString = d_textPropertyName.empty() ? (d_text.empty() ? srcWindow.getText() : d_text) : srcWindow.getProperty(d_textPropertyName); // calculate height of formatted text float textHeight = font->getFormattedLineCount(renderString, destRect, (TextFormatting)horzFormatting) * font->getLineSpacing(); // handle dest area adjustments for vertical formatting. switch(vertFormatting) { case VTF_CENTRE_ALIGNED: destRect.d_top += (destRect.getHeight() - textHeight) * 0.5f; break; case VTF_BOTTOM_ALIGNED: destRect.d_top = destRect.d_bottom - textHeight; break; default: // default is VTF_TOP_ALIGNED, for which we take no action. break; } // offset the font little down so that it's centered within its own spacing destRect.d_top += (font->getLineSpacing() - font->getFontHeight()) * 0.5f; // add text to the rendering cache for the target window. srcWindow.getRenderCache().cacheText(renderString, font, (TextFormatting)horzFormatting, destRect, base_z, finalColours, clipper, clipToDisplay); }
void TextComponent::render_impl(Window& srcWindow, Rectf& destRect, const CEGUI::ColourRect* modColours, const Rectf* clipper, bool /*clipToDisplay*/) const { updateFormatting(srcWindow, destRect.getSize()); // Get total formatted height. const float textHeight = d_formattedRenderedString->getVerticalExtent(&srcWindow); // handle dest area adjustments for vertical formatting. const VerticalTextFormatting vertFormatting = d_vertFormatting.get(srcWindow); switch(vertFormatting) { case VTF_CENTRE_ALIGNED: destRect.d_min.y += (destRect.getHeight() - textHeight) * 0.5f; break; case VTF_BOTTOM_ALIGNED: destRect.d_min.y = destRect.d_max.y - textHeight; break; default: // default is VTF_TOP_ALIGNED, for which we take no action. break; } // calculate final colours to be used ColourRect finalColours; initColoursRect(srcWindow, modColours, finalColours); // add geometry for text to the target window. d_formattedRenderedString->draw(&srcWindow, srcWindow.getGeometryBuffers(), destRect.getPosition(), &finalColours, clipper); }
void ImageryComponent::render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const { // get final image to use. const Image* img = isImageFetchedFromProperty() ? PropertyHelper::stringToImage(srcWindow.getProperty(d_imagePropertyName)) : d_image; // do not draw anything if image is not set. if (!img) return; HorizontalFormatting horzFormatting = d_horzFormatPropertyName.empty() ? d_horzFormatting : FalagardXMLHelper::stringToHorzFormat(srcWindow.getProperty(d_horzFormatPropertyName)); VerticalFormatting vertFormatting = d_vertFormatPropertyName.empty() ? d_vertFormatting : FalagardXMLHelper::stringToVertFormat(srcWindow.getProperty(d_vertFormatPropertyName)); uint horzTiles, vertTiles; float xpos, ypos; Size imgSz(img->getSize()); // calculate final colours to be used ColourRect finalColours; initColoursRect(srcWindow, modColours, finalColours); // calculate initial x co-ordinate and horizontal tile count according to formatting options switch (horzFormatting) { case HF_STRETCHED: imgSz.d_width = destRect.getWidth(); xpos = destRect.d_left; horzTiles = 1; break; case HF_TILED: xpos = destRect.d_left; horzTiles = (uint)((destRect.getWidth() + (imgSz.d_width - 1)) / imgSz.d_width); break; case HF_LEFT_ALIGNED: xpos = destRect.d_left; horzTiles = 1; break; case HF_CENTRE_ALIGNED: xpos = destRect.d_left + PixelAligned((destRect.getWidth() - imgSz.d_width) * 0.5f); horzTiles = 1; break; case HF_RIGHT_ALIGNED: xpos = destRect.d_right - imgSz.d_width; horzTiles = 1; break; default: throw InvalidRequestException("ImageryComponent::render - An unknown HorizontalFormatting value was specified."); } // calculate initial y co-ordinate and vertical tile count according to formatting options switch (vertFormatting) { case VF_STRETCHED: imgSz.d_height = destRect.getHeight(); ypos = destRect.d_top; vertTiles = 1; break; case VF_TILED: ypos = destRect.d_top; vertTiles = (uint)((destRect.getHeight() + (imgSz.d_height - 1)) / imgSz.d_height); break; case VF_TOP_ALIGNED: ypos = destRect.d_top; vertTiles = 1; break; case VF_CENTRE_ALIGNED: ypos = destRect.d_top + PixelAligned((destRect.getHeight() - imgSz.d_height) * 0.5f); vertTiles = 1; break; case VF_BOTTOM_ALIGNED: ypos = destRect.d_bottom - imgSz.d_height; vertTiles = 1; break; default: throw InvalidRequestException("ImageryComponent::render - An unknown VerticalFormatting value was specified."); } // perform final rendering (actually is now a caching of the images which will be drawn) Rect finalRect; Rect finalClipper; const Rect* clippingRect; finalRect.d_top = ypos; finalRect.d_bottom = ypos + imgSz.d_height; for (uint row = 0; row < vertTiles; ++row) { finalRect.d_left = xpos; finalRect.d_right = xpos + imgSz.d_width; for (uint col = 0; col < horzTiles; ++col) { // use custom clipping for right and bottom edges when tiling the imagery if (((vertFormatting == VF_TILED) && row == vertTiles - 1) || ((horzFormatting == HF_TILED) && col == horzTiles - 1)) { finalClipper = clipper ? clipper->getIntersection(destRect) : destRect; clippingRect = &finalClipper; } // not tiliing, or not on far edges, just used passed in clipper (if any). else { clippingRect = clipper; } // add image to the rendering cache for the target window. srcWindow.getRenderCache().cacheImage(*img, finalRect, base_z, finalColours, clippingRect, clipToDisplay); finalRect.d_left += imgSz.d_width; finalRect.d_right += imgSz.d_width; } finalRect.d_top += imgSz.d_height; finalRect.d_bottom += imgSz.d_height; } }
void FrameComponent::render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const { Rect backgroundRect(destRect); Rect finalRect; Size imageSize; ColourRect imageColours; float leftfactor, rightfactor, topfactor, bottomfactor; bool calcColoursPerImage; // vars we use to track what to do with the side pieces. float topOffset = 0, bottomOffset = 0, leftOffset = 0, rightOffset = 0; float topWidth, bottomWidth, leftHeight, rightHeight; topWidth = bottomWidth = destRect.getWidth(); leftHeight = rightHeight = destRect.getHeight(); // calculate final overall colours to be used ColourRect finalColours; initColoursRect(srcWindow, modColours, finalColours); if (finalColours.isMonochromatic()) { calcColoursPerImage = false; imageColours = finalColours; } else { calcColoursPerImage = true; } // top-left image if (d_frameImages[FIC_TOP_LEFT_CORNER]) { // calculate final destination area imageSize = d_frameImages[FIC_TOP_LEFT_CORNER]->getSize(); finalRect.d_left = destRect.d_left; finalRect.d_top = destRect.d_top; finalRect.setSize(imageSize); // update adjustments required to edges do to presence of this element. topOffset += imageSize.d_width; leftOffset += imageSize.d_height; topWidth -= topOffset; leftHeight -= leftOffset; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_TOP_LEFT_CORNER]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_TOP_LEFT_CORNER]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_TOP_LEFT_CORNER], finalRect, base_z, imageColours, 0, clipToDisplay); } // top-right image if (d_frameImages[FIC_TOP_RIGHT_CORNER]) { // calculate final destination area imageSize = d_frameImages[FIC_TOP_RIGHT_CORNER]->getSize(); finalRect.d_left = destRect.d_right - imageSize.d_width; finalRect.d_top = destRect.d_top; finalRect.setSize(imageSize); // update adjustments required to edges do to presence of this element. rightOffset += imageSize.d_height; topWidth -= imageSize.d_width; rightHeight -= rightOffset; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_TOP_RIGHT_CORNER]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_TOP_RIGHT_CORNER]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_TOP_RIGHT_CORNER], finalRect, base_z, imageColours, 0, clipToDisplay); } // bottom-left image if (d_frameImages[FIC_BOTTOM_LEFT_CORNER]) { // calculate final destination area imageSize = d_frameImages[FIC_BOTTOM_LEFT_CORNER]->getSize(); finalRect.d_left = destRect.d_left; finalRect.d_top = destRect.d_bottom - imageSize.d_height; finalRect.setSize(imageSize); // update adjustments required to edges do to presence of this element. bottomOffset += imageSize.d_width; bottomWidth -= bottomOffset; leftHeight -= imageSize.d_height; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_BOTTOM_LEFT_CORNER]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_BOTTOM_LEFT_CORNER]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_BOTTOM_LEFT_CORNER], finalRect, base_z, imageColours, 0, clipToDisplay); } // bottom-right image if (d_frameImages[FIC_BOTTOM_RIGHT_CORNER]) { // calculate final destination area imageSize = d_frameImages[FIC_BOTTOM_RIGHT_CORNER]->getSize(); finalRect.d_left = destRect.d_right - imageSize.d_width; finalRect.d_top = destRect.d_bottom - imageSize.d_height; finalRect.setSize(imageSize); // update adjustments required to edges do to presence of this element. bottomWidth -= imageSize.d_width; rightHeight -= imageSize.d_height; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_BOTTOM_RIGHT_CORNER]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_BOTTOM_RIGHT_CORNER]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_BOTTOM_RIGHT_CORNER], finalRect, base_z, imageColours, 0, clipToDisplay); } // top image if (d_frameImages[FIC_TOP_EDGE]) { // calculate final destination area imageSize = d_frameImages[FIC_TOP_EDGE]->getSize(); finalRect.d_left = destRect.d_left + topOffset; finalRect.d_right = finalRect.d_left + topWidth; finalRect.d_top = destRect.d_top; finalRect.d_bottom = finalRect.d_top + imageSize.d_height; // adjust background area to miss this edge backgroundRect.d_top += imageSize.d_height + d_frameImages[FIC_TOP_EDGE]->getOffsetY();; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_TOP_EDGE]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_TOP_EDGE]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_TOP_EDGE], finalRect, base_z, imageColours, 0, clipToDisplay); } // bottom image if (d_frameImages[FIC_BOTTOM_EDGE]) { // calculate final destination area imageSize = d_frameImages[FIC_BOTTOM_EDGE]->getSize(); finalRect.d_left = destRect.d_left + bottomOffset; finalRect.d_right = finalRect.d_left + bottomWidth; finalRect.d_bottom = destRect.d_bottom; finalRect.d_top = finalRect.d_bottom - imageSize.d_height; // adjust background area to miss this edge backgroundRect.d_bottom -= imageSize.d_height - d_frameImages[FIC_BOTTOM_EDGE]->getOffsetY();; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_BOTTOM_EDGE]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_BOTTOM_EDGE]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_BOTTOM_EDGE], finalRect, base_z, imageColours, 0, clipToDisplay); } // left image if (d_frameImages[FIC_LEFT_EDGE]) { // calculate final destination area imageSize = d_frameImages[FIC_LEFT_EDGE]->getSize(); finalRect.d_left = destRect.d_left; finalRect.d_right = finalRect.d_left + imageSize.d_width; finalRect.d_top = destRect.d_top + leftOffset; finalRect.d_bottom = finalRect.d_top + leftHeight; // adjust background area to miss this edge backgroundRect.d_left += imageSize.d_width + d_frameImages[FIC_LEFT_EDGE]->getOffsetX(); // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_LEFT_EDGE]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_LEFT_EDGE]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_LEFT_EDGE], finalRect, base_z, imageColours, 0, clipToDisplay); } // right image if (d_frameImages[FIC_RIGHT_EDGE]) { // calculate final destination area imageSize = d_frameImages[FIC_RIGHT_EDGE]->getSize(); finalRect.d_top = destRect.d_top + rightOffset; finalRect.d_bottom = finalRect.d_top + rightHeight; finalRect.d_right = destRect.d_right; finalRect.d_left = finalRect.d_right - imageSize.d_width; // adjust background area to miss this edge backgroundRect.d_right -= imageSize.d_width - d_frameImages[FIC_RIGHT_EDGE]->getOffsetX(); // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.d_left + d_frameImages[FIC_RIGHT_EDGE]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.d_top + d_frameImages[FIC_RIGHT_EDGE]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. srcWindow.getRenderCache().cacheImage(*d_frameImages[FIC_RIGHT_EDGE], finalRect, base_z, imageColours, 0, clipToDisplay); } if (d_frameImages[FIC_BACKGROUND]) { // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (backgroundRect.d_left + d_frameImages[FIC_BACKGROUND]->getOffsetX()) / destRect.getWidth(); rightfactor = leftfactor + backgroundRect.getWidth() / destRect.getWidth(); topfactor = (backgroundRect.d_top + d_frameImages[FIC_BACKGROUND]->getOffsetY()) / destRect.getHeight(); bottomfactor = topfactor + backgroundRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // render background image. doBackgroundRender(srcWindow, backgroundRect, base_z, imageColours, clipper, clipToDisplay); } }
//----------------------------------------------------------------------------// void FrameComponent::render_impl(Window& srcWindow, Rectf& destRect, const CEGUI::ColourRect* modColours, const Rectf* clipper, bool clipToDisplay) const { Rectf backgroundRect(destRect); Rectf finalRect; Sizef imageSize; Vector2f imageOffsets; ColourRect imageColours; float leftfactor, rightfactor, topfactor, bottomfactor; bool calcColoursPerImage; // vars we use to track what to do with the side pieces. float topOffset = 0, bottomOffset = 0, leftOffset = 0, rightOffset = 0; float topWidth, bottomWidth, leftHeight, rightHeight; topWidth = bottomWidth = destRect.getWidth(); leftHeight = rightHeight = destRect.getHeight(); // calculate final overall colours to be used ColourRect finalColours; initColoursRect(srcWindow, modColours, finalColours); if (finalColours.isMonochromatic()) { calcColoursPerImage = false; imageColours = finalColours; } else { calcColoursPerImage = true; } // top-left image if (const Image* const componentImage = getImage(FIC_TOP_LEFT_CORNER, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); imageOffsets = componentImage->getRenderedOffset(); finalRect.d_min = destRect.d_min; finalRect.setSize(imageSize); finalRect = destRect.getIntersection(finalRect); // update adjustments required to edges do to presence of this element. topOffset += imageSize.d_width + imageOffsets.d_x; leftOffset += imageSize.d_height + imageOffsets.d_y; topWidth -= topOffset; leftHeight -= leftOffset; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + imageOffsets.d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + imageOffsets.d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. componentImage->render(srcWindow.getGeometryBuffer(), finalRect, clipper, imageColours); } // top-right image if (const Image* const componentImage = getImage(FIC_TOP_RIGHT_CORNER, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); imageOffsets = componentImage->getRenderedOffset(); finalRect.left(destRect.right() - imageSize.d_width); finalRect.top(destRect.top()); finalRect.setSize(imageSize); finalRect = destRect.getIntersection(finalRect); // update adjustments required to edges do to presence of this element. rightOffset += imageSize.d_height + imageOffsets.d_y; topWidth -= imageSize.d_width - imageOffsets.d_x; rightHeight -= rightOffset; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + imageOffsets.d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + imageOffsets.d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle(leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. componentImage->render(srcWindow.getGeometryBuffer(), finalRect, clipper, imageColours); } // bottom-left image if (const Image* const componentImage = getImage(FIC_BOTTOM_LEFT_CORNER, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); imageOffsets = componentImage->getRenderedOffset(); finalRect.left(destRect.left()); finalRect.top(destRect.bottom() - imageSize.d_height); finalRect.setSize(imageSize); finalRect = destRect.getIntersection(finalRect); // update adjustments required to edges do to presence of this element. bottomOffset += imageSize.d_width + imageOffsets.d_x; bottomWidth -= bottomOffset; leftHeight -= imageSize.d_height - imageOffsets.d_y; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + imageOffsets.d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + imageOffsets.d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle(leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. componentImage->render(srcWindow.getGeometryBuffer(), finalRect, clipper, imageColours); } // bottom-right image if (const Image* const componentImage = getImage(FIC_BOTTOM_RIGHT_CORNER, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); imageOffsets = componentImage->getRenderedOffset(); finalRect.left(destRect.right() - imageSize.d_width); finalRect.top(destRect.bottom() - imageSize.d_height); finalRect.setSize(imageSize); finalRect = destRect.getIntersection(finalRect); // update adjustments required to edges do to presence of this element. bottomWidth -= imageSize.d_width - imageOffsets.d_x; rightHeight -= imageSize.d_height - imageOffsets.d_y; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. componentImage->render(srcWindow.getGeometryBuffer(), finalRect, clipper, imageColours); } // top image if (const Image* const componentImage = getImage(FIC_TOP_EDGE, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); finalRect.left(destRect.left() + topOffset); finalRect.right(finalRect.left() + topWidth); finalRect.top(destRect.top()); finalRect.bottom(finalRect.top() + imageSize.d_height); finalRect = destRect.getIntersection(finalRect); // adjust background area to miss this edge backgroundRect.d_min.d_y += imageSize.d_height + componentImage->getRenderedOffset().d_y; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. renderImage(srcWindow.getGeometryBuffer(), componentImage, VF_TOP_ALIGNED, d_topEdgeFormatting.get(srcWindow), finalRect, imageColours, clipper, clipToDisplay); } // bottom image if (const Image* const componentImage = getImage(FIC_BOTTOM_EDGE, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); finalRect.left(destRect.left() + bottomOffset); finalRect.right(finalRect.left() + bottomWidth); finalRect.bottom(destRect.bottom()); finalRect.top(finalRect.bottom() - imageSize.d_height); finalRect = destRect.getIntersection (finalRect); // adjust background area to miss this edge backgroundRect.d_max.d_y -= imageSize.d_height - componentImage->getRenderedOffset().d_y; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle(leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. renderImage(srcWindow.getGeometryBuffer(), componentImage, VF_BOTTOM_ALIGNED, d_bottomEdgeFormatting.get(srcWindow), finalRect, imageColours, clipper, clipToDisplay); } // left image if (const Image* const componentImage = getImage(FIC_LEFT_EDGE, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); finalRect.left(destRect.left()); finalRect.right(finalRect.left() + imageSize.d_width); finalRect.top(destRect.top() + leftOffset); finalRect.bottom(finalRect.top() + leftHeight); finalRect = destRect.getIntersection(finalRect); // adjust background area to miss this edge backgroundRect.d_min.d_x += imageSize.d_width + componentImage->getRenderedOffset().d_x; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. renderImage(srcWindow.getGeometryBuffer(), componentImage, d_leftEdgeFormatting.get(srcWindow), HF_LEFT_ALIGNED, finalRect, imageColours, clipper, clipToDisplay); } // right image if (const Image* const componentImage = getImage(FIC_RIGHT_EDGE, srcWindow)) { // calculate final destination area imageSize = componentImage->getRenderedSize(); finalRect.top(destRect.top() + rightOffset); finalRect.bottom(finalRect.top() + rightHeight); finalRect.right(destRect.right()); finalRect.left(finalRect.right() - imageSize.d_width); finalRect = destRect.getIntersection (finalRect); // adjust background area to miss this edge backgroundRect.d_max.d_x -= imageSize.d_width - componentImage->getRenderedOffset().d_x; // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (finalRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + finalRect.getWidth() / destRect.getWidth(); topfactor = (finalRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + finalRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } // draw this element. renderImage(srcWindow.getGeometryBuffer(), componentImage, d_rightEdgeFormatting.get(srcWindow), HF_RIGHT_ALIGNED, finalRect, imageColours, clipper, clipToDisplay); } if (const Image* const componentImage = getImage(FIC_BACKGROUND, srcWindow)) { // calculate colours that are to be used to this component image if (calcColoursPerImage) { leftfactor = (backgroundRect.left() + componentImage->getRenderedOffset().d_x) / destRect.getWidth(); rightfactor = leftfactor + backgroundRect.getWidth() / destRect.getWidth(); topfactor = (backgroundRect.top() + componentImage->getRenderedOffset().d_y) / destRect.getHeight(); bottomfactor = topfactor + backgroundRect.getHeight() / destRect.getHeight(); imageColours = finalColours.getSubRectangle( leftfactor, rightfactor, topfactor, bottomfactor); } const HorizontalFormatting horzFormatting = d_backgroundHorzFormatting.get(srcWindow); const VerticalFormatting vertFormatting = d_backgroundVertFormatting.get(srcWindow); renderImage(srcWindow.getGeometryBuffer(), componentImage, vertFormatting, horzFormatting, backgroundRect, imageColours, clipper, clipToDisplay); } }