Class DxfRasterImage
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
An IMAGE of a DXF file, as AutoCAD's RasterImage: a picture of pixels placed in the drawing, its file named by its
IMAGEDEF (ImageDef), shown in a frame or clipped by a boundary. The library reads no pixels: it places,
moves and clips the image as its record says.
public class DxfRasterImage : DxfEntity
- Inheritance
-
DxfRasterImage
- Derived
- Inherited Members
Remarks
The record holds the corner the image is placed at (groups 10, 20, 30), the lower left corner of its lower left pixel; the vector one pixel across (11, 21, 31) and one pixel up (12, 22, 32), in world coordinates; its size in pixels (13, 23); its look (70, 281, 282, 283); and its clip boundary in pixels (71, 91 and the run of 14, 24), whose (-0.5, -0.5) is the top left corner of the image, x along the pixels across and y down, as AutoCAD 2021 maps them. A picture of 4 by 3 pixels placed at (10, 20) with a pixel 10 across and 10 up is 40 by 30, from (10, 20) to (50, 50).
It is clipped where its display options clip it (IsClipped, flag 4 of 70) and its record says a boundary was set (280 of 1): GetVertices(), GetGeometry(), GeometricExtents and Explode() follow the boundary then, and the frame of the whole image otherwise, as AutoCAD 2021 does. DxfReader reads no shape of it.
A file of R12 has none: an IMAGE is not added to one. Every group the class does not set is kept as it was.
Constructors
- DxfRasterImage(DxfRasterImageDef)
Initializes an image made in code of a definition of a drawing, as AutoCAD's
new RasterImage()given itsImageDefId: one unit a pixel, its corner at the origin, so that the picture of 4 by 3 pixels is (4, 0, 0) by (0, 3, 0) until it is placed by SetOrientation(GeoPoint3, GeoVector3, GeoVector3); shown and clipped by the whole picture (70 of 7, 280 of 0), its brightness and contrast 50 and its fade 0, as AutoCAD 2021 writes a new one. Appended to a block of the definition's drawing by AppendEntity(DxfEntity), it is given its IMAGEDEF_REACTOR there, as AutoCAD'sAssociateRasterDefgives one, and counted by GetEntityCount(out bool).
Properties
- Brightness
Gets or sets the brightness of the image (group 281), as AutoCAD's
Brightness: 0 to 100, 50 where the record gives none.
- ClipBoundaryType
Gets the kind of the image's clip boundary (group 71), as AutoCAD's
ClipBoundaryType; Invalid where the record gives neither 1 nor 2.
- Contrast
Gets or sets the contrast of the image (group 282), as AutoCAD's
Contrast: 0 to 100, 50 where the record gives none.
- DisplayOptions
Gets or sets how the image is shown (group 70), as the DXF reference, ezdxf and ACadSharp read the flags; AutoCAD 2021 writes 7 for a new image, and 15 once its transparency is on.
- Fade
Gets or sets how faded the image is (group 283), as AutoCAD's
Fade: 0 to 100, 0 where the record gives none.
- GeometricExtents
Gets the box of the image as it is shown, as AutoCAD's
GeometricExtents: that of GetVertices(), (10, 20, 0) to (50, 50, 0) for the picture 40 by 30 placed at (10, 20), (15, 20, 0) to (45, 45, 0) clipped by the triangle of the pixels (0, 0), (3, 0), (1.5, 2.5); clipped inverted (IsClipInverted), which shows what lies outside the triangle, that of its whole frame, (10, 20, 0) to (50, 50, 0), as AutoCAD 2021 gives it, its vertices and the lines it explodes into still those of the triangle.
- Height
Gets the length of the left of the image (the side
vof GetOrientation(out GeoPoint3, out GeoVector3, out GeoVector3)), as AutoCAD'sHeight: 30 for 3 pixels 10 up.
- ImageDef
Gets the IMAGEDEF the image shows (group 340), as AutoCAD's
ImageDefIdnames it: of its drawing, of the drawing it was copied from for a copy in no file; null for a WIPEOUT, which shows none, and where the drawing has no IMAGEDEF of the handle.
- ImageHeight
Gets how many pixels the image is up (group 23), as AutoCAD's
ImageHeight: 3 for a picture of 4 by 3; one for a WIPEOUT.
- ImageTransparency
Gets or sets whether the transparent pixels of the image are shown as such (flag 8 of group 70), as AutoCAD's
ImageTransparency.
- ImageWidth
Gets how many pixels the image is across (group 13), as AutoCAD's
ImageWidth: 4 for a picture of 4 by 3; one for a WIPEOUT.
- IsClipInverted
Gets or sets whether the boundary keeps the image outside it rather than inside (group 290), as ObjectARX's
isClipInverted, which AutoCAD 2021's .NET API does not give; false where the record gives none, as in every file before R2010. The boundary, its vertices and the lines it explodes into stay as they are.
- IsClipped
Gets or sets whether the image is clipped by its boundary, as AutoCAD 2021's
IsClippedreads and sets it: flag 4 of group 70, which AutoCAD sets on every new image. The boundary clips it where its record also says one was set (280 of 1, which SetClipBoundary(DxfClipBoundaryType, IReadOnlyList<GeoPoint2>) writes): the image clipped by a triangle and given false keeps its triangle, and shows its whole frame again, its 280 left at 1, as AutoCAD 2021 leaves it.
- Name
Gets or sets the name of the image, as AutoCAD's
Name: the name its IMAGEDEF has in the dictionary of images (ACAD_IMAGE_DICT), such aspx43; null where it shows no IMAGEDEF or none of the dictionary, as a WIPEOUT, for which AutoCAD 2021 throws.
- Path
Gets the file of the picture, as AutoCAD's
Path: the path its IMAGEDEF names (group 1), as the file writes it; null where it shows none, as a WIPEOUT, for which AutoCAD 2021 throws.
- PixelToModelTransform
Gets the transformation from the pixels of the image to the world, as AutoCAD 2021's
PixelToModelTransform: the pixel (x, y), counted from the centre of the top left pixel with y down, to its place, the third axis the image's normal. The picture of 4 by 3 pixels 10 apart placed at (10, 20) takes the pixel (0, 0) to (15, 45, 0) and (-0.5, -0.5), the top left corner, to (10, 50, 0).
- Position
Gets the corner of the image opposite the one it is placed at, as AutoCAD 2021's
Positiongives it: the placing corner (10) and the image's width and height along its pixels. The image 40 by 30 placed at (10, 20) gives (50, 50); the corner it is placed at is the origin of GetOrientation(out GeoPoint3, out GeoVector3, out GeoVector3).
- Rotation
Gets or sets the angle of the bottom of the image in the world's plane xy, as AutoCAD 2021's
Rotation: from the x axis, counter-clockwise, from 0 to 2 pi, of the vector of one pixel across seen from above; 0 for an image placed along x, pi for one mirrored about the y axis.
- ShowImage
Gets or sets whether the image is shown (flag 1 of group 70), as AutoCAD's
ShowImage; set, written as DisplayOptions writes it.
- Width
Gets the length of the bottom of the image (the side
uof GetOrientation(out GeoPoint3, out GeoVector3, out GeoVector3)), as AutoCAD'sWidth: 40 for 4 pixels 10 across.
Methods
- AssociateRasterDef(DxfRasterImageDef)
Makes the image show a definition of its drawing, as AutoCAD's
AssociateRasterDef: its 340 the definition, its size in pixels the definition's, its sides kept, so that the picture 40 by 30 of 4 by 3 pixels given one of 8 by 6 stays 40 by 30 of 8 by 6, its boundary scaled with the pixels, a polygon another writer left not closed written closed, as AutoCAD 2021 cannot open a drawing of an image whose polygon is not; and its IMAGEDEF_REACTOR taken from the definition it showed to this one, or made, as AutoCAD 2021 makes one, so that GetEntityCount(out bool) counts it.
- Explode()
Gets the lines the image breaks into, as AutoCAD 2021's
Explodebreaks an IMAGE and a WIPEOUT: a LINE along each side of GetVertices(), the frame of the image not clipped and its boundary clipped, each with the image's look, a side of no length left out. The picture 40 by 30 placed at (10, 20) gives four LINEs, from (10, 20, 0) to (10, 50, 0) and round; clipped by a triangle, three. AutoCAD's lines have no look of their own, to take the drawing's when appended.
- GetClipBoundary()
Gets the clip boundary of the image in pixels, as AutoCAD 2021's
GetClipBoundarygives it read from a file: a rectangle of the two corners its record holds as its five corners, the first again at the end, from its least corner, (x, y) of the least of each, up its x to the greatest y and round, whichever way the two are held; a polygon as its record holds it. The picture of 4 by 3 pixels not clipped holds (-0.5, -0.5) and (3.5, 2.5), and gives (-0.5, -0.5), (-0.5, 2.5), (3.5, 2.5), (3.5, -0.5), (-0.5, -0.5). The pixels are counted from the centre of the top left one, y down; a WIPEOUT's from -0.5 to 0.5 of its frame.
- GetOrientation(out GeoPoint3, out GeoVector3, out GeoVector3)
Gives the corner the image is placed at and its two sides, as AutoCAD's
Orientationgives them: the corner (group 10), the side along the bottom, the vector of one pixel across (11) times the pixels across (13), and the side up the left, the vector of one pixel up (12) times the pixels up (23). The image of 4 by 3 pixels 10 apart placed at (10, 20) gives (10, 20, 0), (40, 0, 0) and (0, 30, 0). The sides keep their lengths, and need not be square: AutoCAD keeps a sheared image so.
- GetVertices()
Gets the corners of the image as it is shown, in world coordinates, the first again at the end, as AutoCAD 2021's
GetVerticesgives them. Clipped (IsClipped, and a boundary set, 280 of 1), the corners of its boundary taken to the world (PixelToModelTransform): a rectangle from its least corner, (x, y) of the least of each, up its x to the greatest y and on; a polygon in its order. Else the frame of the whole image, from the corner it is placed at up its left side and round: the picture 40 by 30 placed at (10, 20) gives (10, 20, 0), (10, 50, 0), (50, 50, 0), (50, 20, 0) and (10, 20, 0); clipped by the triangle of the pixels (0, 0), (3, 0), (1.5, 2.5), it gives (15, 45, 0), (45, 45, 0), (30, 20, 0) and (15, 45, 0).
- ImageSize(bool)
Gets the size of the image in pixels, as AutoCAD's
ImageSize: the size its record keeps (13, 23), or, not cached, the size its IMAGEDEF gives (10, 20), the record's where it has none. The library reads no image file: what AutoCAD reads of the file when it loads it is the size its IMAGEDEF was given.
- SetClipBoundary(DxfClipBoundaryType, IReadOnlyList<GeoPoint2>)
Clips the image by a boundary, as AutoCAD's
SetClipBoundary: a rectangle given by its five corners, the first again at the end, written as the first and the third, as AutoCAD 2021 writes it; a polygon of three corners or more, its first again at the end, written as given, the last as the first. The boundary is in pixels, counted from the centre of the top left pixel with y down, and may cross itself or leave the image, as AutoCAD takes it; its record is said to be clipped (280 of 1). IsClipped is left as it is: the image clips by the boundary where it is on, as AutoCAD sets it on every new image.
- SetClipBoundaryToWholeImage()
Clips the image by nothing, as AutoCAD's
SetClipBoundaryToWholeImage: its boundary the rectangle of the whole image, from (-0.5, -0.5) to the pixels across and up less a half, (3.5, 2.5) for a picture of 4 by 3 and (0.5, 0.5) for a WIPEOUT, and its record said to be clipped by none (280 of 0), as AutoCAD 2021 writes it.
- SetOrientation(GeoPoint3, GeoVector3, GeoVector3)
Places the image anew, as AutoCAD's
Orientationset: at a corner with its two sides, written as the vectors of one pixel (11 and 12), each side divided by the pixels along it; the clip boundary, in pixels, goes with the image. The image of 4 by 3 pixels set at (0, 0, 0) with the sides (80, 0, 0) and (0, 60, 0) has pixels 20 across and 20 up. The sides need not be square or of one scale, as AutoCAD 2021 takes them.