001 /*----------------------------------------------------------------------------*/
002 /* Copyright (c) FIRST 2008-2012. All Rights Reserved. */
003 /* Open Source Software - may be modified and shared by FRC teams. The code */
004 /* must be accompanied by the FIRST BSD license file in the root directory of */
005 /* the project. */
006 /*----------------------------------------------------------------------------*/
007
008
009 package edu.wpi.first.wpilibj.image;
010
011 import com.sun.cldc.jna.Structure;
012
013 /**
014 *
015 * @author dtjones
016 */
017 public class CurveOptions extends Structure{
018
019 int m_extractionMode;
020 int m_threshold;
021 int m_filterSize;
022 int m_minLength;
023 int m_rowStepSize;
024 int m_columnStepSize;
025 int m_maxEndPointGap;
026 int m_onlyClosed;
027 int m_subPixelAccuracy;
028
029 public CurveOptions(int m_extractionMode, int m_threshold, int m_filterSize, int m_minLength, int m_rowStepSize, int m_columnStepSize, int m_maxEndPointGap, int m_onlyClosed, int m_subPixelAccuracy) {
030 this.m_extractionMode = m_extractionMode;
031 this.m_threshold = m_threshold;
032 this.m_filterSize = m_filterSize;
033 this.m_minLength = m_minLength;
034 this.m_rowStepSize = m_rowStepSize;
035 this.m_columnStepSize = m_columnStepSize;
036 this.m_maxEndPointGap = m_maxEndPointGap;
037 this.m_onlyClosed = m_onlyClosed;
038 this.m_subPixelAccuracy = m_subPixelAccuracy;
039 allocateMemory();
040 write();
041 }
042
043
044
045 public void read() {
046 }
047
048 public void write() {
049 backingNativeMemory.setInt(0, m_extractionMode);
050 backingNativeMemory.setInt(4, m_threshold);
051 backingNativeMemory.setInt(8, m_filterSize);
052 backingNativeMemory.setInt(12, m_minLength);
053 backingNativeMemory.setInt(16, m_rowStepSize);
054 backingNativeMemory.setInt(20, m_columnStepSize);
055 backingNativeMemory.setInt(24, m_maxEndPointGap);
056 backingNativeMemory.setInt(28, m_onlyClosed);
057 backingNativeMemory.setInt(32, m_subPixelAccuracy);
058 }
059
060 public int size() {
061 return 36;
062 }
063
064 public void free() {
065 release();
066 }
067
068 }