@@ -29,6 +29,26 @@ public abstract class VImage extends VType implements AlarmProvider, TimeProvide
2929 */
3030 public abstract int getWidth ();
3131
32+ /**
33+ * Horizontal pixel offset.
34+ * For sub-images within a larger image,
35+ * this is the X offset.
36+ * Defaults to zero.
37+ *
38+ * @return pixel offset
39+ */
40+ public abstract int getXOffset ();
41+
42+ /**
43+ * Vertical pixel offset.
44+ * For sub-images within a larger image,
45+ * this is the Y offset.
46+ * Defaults to zero.
47+ *
48+ * @return pixel offset
49+ */
50+ public abstract int getYOffset ();
51+
3252 /**
3353 * Image data;
3454 *
@@ -65,7 +85,25 @@ public abstract class VImage extends VType implements AlarmProvider, TimeProvide
6585 * @return a new instance of VImage
6686 */
6787 public static VImage of (int height , int width , final ListNumber data , VImageDataType imageDataType , VImageType vImageType , Alarm alarm , Time time ) {
68- return new IVImage (height , width , data , imageDataType , vImageType , alarm , time );
88+ return of (height , width , 0 , 0 , data , imageDataType , vImageType , alarm , time );
89+ }
90+
91+ /**
92+ * Creates a new VImage.
93+ *
94+ * @param height image height
95+ * @param width image width
96+ * @param xoffset horizontal offset
97+ * @param yoffset vertical offset
98+ * @param data image data
99+ * @param imageDataType image data type
100+ * @param vImageType image type
101+ * @param alarm alarm information
102+ * @param time timestamp
103+ * @return a new instance of VImage
104+ */
105+ public static VImage of (int height , int width , int xoffset , int yoffset , final ListNumber data , VImageDataType imageDataType , VImageType vImageType , Alarm alarm , Time time ) {
106+ return new IVImage (height , width , xoffset , yoffset , data , imageDataType , vImageType , alarm , time );
69107 }
70108
71109 @ Override
@@ -80,6 +118,8 @@ public final boolean equals(Object obj) {
80118 return getClass ().equals (other .getClass ())
81119 && getHeight () == other .getHeight ()
82120 && getWidth () == other .getWidth ()
121+ && getXOffset () == other .getXOffset ()
122+ && getYOffset () == other .getYOffset ()
83123 && getData ().equals (other .getData ())
84124 && getDataType ().equals (other .getDataType ())
85125 && getVImageType ().equals (other .getVImageType ())
@@ -95,6 +135,8 @@ public final int hashCode() {
95135 int hash = 7 ;
96136 hash = 23 * hash + Objects .hashCode (getHeight ());
97137 hash = 23 * hash + Objects .hashCode (getWidth ());
138+ hash = 23 * hash + Objects .hashCode (getXOffset ());
139+ hash = 23 * hash + Objects .hashCode (getYOffset ());
98140 hash = 23 * hash + Objects .hashCode (getData ());
99141 hash = 23 * hash + Objects .hashCode (getDataType ());
100142 hash = 23 * hash + Objects .hashCode (getVImageType ());
0 commit comments