Code brushes and gradients of XPS
C++ API solution to work with brushes and gradients of XPS files.
Aspose.Page API Solution for C++ provides you with the capability to manipulate the vector graphics of XPS files. It lets you create various geometric shapes with different colors and textures. Learn also Aspose.Page documentation about how to work with brushes .
To manipulate brushes and gradients of XPS files, we need:
Aspose.Page for C++ API which is a feature-rich, powerful and easy to use document manipulation and conversion API for C++ platform.
You can download its latest version directly, just open NuGet package manager, and search for Aspose.Page.Cpp and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Page.Cpp
Work with visual brushes with C++
The Aspose.Page for C++ API allows you to add a grid to your XPS files using a few lines of code. This can be done for both new and existing documents. The XpsVisualBrush class is utilized to set the properties of the grid, utilizing XpsPathGeometry and XpsCanvas objects. To add a grid to your XPS document, you will need to follow these steps:
- Using the XpsDocument Class create a Document object
- Create an XpsPathGeometry object with the necessary segments defined.
- Utilize the XpsCanvas Class to set the rendering transformation.
- Adjust the Fill and Opacity properties as desired.
- Save the document by calling the Save() Method.
Namespaces in use
using Aspose::Page::XPS;
using Aspose::Page::XPS::XpsModel;
using System::Drawing;
Using the visual brush to create grid
Add a horizontal gradient with C++.
The Aspose.Page API Solution for C++ allows you to add different types of gradients to your XPS documents using the XpsGradientBrush Class. This class is used to specify the XpsGradientStop and XpsPath information to the XpsDocument object which represents the XPS file. Here’s an example of how to do this:
- Initialize an XpsDocument object.
- Define the XpsGradientStop and XpsPath parameters for the XPS document.
- Set the rendering information.
- Save the document using the Save() Method.
Insert horizontal gradient to an XPS
FAQ
1. How can I add a gradient to an XPS file?
Set the path to the documents directory. To add gradient use the CreateColor() and CreateGradientStop() Methods.
2. How to work with a visual brush in an XPS file?
Set the path to the documents directory. To create visual brush use the CreateVisualBrush() Method.
3. How to open an XPS file?
Use Aspose.Page API Solution to open XPS file programmatically or by means of cross-platform XPS Viewer .
XPS What is XPS File Format
XPS format is similar to PDF format. Both are page description language (PDL) formats. EPS is based on HTML and not on PostScript language. The .eps file is capable to contain a markup of the document's structure along with the information on how the document would look like. There are also added instructions on how to print and render the document. The feature of the format is that it fixes the document's description which means that it will look the same no matter who and from what operational system opens it.