Skip to content

Commit aa46dde

Browse files
authored
Merge pull request #125 from kasemir/image_meta
VImage: Add x&yoffset as well as 'reversed' flags to image meta data
2 parents 71b384b + d131d09 commit aa46dde

3 files changed

Lines changed: 95 additions & 5 deletions

File tree

epics-vtype/vtype/src/main/java/org/epics/vtype/IVImage.java

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,32 @@ public class IVImage extends VImage {
1515

1616
private final int height;
1717
private final int width;
18+
private final int xoffset;
19+
private final int yoffset;
20+
private final boolean xreversed;
21+
private final boolean yreversed;
1822
private final ListNumber data;
1923
private final VImageDataType imageDataType;
2024
private final VImageType imageType;
2125

2226
IVImage(int height, int width, ListNumber data, VImageDataType imageDataType, VImageType imageType, Alarm alarm,
2327
Time time) {
24-
super();
28+
this(height, width, 0, 0, false, false, data, imageDataType, imageType, alarm, time);
29+
}
30+
31+
IVImage(int height, int width, int xoffset, int yoffset, boolean xreversed, boolean yreversed,
32+
ListNumber data, VImageDataType imageDataType, VImageType imageType, Alarm alarm,
33+
Time time) {
2534
VType.argumentNotNull("alarm", alarm);
2635
VType.argumentNotNull("time", time);
2736
this.alarm = alarm;
2837
this.time = time;
2938
this.height = height;
3039
this.width = width;
40+
this.xoffset = xoffset;
41+
this.yoffset = yoffset;
42+
this.xreversed = xreversed;
43+
this.yreversed = yreversed;
3144
this.data = data;
3245
this.imageDataType = imageDataType;
3346
this.imageType = imageType;
@@ -41,6 +54,22 @@ public int getWidth() {
4154
return width;
4255
}
4356

57+
public int getXOffset() {
58+
return xoffset;
59+
}
60+
61+
public int getYOffset() {
62+
return yoffset;
63+
}
64+
65+
public boolean isXReversed() {
66+
return xreversed;
67+
}
68+
69+
public boolean isYReversed() {
70+
return yreversed;
71+
}
72+
4473
public ListNumber getData() {
4574
return data;
4675
}

epics-vtype/vtype/src/main/java/org/epics/vtype/VImage.java

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ 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+
52+
/**
53+
* Is the horizontal axis reversed?
54+
* Defaults to false.
55+
*
56+
* @return <code>true</code> if axis is reversed
57+
*/
58+
public abstract boolean isXReversed();
59+
60+
/**
61+
* Is the vertical axis reversed?
62+
* Defaults to false.
63+
*
64+
* @return <code>true</code> if axis is reversed
65+
*/
66+
public abstract boolean isYReversed();
67+
3268
/**
3369
* Image data;
3470
*
@@ -65,7 +101,28 @@ public abstract class VImage extends VType implements AlarmProvider, TimeProvide
65101
* @return a new instance of VImage
66102
*/
67103
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);
104+
return of(height, width, 0, 0, false, false, data, imageDataType, vImageType, alarm, time);
105+
}
106+
107+
/**
108+
* Creates a new VImage.
109+
*
110+
* @param height image height
111+
* @param width image width
112+
* @param xoffset horizontal offset
113+
* @param yoffset vertical offset
114+
* @param xreversed is horizontal axis reversed?
115+
* @param yreversed is vertical axis reversed?
116+
* @param data image data
117+
* @param imageDataType image data type
118+
* @param vImageType image type
119+
* @param alarm alarm information
120+
* @param time timestamp
121+
* @return a new instance of VImage
122+
*/
123+
public static VImage of(int height, int width, int xoffset, int yoffset, boolean xreversed, boolean yreversed,
124+
final ListNumber data, VImageDataType imageDataType, VImageType vImageType, Alarm alarm, Time time) {
125+
return new IVImage(height, width, xoffset, yoffset, xreversed, yreversed, data, imageDataType, vImageType, alarm, time);
69126
}
70127

71128
@Override
@@ -80,6 +137,8 @@ public final boolean equals(Object obj) {
80137
return getClass().equals(other.getClass())
81138
&& getHeight() == other.getHeight()
82139
&& getWidth() == other.getWidth()
140+
&& getXOffset() == other.getXOffset()
141+
&& getYOffset() == other.getYOffset()
83142
&& getData().equals(other.getData())
84143
&& getDataType().equals(other.getDataType())
85144
&& getVImageType().equals(other.getVImageType())
@@ -95,6 +154,8 @@ public final int hashCode() {
95154
int hash = 7;
96155
hash = 23 * hash + Objects.hashCode(getHeight());
97156
hash = 23 * hash + Objects.hashCode(getWidth());
157+
hash = 23 * hash + Objects.hashCode(getXOffset());
158+
hash = 23 * hash + Objects.hashCode(getYOffset());
98159
hash = 23 * hash + Objects.hashCode(getData());
99160
hash = 23 * hash + Objects.hashCode(getDataType());
100161
hash = 23 * hash + Objects.hashCode(getVImageType());

pvAccessJava/src/org/epics/pvaccess/client/rpc/package.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
</head>
99

1010
<body>
11-
<h1>Support code for implementing channelRPC.</h1>
11+
<h2>Support code for implementing channelRPC.</h2>
1212

13-
<h1 style="text-align: center">PVService<br>
13+
<h2 style="text-align: center">PVService<br>
1414
This page documentation needs to be updated!<br>
15-
2011.08.22</h1>
15+
2011.08.22</h2>
1616
CONTENTS
1717

1818
<div class="toc">

0 commit comments

Comments
 (0)