public final class EmfCreateBrushIndirect extends EmfObjectCreationRecordType
The EMR_CREATEBRUSHINDIRECT record defines a logical brush for graphics operations.
The logical brush object defined by this record can be selected into the playback device context by an EMR_SELECTOBJECT record (section 2.3.8.5), which specifies the logical brush to use in subsequent graphics operations.
Constructor and Description |
---|
EmfCreateBrushIndirect()
Initializes a new instance of the
EmfCreateBrushIndirect class. |
EmfCreateBrushIndirect(EmfRecord source)
Initializes a new instance of the
EmfCreateBrushIndirect class. |
Modifier and Type | Method and Description |
---|---|
int |
getIhBrush()
Gets or sets A 32-bit unsigned integer that specifies the index of the logical brush object
in the EMF Object Table (section 3.1.1.1).
|
EmfLogBrushEx |
getLogBrush()
Gets or sets A LogBrushEx object (section 2.2.12) that specifies the style, color, and
pattern of the logical brush.
|
void |
setIhBrush(int value)
Gets or sets A 32-bit unsigned integer that specifies the index of the logical brush object
in the EMF Object Table (section 3.1.1.1).
|
void |
setLogBrush(EmfLogBrushEx value)
Gets or sets A LogBrushEx object (section 2.2.12) that specifies the style, color, and
pattern of the logical brush.
|
public EmfCreateBrushIndirect(EmfRecord source)
Initializes a new instance of the EmfCreateBrushIndirect
class.
source
- The source.public EmfCreateBrushIndirect()
Initializes a new instance of the EmfCreateBrushIndirect
class.
The following example shows how set the background color for EMF. It actually draws a rectangle of the background color before drawing all other objects.
String baseFolder = "c:\\temp"; // This is a helper class which does all real work. class Util { private void addBackgroundRectangleEmf(com.aspose.imaging.fileformats.emf.EmfImage image, com.aspose.imaging.Color color) { image.cacheData(); com.aspose.imaging.fileformats.emf.MetaObjectList records = image.getRecords(); if (records.size() < 1) { return; } //Set Rectangle com.aspose.imaging.fileformats.emf.emf.records.EmfRectangle rectangle = new com.aspose.imaging.fileformats.emf.emf.records.EmfRectangle(); rectangle.setBox(image.getHeader().getEmfHeader().getBounds()); //Set Brush com.aspose.imaging.fileformats.emf.emf.records.EmfCreateBrushIndirect brush = new com.aspose.imaging.fileformats.emf.emf.records.EmfCreateBrushIndirect(); brush.setLogBrush(new com.aspose.imaging.fileformats.emf.emf.objects.EmfLogBrushEx()); brush.getLogBrush().setArgb32ColorRef(color.toArgb()); brush.setIhBrush(1); //Select brush com.aspose.imaging.fileformats.emf.emf.records.EmfSelectObject selectObject = new com.aspose.imaging.fileformats.emf.emf.records.EmfSelectObject(); selectObject.setObjectHandle(1); //Remove brush com.aspose.imaging.fileformats.emf.emf.records.EmfDeleteObject deleteObject = new com.aspose.imaging.fileformats.emf.emf.records.EmfDeleteObject(); deleteObject.setObjectHandle(1); //Add records records.insertItem(1, brush); records.insertItem(2, selectObject); records.insertItem(3, rectangle); records.insertItem(4, deleteObject); } } // Here is the main example String[] files = new String[]{"image1.emf", "image2.wmf"}; for (String fileName : files) { String inputFile = baseFolder + fileName; String outputFile = baseFolder + "Background_" + fileName; com.aspose.imaging.fileformats.emf.MetaImage image = (com.aspose.imaging.fileformats.emf.MetaImage) com.aspose.imaging.Image.load(inputFile); try { new Util().addBackgroundRectangleEmf((com.aspose.imaging.fileformats.emf.EmfImage) image, com.aspose.imaging.Color.getBlue()); image.save(outputFile); } finally { image.close(); } }
public int getIhBrush()
Gets or sets A 32-bit unsigned integer that specifies the index of the logical brush object in the EMF Object Table (section 3.1.1.1). This index MUST be saved so that this object can be reused or modified.
public void setIhBrush(int value)
Gets or sets A 32-bit unsigned integer that specifies the index of the logical brush object in the EMF Object Table (section 3.1.1.1). This index MUST be saved so that this object can be reused or modified.
public EmfLogBrushEx getLogBrush()
Gets or sets A LogBrushEx object (section 2.2.12) that specifies the style, color, and pattern of the logical brush. The BrushStyle field in this object MUST be BS_SOLID, BS_HATCHED, or BS_NULL.
public void setLogBrush(EmfLogBrushEx value)
Gets or sets A LogBrushEx object (section 2.2.12) that specifies the style, color, and pattern of the logical brush. The BrushStyle field in this object MUST be BS_SOLID, BS_HATCHED, or BS_NULL.