diff options
34 files changed, 2255 insertions, 489 deletions
diff --git a/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp b/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp index 343203368..62d702b7f 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp +++ b/Software/Android_Studio/ColorCapture/app/src/main/cpp/native-lib.cpp @@ -8,8 +8,6 @@ using namespace cv; -Mat *mCanny = NULL; - enum RotateFlags { ROTATE_90DEG_CLOCKWISE = 0, //Rotate 90 degrees clockwise ROTATE_180DEG = 1, //Rotate 180 degrees clockwise @@ -33,28 +31,24 @@ void rot90(cv::Mat &matImage, int rotflag) { extern "C" JNIEXPORT jboolean JNICALL Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( - JNIEnv *env, jobject instance, jint width, - jint height, jbyteArray NV21FrameData, - jintArray outPixels,jintArray wrapedOutPixels) -{ + JNIEnv *env, jobject instance, jint frameWidth, + jint frameHeight, jint correctedWidth, jint correctedHeight, jbyteArray NV21FrameData, + jintArray outPixels, jintArray wrapedOutPixels) { jbyte *pNV21FrameData = env->GetByteArrayElements(NV21FrameData, 0); jint *poutPixels = env->GetIntArrayElements(outPixels, 0); jint *pwrapedPixels = env->GetIntArrayElements(wrapedOutPixels, 0); //// - jboolean has_result = false; + jboolean has_result = jboolean(false); try { ColorCaptureLib capture; - if (mCanny == NULL) { - mCanny = new Mat(height, width, CV_8UC1); - } - - Mat yuv(height + height / 2, width, CV_8UC1, (unsigned char *) pNV21FrameData); + Mat yuv(frameHeight + frameHeight / 2, frameWidth, CV_8UC1, + (unsigned char *) pNV21FrameData); Mat rgb; - Mat result(width, height, CV_8UC4, (unsigned char *) poutPixels); + Mat result(frameWidth, frameHeight, CV_8UC4, (unsigned char *) poutPixels); cvtColor(yuv, rgb, COLOR_YUV2RGB_NV21); Mat gray; @@ -69,7 +63,7 @@ Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( __android_log_print(ANDROID_LOG_ERROR, "FOCUS", "\n Focus measure is %f \n", focusMeasure); - rot90(rgb,ROTATE_180DEG); + rot90(rgb, ROTATE_180DEG); //resize(src, dst, dst.size(), 0, 0, interpolation); @@ -83,19 +77,23 @@ Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( circle(rgb, vertices[i], 2, CV_RGB(0, 0, 255), -1); } - int w = 300; - int h = 330; + int w = correctedWidth; + int h = correctedHeight; - Mat wraped(h,w,CV_8UC4, (unsigned char *) pwrapedPixels); + Mat wraped(h, w, CV_8UC4, (unsigned char *) pwrapedPixels); if (vertices.size() == 4) { has_result = jboolean(true); Mat m = capture.ApplyHomography(rgb, vertices, Size(w, h)); + + //Draw Blocks! + BhBlocks b(m, w / 10, h / 11); + b.drawBlocks(m, Scalar(255, 0, 0), 1); + cvtColor(m, wraped, COLOR_RGB2BGRA); - //BhBlocks b(image, w / columns, h / rows); - //b.drawBlocks(image, Scalar(0, 0, 0), 1); + m.release(); } cvtColor(rgb, result, COLOR_RGB2BGRA); @@ -125,9 +123,15 @@ Java_com_twine_colorcapture_opencv_ImageProcessor_ProcessImage( env->ReleaseByteArrayElements(NV21FrameData, pNV21FrameData, 0); env->ReleaseIntArrayElements(outPixels, poutPixels, 0); env->ReleaseIntArrayElements(wrapedOutPixels, pwrapedPixels, 0); + + yuv.release(); + rgb.release(); + result.release(); + wraped.release(); + dst.release(); + gray.release(); } - catch (Exception ex) - { + catch (Exception ex) { env->ThrowNew(env->FindClass("java/lang/NullPointerException"), ex.what()); } return has_result; diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java new file mode 100644 index 000000000..a5faab0d1 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/core/AnimationsHelper.java @@ -0,0 +1,59 @@ +package com.twine.colorcapture.core; + +import android.view.View; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.Animation.AnimationListener; +import android.view.animation.ScaleAnimation; + +/** + * Contains helper methods related to animations. + */ +public class AnimationsHelper +{ + /** + * Animates the specified view scale transform. + */ + public static void animateScale(View v, float startScale, float endScale, int duration, boolean keepResult, IAction onCompleted) + { + Animation anim = new ScaleAnimation( + startScale, endScale, // Start and end values for the X axis scaling + 1f, 1f, // Start and end values for the Y axis scaling + Animation.RELATIVE_TO_SELF, 0f, // Pivot point of X scaling + Animation.RELATIVE_TO_SELF, 0f); // Pivot point of Y scaling + anim.setFillAfter(keepResult); // Needed to keep the result of the animation + anim.setDuration(duration); + anim.setAnimationListener(new AnimationListener() + { + @Override + public void onAnimationStart(Animation animation) + { + + } + + @Override + public void onAnimationEnd(Animation animation) + { + if (onCompleted != null) onCompleted.invoke(); + } + + @Override + public void onAnimationRepeat(Animation animation) + { + + } + }); + v.startAnimation(anim); + } + + /** + * Animates the specified view alpha channel. + */ + public static void animateAlpha(View v, float from, float to, int duration, boolean keepResult) + { + AlphaAnimation animation1 = new AlphaAnimation(from, to); + animation1.setDuration(duration); + animation1.setFillAfter(keepResult); + v.startAnimation(animation1); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/FragmentBase.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/FragmentBase.java index d9cb58725..48d970a6c 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/FragmentBase.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/mvvm/FragmentBase.java @@ -1,5 +1,6 @@ package com.twine.colorcapture.mvvm; +import android.animation.Animator; import android.app.Fragment; import android.databinding.DataBindingUtil; import android.databinding.ViewDataBinding; @@ -8,10 +9,14 @@ import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.Animation.AnimationListener; +import android.view.animation.AnimationUtils; import android.widget.EditText; import android.widget.Toast; import com.mobsandgeeks.saripaar.ValidationError; import com.mobsandgeeks.saripaar.Validator; +import com.twine.colorcapture.R; import com.twine.colorcapture.core.IAction1; import java.lang.reflect.Method; diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java index 68a6a3068..175a99b77 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/navigation/AndroidNavigationProvider.java @@ -3,6 +3,7 @@ package com.twine.colorcapture.navigation; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; +import android.util.Log; import com.twine.colorcapture.R; import com.twine.colorcapture.mvvm.ExtendedObject; diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java index 02dde50e7..373f1009a 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/opencv/ImageProcessor.java @@ -2,5 +2,5 @@ package com.twine.colorcapture.opencv; public class ImageProcessor { - public native boolean ProcessImage(int width, int height, byte[] NV21FrameData, int[] pixels,int[] wpixels); + public native boolean ProcessImage(int width, int height,int correctedWidth,int correctedHeight, byte[] NV21FrameData, int[] pixels,int[] wpixels); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java index 491a05564..87e5c56cd 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragment.java @@ -23,7 +23,6 @@ import android.widget.ImageView; import com.twine.colorcapture.App; import com.twine.colorcapture.R; -import com.twine.colorcapture.core.Task; import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.databinding.FragmentCaptureBinding; import com.twine.colorcapture.mvvm.FragmentBase; @@ -33,7 +32,6 @@ import com.yanzhenjie.zbar.ImageScanner; import com.yanzhenjie.zbar.Symbol; import com.yanzhenjie.zbar.SymbolSet; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; @@ -43,54 +41,45 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur private Camera camera = null; private ImageView imagePreview = null; private ImageView imagewrappedPreview = null; - private Bitmap bitmap = null; - private Bitmap wrappedBitmap = null; - private int[] pixels = null; - private int[] wrappedPixels = null; - private byte[] frameData = null; private int imageFormat; - private boolean bProcessing = false; private int cameraId; - private int previewWidth; - private int previewHeight; - private ImageProcessor processor; private Handler mHandler; private SurfaceView surfaceView; + private ICaptureFragmentListener listener; ObjectAnimator animator; View scannerLayout; View scannerBar; - + public CaptureFragment() { // Required empty public constructor mHandler = new Handler(Looper.getMainLooper()); - processor = new ImageProcessor(); } - + @Override protected void onCreated() { super.onCreated(); - + imagePreview = getView().findViewById(R.id.imagePreview); imagewrappedPreview = getView().findViewById(R.id.imagePreviewWrapped); - + surfaceView = new SurfaceView(this.getActivity()); - + SurfaceHolder camHolder = surfaceView.getHolder(); camHolder.addCallback(this); camHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - + FrameLayout surfraceFrame = (FrameLayout) getView().findViewById(R.id.surfaceViewFrame); - + startScanAnimation(); - + new Handler().postDelayed(() -> { surfraceFrame.addView(surfaceView, new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); - },500); + }, 500); } - + private void startScanAnimation() { //Scanner overlay @@ -98,69 +87,70 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur scannerBar = getView().findViewById(R.id.scannerBar); animator = null; ViewTreeObserver vto = scannerLayout.getViewTreeObserver(); - vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() + { @Override - public void onGlobalLayout() { - + public void onGlobalLayout() + { + scannerLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this); - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) + { scannerLayout.getViewTreeObserver(). removeGlobalOnLayoutListener(this); - - } else { + + } + else + { scannerLayout.getViewTreeObserver(). removeOnGlobalLayoutListener(this); } - - float destination = (float)(scannerLayout.getY() + + + float destination = (float) (scannerLayout.getY() + scannerLayout.getHeight()); - + animator = ObjectAnimator.ofFloat(scannerBar, "translationY", scannerLayout.getY(), destination); - + animator.setRepeatMode(ValueAnimator.REVERSE); animator.setRepeatCount(ValueAnimator.INFINITE); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(2000); animator.start(); - + } }); } - + @Override protected int getLayoutId() { return R.layout.fragment_capture; } - + @Override protected void inject() { App.getComponent().inject(this); } - + @Override public String getTitle() { return "Capture"; } - + @Override public void onPreviewFrame(byte[] data, Camera camera) { if (imageFormat == ImageFormat.NV21) { //We only accept the NV21(YUV420) format. - if (!bProcessing) - { - frameData = data; - processImage(); - } + listener.onFrameAvailable(data); } } - + @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { @@ -175,9 +165,9 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur break; } } - + camera = Camera.open(cameraId); - + try { camera.setPreviewDisplay(surfaceHolder); @@ -189,18 +179,18 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur camera = null; } } - + @Override public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) { Camera.Parameters parameters; - + setCameraDisplayOrientation(); - + parameters = camera.getParameters(); - + List<Size> sizes = parameters.getSupportedPreviewSizes(); - + for (Camera.Size size : parameters.getSupportedPreviewSizes()) { if (size.width >= 1200 & size.width <= 1280) @@ -210,30 +200,23 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur break; } } - - int width = parameters.getPreviewSize().width; - int height = parameters.getPreviewSize().height; - + imageFormat = parameters.getPreviewFormat(); - + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); - + camera.setParameters(parameters); - + parameters = camera.getParameters(); - - previewWidth = parameters.getPreviewSize().width; - previewHeight = parameters.getPreviewSize().height; - - bitmap = Bitmap.createBitmap(previewHeight, previewWidth, Bitmap.Config.ARGB_8888); - wrappedBitmap = Bitmap.createBitmap(300, 330, Bitmap.Config.ARGB_8888); - - pixels = new int[previewWidth * previewHeight]; - wrappedPixels = new int[330 * 300]; - + + int width = parameters.getPreviewSize().width; + int height = parameters.getPreviewSize().height; + + listener.onPreviewSettingsAvailable(width, height); + camera.startPreview(); } - + @Override public void surfaceDestroyed(SurfaceHolder surfaceHolder) { @@ -242,7 +225,7 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur camera.release(); camera = null; } - + private void setCameraDisplayOrientation() { android.hardware.Camera.CameraInfo info = @@ -265,7 +248,7 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur degrees = 270; break; } - + int result; if (info.facing == CameraInfo.CAMERA_FACING_FRONT) { @@ -277,50 +260,19 @@ public class CaptureFragment extends FragmentBase<FragmentCaptureBinding, Captur result = (info.orientation - degrees + 360) % 360; } camera.setDisplayOrientation(result); - + } - - private void processImage() - { - new TaskBuilder() - .setAction(() -> - { - bProcessing = true; - processor.ProcessImage(previewWidth, previewHeight, frameData, pixels, wrappedPixels); - bitmap.setPixels(pixels, 0, previewHeight, 0, 0, previewHeight, previewWidth); - wrappedBitmap.setPixels(wrappedPixels, 0, 300, 0, 0, 300, 330); + @Override + public void setListener(ICaptureFragmentListener listener) + { + this.listener = listener; + } - Log.d("BARCODE", "scanning barcode..."); - ImageScanner scanner = new ImageScanner(); - Image img = new Image(bitmap.getWidth(),bitmap.getHeight(),"RGB4"); - img.setData(pixels); - int result = scanner.scanImage(img.convert("Y800")); - - if (result != 0) - { - Log.d("BARCODE", "Got positive result..."); - - String text = null; - - SymbolSet symSet = scanner.getResults(); - for (Symbol sym : symSet) - text = sym.getData(); - - - String f = text; - - Log.d("BARCODE", "Barcode text is: " + text); - } - - }) - .setContinueWith(() -> - { - imagePreview.setImageBitmap(bitmap); - imagewrappedPreview.setImageBitmap(wrappedBitmap); - bProcessing = false; - }) - .build() - .start(); + @Override + public void onFrameResult(Bitmap frameBitmap, Bitmap correctedBitmap, String barcode) + { + imagePreview.setImageBitmap(frameBitmap); + imagewrappedPreview.setImageBitmap(correctedBitmap); } }
\ No newline at end of file diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java index 6be978036..b434b9dfb 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/CaptureFragmentVM.java @@ -1,8 +1,114 @@ package com.twine.colorcapture.views.capture; +import android.graphics.Bitmap; +import android.util.Log; +import android.util.Size; + +import com.twine.colorcapture.core.Task.TaskBuilder; import com.twine.colorcapture.mvvm.ViewModelBase; +import com.twine.colorcapture.opencv.ImageProcessor; +import com.twine.colorcapture.views.capture.ICaptureFragment.ICaptureFragmentListener; +import com.yanzhenjie.zbar.Image; +import com.yanzhenjie.zbar.ImageScanner; +import com.yanzhenjie.zbar.Symbol; +import com.yanzhenjie.zbar.SymbolSet; -public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> +public class CaptureFragmentVM extends ViewModelBase<ICaptureFragment> implements ICaptureFragmentListener { - + private ImageProcessor processor; + private Bitmap frameBitmap = null; + private Bitmap correctedBitmap = null; + private int[] framePixels = null; + private int[] correctedPixels = null; + private int previewWidth; + private int previewHeight; + private boolean isProcessing; + private byte[] frameData; + private String barcode; + private Size correctedSize = new Size(300, 330); //The desired cropped rectified bitmap. + + public CaptureFragmentVM() + { + processor = new ImageProcessor(); + } + + @Override + protected void onViewAttached(ICaptureFragment view) + { + super.onViewAttached(view); + view.setListener(this); + } + + @SuppressWarnings("SuspiciousNameCombination") + @Override + public void onFrameAvailable(byte[] frame) + { + if (!isProcessing) + { + isProcessing = true; + + frameData = frame; + + new TaskBuilder() + .setAction(() -> + { + isProcessing = true; + + processor.ProcessImage( + previewWidth, + previewHeight, + correctedSize.getWidth(), + correctedSize.getHeight(), + frameData, + framePixels, + correctedPixels); + + frameBitmap.setPixels(framePixels, 0, previewHeight, 0, 0, previewHeight, previewWidth); + correctedBitmap.setPixels(correctedPixels, 0, correctedSize.getWidth(), 0, 0, correctedSize.getWidth(), correctedSize.getHeight()); + + + Log.d("BARCODE", "scanning barcode..."); + ImageScanner scanner = new ImageScanner(); + Image img = new Image(frameBitmap.getWidth(), frameBitmap.getHeight(), "RGB4"); + img.setData(framePixels); + int result = scanner.scanImage(img.convert("Y800")); + + if (result != 0) + { + Log.d("BARCODE", "Got positive result..."); + + String text = null; + + SymbolSet symSet = scanner.getResults(); + for (Symbol sym : symSet) + text = sym.getData(); + + + barcode = text; + + Log.d("BARCODE", "Barcode text is: " + text); + } + + }) + .setContinueWith(() -> + { + view.onFrameResult(frameBitmap, correctedBitmap, barcode); + isProcessing = false; + }) + .build() + .start(); + } + } + + @SuppressWarnings("SuspiciousNameCombination") + @Override + public void onPreviewSettingsAvailable(int previewWidth, int previewHeight) + { + this.previewWidth = previewWidth; + this.previewHeight = previewHeight; + frameBitmap = Bitmap.createBitmap(previewHeight, previewWidth, Bitmap.Config.ARGB_8888); + correctedBitmap = Bitmap.createBitmap(correctedSize.getWidth(), correctedSize.getHeight(), Bitmap.Config.ARGB_8888); + framePixels = new int[previewWidth * previewHeight]; + correctedPixels = new int[correctedSize.getWidth() * correctedSize.getHeight()]; + } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/ICaptureFragment.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/ICaptureFragment.java index c88d632b6..434e5b10d 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/ICaptureFragment.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/capture/ICaptureFragment.java @@ -1,7 +1,19 @@ package com.twine.colorcapture.views.capture; +import android.graphics.Bitmap; + import com.twine.colorcapture.mvvm.IView; public interface ICaptureFragment extends IView { + void setListener(ICaptureFragmentListener listener); + + void onFrameResult(Bitmap frameBitmap,Bitmap correctedBitmap,String barcode); + + interface ICaptureFragmentListener + { + void onFrameAvailable(byte[] frame); + + void onPreviewSettingsAvailable(int previewWidth, int previewHeight); + } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java index 56f426f9c..74e3d5707 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivity.java @@ -4,7 +4,9 @@ import android.app.FragmentTransaction; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; +import android.support.v4.widget.DrawerLayout; import android.util.Log; +import android.view.Gravity; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -35,7 +37,6 @@ import butterknife.ButterKnife; public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivityVM> implements IMainActivity { private boolean displayOnboarding = false; - private boolean isMenuOpened; @Inject public INavigationProvider navigationProvider; @@ -43,15 +44,12 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity @BindView(R.id.btnMenu) Button btnMenu; - @BindView(R.id.frameMask) - FrameLayout frameMask; - - @BindView(R.id.frameMenu) - FrameLayout frameMenu; - @BindView(R.id.header) LinearLayout frameHeader; + @BindView(R.id.drawerLayout) + DrawerLayout drawerLayout; + // Used to load the 'native-lib' library on application startup. static { @@ -101,9 +99,7 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity } else { - new Handler().postDelayed(() -> { - showHeader(); - },2000); + new Handler().postDelayed(this::showHeader,2000); navigationProvider.navigateTo(NavigationView.Loading, false); } @@ -112,71 +108,8 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity btnMenu.setOnClickListener((x) -> { Log.d("TCC", "Clicked..."); - openMenu(); - }); - - frameMask.setOnClickListener((x) -> - { - Log.d("TCC", "Closed..."); - closeMenu(); - }); - - frameMask.setClickable(false); - frameMask.setFocusable(false); - } - - @Override - public void onBackPressed() - { - if (!isMenuOpened) - { - super.onBackPressed(); - } - else - { - closeMenu(); - } - } - - private void openMenu() - { - frameMask.setVisibility(View.VISIBLE); - frameMenu.setVisibility(View.VISIBLE); - frameMask.setClickable(true); - frameMask.setFocusable(true); - frameMenu.setClickable(true); - frameMenu.setFocusable(true); - frameMask.setAlpha(1); - animateAlpha(frameMask, 0, 1, 200, true); - frameMenu.setScaleX(1); - scaleView(frameMenu, 0, 1, 200, true, null); - isMenuOpened = true; - } - - private void closeMenu() - { - animateAlpha(frameMask, 1, 0, 200, true); - scaleView(frameMenu, 1, 0, 200, false, () -> - { - frameMask.setClickable(false); - frameMask.setFocusable(false); - frameMenu.setClickable(false); - frameMenu.setFocusable(false); - frameMask.setAlpha(0); - frameMask.setVisibility(View.GONE); - frameMenu.setVisibility(View.GONE); + drawerLayout.openDrawer(Gravity.START); }); - isMenuOpened = false; - } - - private void showHeader() - { - frameHeader.setVisibility(View.VISIBLE); - } - - private void hideHeader() - { - frameHeader.setVisibility(View.GONE); } @Override @@ -191,49 +124,13 @@ public class MainActivity extends ActivityBase<ActivityMainBinding, MainActivity App.getComponent().inject(this); } - public void scaleView(View v, float startScale, float endScale, int duration, boolean keepResult, IAction onCompleted) + private void showHeader() { - Animation anim = new ScaleAnimation( - startScale, endScale, // Start and end values for the X axis scaling - 1f, 1f, // Start and end values for the Y axis scaling - Animation.RELATIVE_TO_SELF, 0f, // Pivot point of X scaling - Animation.RELATIVE_TO_SELF, 0f); // Pivot point of Y scaling - anim.setFillAfter(keepResult); // Needed to keep the result of the animation - anim.setDuration(duration); - anim.setAnimationListener(new AnimationListener() - { - @Override - public void onAnimationStart(Animation animation) - { - - } - - @Override - public void onAnimationEnd(Animation animation) - { - if (onCompleted != null) onCompleted.invoke(); - } - - @Override - public void onAnimationRepeat(Animation animation) - { - - } - }); - v.startAnimation(anim); + frameHeader.setVisibility(View.VISIBLE); } - public void animateAlpha(View v, float from, float to, int duration, boolean keepResult) + private void hideHeader() { - AlphaAnimation animation1 = new AlphaAnimation(from, to); - animation1.setDuration(duration); - animation1.setFillAfter(keepResult); - v.startAnimation(animation1); + frameHeader.setVisibility(View.GONE); } - - /** - * A native method that is implemented by the 'native-lib' native library, - * which is packaged with this application. - */ -// public native String stringFromJNI(); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml index 7ac58f008..1d7d77ad4 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/activity_main.xml @@ -12,7 +12,7 @@ type="com.twine.colorcapture.views.main.MainActivityVM" /> </data> - <FrameLayout + <android.support.v4.widget.DrawerLayout android:id="@+id/drawerLayout" android:layout_width="match_parent" android:layout_height="match_parent"> @@ -82,36 +82,10 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/header" /> - - <!--Side Menu--> - <FrameLayout - android:id="@+id/frameMask" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/colorMask" - android:clickable="false" - android:focusable="false" - android:visibility="gone" - android:alpha="0"> - - <FrameLayout - android:id="@+id/frameMenu" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:visibility="gone" - android:scaleX="0" - android:transformPivotX="0dp"> - - <include - layout="@layout/side_menu" - bind:vm="@{vm}" /> - - </FrameLayout> - </FrameLayout> - </RelativeLayout> + <include layout="@layout/side_menu" bind:vm="@{vm}" /> - </FrameLayout> + </android.support.v4.widget.DrawerLayout> </layout> diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differindex fc78951f4..01ccbbe35 100644 --- a/Software/DB/PPC/Tango.mdf +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf Binary files differindex 58e5492a8..16e0d9ea6 100644 --- a/Software/DB/PPC/Tango_log.ldf +++ b/Software/DB/PPC/Tango_log.ldf diff --git a/Software/PMR/Messages/ColorLab/GradientConversionInput.proto b/Software/PMR/Messages/ColorLab/GradientConversionInput.proto new file mode 100644 index 000000000..08cbe585c --- /dev/null +++ b/Software/PMR/Messages/ColorLab/GradientConversionInput.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package Tango.PMR.ColorLab; +option java_package = "com.twine.tango.pmr.colorlab"; + +import "ProcessRange.proto"; +import "InputLiquid.proto"; +import "InputRGB.proto"; + +message GradientConversionInput +{ + double ThreadL = 1; + double ThreadA = 2; + double ThreadB = 3; + bytes ForwardData = 4; + double SegmentLength = 5; + double DeltaChroma = 6; + double DeltaL = 7; + repeated InputRGB Colors = 8; + repeated InputLiquid InputLiquids = 9; + repeated ProcessRange ProcessRanges = 10; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/ColorLab/GradientConversionOutput.proto b/Software/PMR/Messages/ColorLab/GradientConversionOutput.proto new file mode 100644 index 000000000..57b74e22b --- /dev/null +++ b/Software/PMR/Messages/ColorLab/GradientConversionOutput.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +package Tango.PMR.ColorLab; +option java_package = "com.twine.tango.pmr.colorlab"; + +import "OutputCoordinates.proto"; + +message GradientConversionOutput +{ + repeated OutputCoordinates Coordinates = 1; + bool HasError = 2; + string ErrorMessage = 3; +}
\ No newline at end of file diff --git a/Software/PMR/Messages/ColorLab/InputRGB.proto b/Software/PMR/Messages/ColorLab/InputRGB.proto new file mode 100644 index 000000000..bc0983fb6 --- /dev/null +++ b/Software/PMR/Messages/ColorLab/InputRGB.proto @@ -0,0 +1,11 @@ +syntax = "proto3"; + +package Tango.PMR.ColorLab; +option java_package = "com.twine.tango.pmr.colorlab"; + +message InputRGB +{ + int32 Red = 1; + int32 Green = 2; + int32 Blue = 3; +}
\ No newline at end of file diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp index d08e851c0..1ede4a356 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.cpp @@ -9,6 +9,9 @@ #include "OutputLiquid.pb-c.h" #include "InputLiquid.pb-c.h" #include "LiquidType.pb-c.h" +#include "GradientConversionInput.pb-c.h" +#include "GradientConversionOutput.pb-c.h" +#include "InputRGB.pb-c.h" #include <iostream> #include <stdio.h> #include "Dense" @@ -390,7 +393,6 @@ void Tango::ColorLib::ColorConverter::fillRGB(OutputCoordinates *outputCoords, V outputCoords->blue = (int32_t)std::round(RGBOut(2)); } - void Tango::ColorLib::ColorConverter::readColorTransformations(ConversionInput* conversionInput) { //Read thread white. Thread White is given in CIELab Space @@ -596,7 +598,6 @@ void Tango::ColorLib::ColorConverter::readCalibrationTables(ConversionInput* con return; } - void Tango::ColorLib::ColorConverter::SetCalibData(CalibrationData *calibrationData, int i, CalibData *tmpCurve) { if (calibrationData->calibrationpoints <= 0) @@ -1216,202 +1217,7 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i conversionInput = conversion_input__unpack(NULL, input_buffer_size, input_buffer); - - //Filter and arrange colors (Should change from 3 to 4 if black ink is included) - - int numofInks = CountNumberofInks(conversionInput); - if (numofInks < 0) - throw std::exception("Duplicate inks"); - int expected_liquids = numofInks; - original_input_liquids_count = conversionInput->inputcoordinates->n_inputliquids; - original_input_liquids = conversionInput->inputcoordinates->inputliquids; - - InputLiquid** filteredInputLiquids = (InputLiquid**)malloc(sizeof(InputLiquid*) * expected_liquids); - - for (size_t i = 0; i < conversionInput->inputcoordinates->n_inputliquids; i++) - { - InputLiquid* liquid = conversionInput->inputcoordinates->inputliquids[i]; - - switch (liquid->liquidtype) - { - case LIQUID_TYPE__Cyan: - filteredInputLiquids[0] = liquid; - break; - case LIQUID_TYPE__Magenta: - filteredInputLiquids[1] = liquid; - break; - case LIQUID_TYPE__Yellow: - filteredInputLiquids[2] = liquid; - break; - case LIQUID_TYPE__Black: - filteredInputLiquids[3] = liquid; - break; - } - } - - conversionInput->inputcoordinates->inputliquids = filteredInputLiquids; - conversionInput->inputcoordinates->n_inputliquids = expected_liquids; - //Filter and arrange colors - - - - //Initialize Output... - ConversionOutput *conversionOutput = (ConversionOutput*)malloc(sizeof(ConversionOutput)); - conversion_output__init(conversionOutput); - // ConversionOutput conversionOutput = CONVERSION_OUTPUT__INIT; - - - size_t n_elements = 0; - bool InGamut = false; - m_WP.Set(0.9505, 1.00, 1.0888); //D65 - //count number if inks - // int numofInks = CountNumberofInks(conversionInput); - readColorTransformations(conversionInput); - - //read calibration tables and store them in m_CalibCurves - - readCalibrationTables(conversionInput); - m_LinInterp = new Interp[numofInks]; - //m_LinInterp = DBG_NEW Interp[numofInks]; - m_InvLinInterp = new Interp[numofInks]; - //m_InvLinInterp = DBG_NEW Interp[numofInks]; - InitInterpolations(numofInks, m_LinInterp, m_InvLinInterp); - - //Initialize CIECAM02 transformation - Illum IL = D65; - SURROUND sur = average; - CAM02CS CS = UCS; - m_Conv02 = new ColorConvert(IL, IL, Y_b, L_A, sur, CS); - //m_Conv02 = DBG_NEW ColorConvert(IL, IL, Y_b, L_A, sur, CS); - SetnA2BnSepIn(m_A2BTransform->GetSeparationsIn()); - SetnA2BnSepOut(m_A2BTransform->GetSeparationsOut()); - SetnB2AnSepIn(m_B2ATransform->GetSeparationsIn()); - SetnB2AnSepOut(m_B2ATransform->GetSeparationsOut()); - - SetNumberOfInks(m_nB2AnSepOut); - // Compare Strip White point to Color Table White Point - CompareWhitePoints(); - - if (numofInks != m_nB2AnSepOut) - throw std::exception("Number of available inks does not match ink tables"); - - VectorXd InkOut(m_nB2AnSepOut); - VectorXd RGBOut(3); - VectorXd LabOut(3); - VectorXd NLInkOut(m_nB2AnSepOut); - VectorXd Volume(m_nB2AnSepOut); - //set maxNlPerCM - VectorXd NlperCM(m_nB2AnSepOut); - NlperCM.setZero(); - m_maxNlPerCM = NlperCM; - for (int i = 0; i < m_nB2AnSepOut; ++i) - SetMaxNLperCM(conversionInput->inputcoordinates->inputliquids[i]->maxnanoliterpercentimeter, i); - m_nVolumes = m_nB2AnSepOut; - int GamutRegion = 0; - //Convert input data to linear inks - if (conversionInput->colorspace == COLOR_SPACE__Volume) - { - ConvertVolumeToRGBDisplay(conversionInput, Volume, RGBOut, LabOut, GamutRegion); - InGamut = true; - } - else - { - ConvertColorToLinearInks(conversionInput, InkOut, RGBOut, LabOut, GamutRegion, InGamut); - //Convert to Nonlinear Inks - ConvertToNLInks(InkOut, NLInkOut); - //Convert to [nl/cm] - NLInkPToVolume(NLInkOut, Volume); - //OutputCoordinates outputCoords = OUTPUT_COORDINATES__INIT; - } - OutputCoordinates *outputCoords = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); - output_coordinates__init(outputCoords); - fillRGB(outputCoords, RGBOut); - fillVolume(outputCoords, Volume); - conversionOutput->has_outofgamut = true; - conversionOutput->outofgamut = !(InGamut); - conversionOutput->singlecoordinates = outputCoords; - - - if (!conversionInput->singlemode) //Skip if input requests single result only. - { - //input was processed. - //process neighboring values - //nhive includes 2 outer neighbors of the central Lab value, chroma + delta, chroma + 2delta - // and variation in L positioned on the side of the beehive. - //The set is arrange in a 5x6 matrix, where the 5x5 contains the variation in (Hue, chroma) - // and the last 5 contain the variation in L - int nHive = 18; //22; // 18; - int MatHive = 25;// 30; //25; - - MatrixXd RGBHive(MatHive, 3); - VectorXd RGBHive1(3); - VectorXd VolumeHive1(m_nVolumes); - MatrixXd VolumeHive(MatHive, m_nVolumes); - int *GamutRegionV = new int[MatHive]; - //int *GamutRegionV = DBG_NEW int[MatHive]; - for (int i = 0; i < MatHive; ++i) - GamutRegionV[i] = -1; - - int indDataMax[2]; - int j = 0; - // Matrix values are initially set to -1; - RGBHive.setConstant(NegValue); - VolumeHive.setConstant(NegValue); - - ProcessHiveNeighbors(LabOut, RGBOut, Volume, GamutRegion, RGBHive, VolumeHive, nHive, GamutRegionV, indDataMax); - OutputCoordinates** hiveData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * MatHive); - conversionOutput->hivecoordinates = hiveData; - conversionOutput->n_hivecoordinates = MatHive; - conversionOutput->n_triplecoordinates = 3; - for (int i = 0; i < MatHive; i++) - { - // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; - hiveData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); - output_coordinates__init(hiveData[i]); - if (RGBHive(i, 0) != NegValue) - { - for (j = 0; j < 3; ++j) - RGBHive1(j) = RGBHive(i, j); - fillRGB(hiveData[i], RGBHive1); - for (j = 0; j < m_nVolumes; ++j) - VolumeHive1(j) = VolumeHive(i, j); - fillVolume(hiveData[i], VolumeHive1); - hiveData[i]->has_processparameterstableindex = true; - hiveData[i]->processparameterstableindex = GamutRegionV[i]; - hiveData[i]->n_outputliquids = m_nInks; - } - conversionOutput->hivecoordinates[i] = hiveData[i]; - } - - - //Triplet - OutputCoordinates** TripletData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * 3); - conversionOutput->triplecoordinates = TripletData; - int tripletIndex[3] = { indDataMax[0] , (int)(12), indDataMax[1] }; - for (int i = 0; i < 3; ++i) - { - // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; - TripletData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); - output_coordinates__init(TripletData[i]); - for (j = 0; j < 3; ++j) - RGBHive1(j) = RGBHive(tripletIndex[i], j); - fillRGB(TripletData[i], RGBHive1); - for (j = 0; j < m_nVolumes; ++j) - VolumeHive1(j) = VolumeHive(tripletIndex[i], j); - fillVolume(TripletData[i], VolumeHive1); - TripletData[i]->has_processparameterstableindex = true; - TripletData[i]->processparameterstableindex = GamutRegionV[tripletIndex[i]]; - TripletData[i]->n_outputliquids = m_nInks; - conversionOutput->triplecoordinates[i] = TripletData[i]; - } - - //Clean up - if (GamutRegionV != NULL) - { - delete[] GamutRegionV; - GamutRegionV = NULL; - } - } + ConversionOutput* conversionOutput = ConvertInternal(conversionInput); //Pack output... output_buffer = (uint8_t*)malloc(conversion_output__get_packed_size(conversionOutput)); @@ -1580,7 +1386,6 @@ bool Tango::ColorLib::ColorConverter::IsInGamut(double *InLab, SURROUND sur) return(InGamut); } - Tango::CT_Header Tango::ColorLib::ColorConverter::read_header(ConversionInput* conversionInput, int &bytesread) { //CT_Header *Header = new CT_Header; @@ -1771,7 +1576,6 @@ void Tango::ColorLib::ColorConverter::read_text_type(int offset, int data_size, return; } - void Tango::ColorLib::ColorConverter::read_text_description_type(int offset, int data_size, std::string textdescstr, ConversionInput* conversionInput) { @@ -1983,8 +1787,6 @@ void Tango::ColorLib::ColorConverter::CompareWhitePoints() // return conversion_output__pack(&conversionOutput, output_buffer); //} - - size_t Tango::ColorLib::ColorConverter::P_IsInGamut(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer) { @@ -2204,4 +2006,324 @@ size_t Tango::ColorLib::ColorConverter::P_IsInGamut(uint8_t * input_buffer, size #pragma endregion return (size); +} + +ConversionOutput* Tango::ColorLib::ColorConverter::ConvertInternal(ConversionInput* conversionInput) +{ + InputLiquid** original_input_liquids = NULL; + int original_input_liquids_count = 0; + + //Filter and arrange colors (Should change from 3 to 4 if black ink is included) + + int numofInks = CountNumberofInks(conversionInput); + if (numofInks < 0) + throw std::exception("Duplicate inks"); + int expected_liquids = numofInks; + original_input_liquids_count = conversionInput->inputcoordinates->n_inputliquids; + original_input_liquids = conversionInput->inputcoordinates->inputliquids; + + InputLiquid** filteredInputLiquids = (InputLiquid**)malloc(sizeof(InputLiquid*) * expected_liquids); + + for (size_t i = 0; i < conversionInput->inputcoordinates->n_inputliquids; i++) + { + InputLiquid* liquid = conversionInput->inputcoordinates->inputliquids[i]; + + switch (liquid->liquidtype) + { + case LIQUID_TYPE__Cyan: + filteredInputLiquids[0] = liquid; + break; + case LIQUID_TYPE__Magenta: + filteredInputLiquids[1] = liquid; + break; + case LIQUID_TYPE__Yellow: + filteredInputLiquids[2] = liquid; + break; + case LIQUID_TYPE__Black: + filteredInputLiquids[3] = liquid; + break; + } + } + + conversionInput->inputcoordinates->inputliquids = filteredInputLiquids; + conversionInput->inputcoordinates->n_inputliquids = expected_liquids; + //Filter and arrange colors + + + + //Initialize Output... + ConversionOutput *conversionOutput = (ConversionOutput*)malloc(sizeof(ConversionOutput)); + conversion_output__init(conversionOutput); + // ConversionOutput conversionOutput = CONVERSION_OUTPUT__INIT; + + + size_t n_elements = 0; + bool InGamut = false; + m_WP.Set(0.9505, 1.00, 1.0888); //D65 + //count number if inks +// int numofInks = CountNumberofInks(conversionInput); + readColorTransformations(conversionInput); + + //read calibration tables and store them in m_CalibCurves + + readCalibrationTables(conversionInput); + m_LinInterp = new Interp[numofInks]; + //m_LinInterp = DBG_NEW Interp[numofInks]; + m_InvLinInterp = new Interp[numofInks]; + //m_InvLinInterp = DBG_NEW Interp[numofInks]; + InitInterpolations(numofInks, m_LinInterp, m_InvLinInterp); + + //Initialize CIECAM02 transformation + Illum IL = D65; + SURROUND sur = average; + CAM02CS CS = UCS; + m_Conv02 = new ColorConvert(IL, IL, Y_b, L_A, sur, CS); + //m_Conv02 = DBG_NEW ColorConvert(IL, IL, Y_b, L_A, sur, CS); + SetnA2BnSepIn(m_A2BTransform->GetSeparationsIn()); + SetnA2BnSepOut(m_A2BTransform->GetSeparationsOut()); + SetnB2AnSepIn(m_B2ATransform->GetSeparationsIn()); + SetnB2AnSepOut(m_B2ATransform->GetSeparationsOut()); + + SetNumberOfInks(m_nB2AnSepOut); + // Compare Strip White point to Color Table White Point + CompareWhitePoints(); + + if (numofInks != m_nB2AnSepOut) + throw std::exception("Number of available inks does not match ink tables"); + + VectorXd InkOut(m_nB2AnSepOut); + VectorXd RGBOut(3); + VectorXd LabOut(3); + VectorXd NLInkOut(m_nB2AnSepOut); + VectorXd Volume(m_nB2AnSepOut); + //set maxNlPerCM + VectorXd NlperCM(m_nB2AnSepOut); + NlperCM.setZero(); + m_maxNlPerCM = NlperCM; + for (int i = 0; i < m_nB2AnSepOut; ++i) + SetMaxNLperCM(conversionInput->inputcoordinates->inputliquids[i]->maxnanoliterpercentimeter, i); + m_nVolumes = m_nB2AnSepOut; + int GamutRegion = 0; + //Convert input data to linear inks + if (conversionInput->colorspace == COLOR_SPACE__Volume) + { + ConvertVolumeToRGBDisplay(conversionInput, Volume, RGBOut, LabOut, GamutRegion); + InGamut = true; + } + else + { + ConvertColorToLinearInks(conversionInput, InkOut, RGBOut, LabOut, GamutRegion, InGamut); + //Convert to Nonlinear Inks + ConvertToNLInks(InkOut, NLInkOut); + //Convert to [nl/cm] + NLInkPToVolume(NLInkOut, Volume); + //OutputCoordinates outputCoords = OUTPUT_COORDINATES__INIT; + } + OutputCoordinates *outputCoords = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); + output_coordinates__init(outputCoords); + fillRGB(outputCoords, RGBOut); + fillVolume(outputCoords, Volume); + conversionOutput->has_outofgamut = true; + conversionOutput->outofgamut = !(InGamut); + conversionOutput->singlecoordinates = outputCoords; + + + if (!conversionInput->singlemode) //Skip if input requests single result only. + { + //input was processed. + //process neighboring values + //nhive includes 2 outer neighbors of the central Lab value, chroma + delta, chroma + 2delta + // and variation in L positioned on the side of the beehive. + //The set is arrange in a 5x6 matrix, where the 5x5 contains the variation in (Hue, chroma) + // and the last 5 contain the variation in L + int nHive = 18; //22; // 18; + int MatHive = 25;// 30; //25; + + MatrixXd RGBHive(MatHive, 3); + VectorXd RGBHive1(3); + VectorXd VolumeHive1(m_nVolumes); + MatrixXd VolumeHive(MatHive, m_nVolumes); + int *GamutRegionV = new int[MatHive]; + //int *GamutRegionV = DBG_NEW int[MatHive]; + for (int i = 0; i < MatHive; ++i) + GamutRegionV[i] = -1; + + int indDataMax[2]; + int j = 0; + // Matrix values are initially set to -1; + RGBHive.setConstant(NegValue); + VolumeHive.setConstant(NegValue); + + ProcessHiveNeighbors(LabOut, RGBOut, Volume, GamutRegion, RGBHive, VolumeHive, nHive, GamutRegionV, indDataMax); + OutputCoordinates** hiveData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * MatHive); + conversionOutput->hivecoordinates = hiveData; + conversionOutput->n_hivecoordinates = MatHive; + conversionOutput->n_triplecoordinates = 3; + for (int i = 0; i < MatHive; i++) + { + // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; + hiveData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); + output_coordinates__init(hiveData[i]); + if (RGBHive(i, 0) != NegValue) + { + for (j = 0; j < 3; ++j) + RGBHive1(j) = RGBHive(i, j); + fillRGB(hiveData[i], RGBHive1); + for (j = 0; j < m_nVolumes; ++j) + VolumeHive1(j) = VolumeHive(i, j); + fillVolume(hiveData[i], VolumeHive1); + hiveData[i]->has_processparameterstableindex = true; + hiveData[i]->processparameterstableindex = GamutRegionV[i]; + hiveData[i]->n_outputliquids = m_nInks; + } + conversionOutput->hivecoordinates[i] = hiveData[i]; + } + + + //Triplet + OutputCoordinates** TripletData = (OutputCoordinates**)malloc(sizeof(OutputCoordinates*) * 3); + conversionOutput->triplecoordinates = TripletData; + int tripletIndex[3] = { indDataMax[0] , (int)(12), indDataMax[1] }; + for (int i = 0; i < 3; ++i) + { + // OutputCoordinates SingleCell = OUTPUT_COORDINATES__INIT; + TripletData[i] = (OutputCoordinates*)malloc(sizeof(OutputCoordinates)); + output_coordinates__init(TripletData[i]); + for (j = 0; j < 3; ++j) + RGBHive1(j) = RGBHive(tripletIndex[i], j); + fillRGB(TripletData[i], RGBHive1); + for (j = 0; j < m_nVolumes; ++j) + VolumeHive1(j) = VolumeHive(tripletIndex[i], j); + fillVolume(TripletData[i], VolumeHive1); + TripletData[i]->has_processparameterstableindex = true; + TripletData[i]->processparameterstableindex = GamutRegionV[tripletIndex[i]]; + TripletData[i]->n_outputliquids = m_nInks; + conversionOutput->triplecoordinates[i] = TripletData[i]; + } + + //Clean up + if (GamutRegionV != NULL) + { + delete[] GamutRegionV; + GamutRegionV = NULL; + } + } + + return conversionOutput; +} + +size_t Tango::ColorLib::ColorConverter::ConvertGradient(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer) +{ + GradientConversionInput* conversionInput = NULL; + + try + { + //Get Input + conversionInput = (GradientConversionInput*)malloc(sizeof(GradientConversionInput)); + conversionInput = gradient_conversion_input__unpack(NULL, input_buffer_size, input_buffer); + + //Init Output + GradientConversionOutput *conversionOutput = (GradientConversionOutput*)malloc(sizeof(GradientConversionOutput)); + gradient_conversion_output__init(conversionOutput); + + //Init reusable conversion input. + ConversionInput* input = (ConversionInput*)malloc(sizeof(ConversionInput)); + conversion_input__init(input); + + input->colorspace = COLOR_SPACE__RGB; + input->deltachroma = conversionInput->deltachroma; + input->deltal = conversionInput->deltal; + input->forwarddata = conversionInput->forwarddata; + input->processranges = conversionInput->processranges; + input->segmentlength = conversionInput->segmentlength; + input->singlemode = true; + input->threadl = conversionInput->threadl; + input->threada = conversionInput->threada; + input->threadb = conversionInput->threadb; + + input->has_colorspace = true; + input->has_deltachroma = true; + input->has_deltal = true; + input->has_segmentlength = true; + input->has_forwarddata = true; + input->has_singlemode = true; + input->has_threadl = true; + input->has_threada = true; + input->has_threadb = true; + + //Init reusable input coordinates. + InputCoordinates* inputCoords = (InputCoordinates*)malloc(sizeof(InputCoordinates)); + input_coordinates__init(inputCoords); + + inputCoords->inputliquids = conversionInput->inputliquids; + inputCoords->n_inputliquids = conversionInput->n_inputliquids; + + inputCoords->has_red = true; + inputCoords->has_green = true; + inputCoords->has_blue = true; + + input->inputcoordinates = inputCoords; + + OutputCoordinates** outputCoordinatesList = (OutputCoordinates**)malloc(conversionInput->n_colors * sizeof(OutputCoordinates*));; + + for (size_t i = 0; i < conversionInput->n_colors; i++) + { + inputCoords->red = conversionInput->colors[i]->red; + inputCoords->green = conversionInput->colors[i]->green; + inputCoords->blue = conversionInput->colors[i]->blue; + + ConversionOutput* output = ConvertInternal(input); + outputCoordinatesList[i] = output->singlecoordinates; + } + + conversionOutput->coordinates = outputCoordinatesList; + conversionOutput->n_coordinates = conversionInput->n_colors; + + //Pack output... + output_buffer = (uint8_t*)malloc(gradient_conversion_output__get_packed_size(conversionOutput)); + int size = gradient_conversion_output__pack(conversionOutput, output_buffer); + + free(input->forwarddata.data); + + for (size_t i = 0; i < conversionInput->n_colors; i++) + { + for (size_t j = 0; j < outputCoordinatesList[i]->n_outputliquids; j++) + { + free(outputCoordinatesList[i]->outputliquids[j]); + } + + free(outputCoordinatesList[i]); + } + + free(outputCoordinatesList); + + gradient_conversion_input__free_unpacked(conversionInput, NULL); + + return (size); + } + catch (const std::exception& e) + { + //Notify Error... + GradientConversionOutput *conversionOutput = (GradientConversionOutput*)malloc(sizeof(GradientConversionOutput)); + gradient_conversion_output__init(conversionOutput); + + conversionOutput->has_haserror = true; + conversionOutput->haserror = true; + + const char* what = e.what(); + + conversionOutput->errormessage = (char*)malloc(strlen(what)); + strcpy(conversionOutput->errormessage, e.what()); + + output_buffer = (uint8_t*)malloc(gradient_conversion_output__get_packed_size(conversionOutput)); + int size = gradient_conversion_output__pack(conversionOutput, output_buffer); + +#pragma region Free Output + + gradient_conversion_input__free_unpacked(conversionInput, NULL); + +#pragma endregion + + return (size); + } }
\ No newline at end of file diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.h b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.h index 74d804913..8976119ad 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.h +++ b/Software/Visual_Studio/Native/Tango.ColorLib/ColorConverter.h @@ -57,6 +57,8 @@ namespace Tango void ConvertVolumeToRGBDisplay(ConversionInput* conversionInput, VectorXd &InkOut, VectorXd &RGBOut, VectorXd &LabOut, int &GamutRegion); size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); + size_t Tango::ColorLib::ColorConverter::ConvertGradient(uint8_t * input_buffer, size_t input_buffer_size, uint8_t *& output_buffer); + ConversionOutput* Tango::ColorLib::ColorConverter::ConvertInternal(ConversionInput* conversionInput); void ConvertToNLInks(VectorXd InkIn, VectorXd &InkOut); void ConvertToLinearInks(VectorXd InkIn, VectorXd &InkOut); void VolumeToNLInkP(VectorXd Volume, VectorXd &NLInkP); diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Exports.cpp b/Software/Visual_Studio/Native/Tango.ColorLib/Exports.cpp index ac317461a..9a9a18b38 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Exports.cpp +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Exports.cpp @@ -15,3 +15,9 @@ extern "C" EXPORT_API size_t __cdecl Convert(uint8_t* input_buffer, size_t input return converter.Convert(input_buffer, input_buffer_size, output_buffer); } +extern "C" EXPORT_API size_t __cdecl ConvertGradient(uint8_t* input_buffer, size_t input_buffer_size, uint8_t*& output_buffer) +{ + ColorConverter converter; + return converter.ConvertGradient(input_buffer, input_buffer_size, output_buffer); +} + diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.c new file mode 100644 index 000000000..4de650d37 --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.c @@ -0,0 +1,209 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: GradientConversionInput.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "GradientConversionInput.pb-c.h" +void gradient_conversion_input__init + (GradientConversionInput *message) +{ + static const GradientConversionInput init_value = GRADIENT_CONVERSION_INPUT__INIT; + *message = init_value; +} +size_t gradient_conversion_input__get_packed_size + (const GradientConversionInput *message) +{ + assert(message->base.descriptor == &gradient_conversion_input__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t gradient_conversion_input__pack + (const GradientConversionInput *message, + uint8_t *out) +{ + assert(message->base.descriptor == &gradient_conversion_input__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t gradient_conversion_input__pack_to_buffer + (const GradientConversionInput *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &gradient_conversion_input__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +GradientConversionInput * + gradient_conversion_input__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (GradientConversionInput *) + protobuf_c_message_unpack (&gradient_conversion_input__descriptor, + allocator, len, data); +} +void gradient_conversion_input__free_unpacked + (GradientConversionInput *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &gradient_conversion_input__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor gradient_conversion_input__field_descriptors[10] = +{ + { + "ThreadL", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_threadl), + offsetof(GradientConversionInput, threadl), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ThreadA", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_threada), + offsetof(GradientConversionInput, threada), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ThreadB", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_threadb), + offsetof(GradientConversionInput, threadb), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ForwardData", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + offsetof(GradientConversionInput, has_forwarddata), + offsetof(GradientConversionInput, forwarddata), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "SegmentLength", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_segmentlength), + offsetof(GradientConversionInput, segmentlength), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "DeltaChroma", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_deltachroma), + offsetof(GradientConversionInput, deltachroma), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "DeltaL", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(GradientConversionInput, has_deltal), + offsetof(GradientConversionInput, deltal), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Colors", + 8, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(GradientConversionInput, n_colors), + offsetof(GradientConversionInput, colors), + &input_rgb__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "InputLiquids", + 9, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(GradientConversionInput, n_inputliquids), + offsetof(GradientConversionInput, inputliquids), + &input_liquid__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ProcessRanges", + 10, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(GradientConversionInput, n_processranges), + offsetof(GradientConversionInput, processranges), + &process_range__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned gradient_conversion_input__field_indices_by_name[] = { + 7, /* field[7] = Colors */ + 5, /* field[5] = DeltaChroma */ + 6, /* field[6] = DeltaL */ + 3, /* field[3] = ForwardData */ + 8, /* field[8] = InputLiquids */ + 9, /* field[9] = ProcessRanges */ + 4, /* field[4] = SegmentLength */ + 1, /* field[1] = ThreadA */ + 2, /* field[2] = ThreadB */ + 0, /* field[0] = ThreadL */ +}; +static const ProtobufCIntRange gradient_conversion_input__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 10 } +}; +const ProtobufCMessageDescriptor gradient_conversion_input__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "GradientConversionInput", + "GradientConversionInput", + "GradientConversionInput", + "", + sizeof(GradientConversionInput), + 10, + gradient_conversion_input__field_descriptors, + gradient_conversion_input__field_indices_by_name, + 1, gradient_conversion_input__number_ranges, + (ProtobufCMessageInit) gradient_conversion_input__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.h new file mode 100644 index 000000000..1de2b2aec --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionInput.pb-c.h @@ -0,0 +1,93 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: GradientConversionInput.proto */ + +#ifndef PROTOBUF_C_GradientConversionInput_2eproto__INCLUDED +#define PROTOBUF_C_GradientConversionInput_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "ProcessRange.pb-c.h" +#include "InputLiquid.pb-c.h" +#include "InputRGB.pb-c.h" + +typedef struct _GradientConversionInput GradientConversionInput; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _GradientConversionInput +{ + ProtobufCMessage base; + protobuf_c_boolean has_threadl; + double threadl; + protobuf_c_boolean has_threada; + double threada; + protobuf_c_boolean has_threadb; + double threadb; + protobuf_c_boolean has_forwarddata; + ProtobufCBinaryData forwarddata; + protobuf_c_boolean has_segmentlength; + double segmentlength; + protobuf_c_boolean has_deltachroma; + double deltachroma; + protobuf_c_boolean has_deltal; + double deltal; + size_t n_colors; + InputRGB **colors; + size_t n_inputliquids; + InputLiquid **inputliquids; + size_t n_processranges; + ProcessRange **processranges; +}; +#define GRADIENT_CONVERSION_INPUT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&gradient_conversion_input__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, {0,NULL}, 0, 0, 0, 0, 0, 0, 0,NULL, 0,NULL, 0,NULL } + + +/* GradientConversionInput methods */ +void gradient_conversion_input__init + (GradientConversionInput *message); +size_t gradient_conversion_input__get_packed_size + (const GradientConversionInput *message); +size_t gradient_conversion_input__pack + (const GradientConversionInput *message, + uint8_t *out); +size_t gradient_conversion_input__pack_to_buffer + (const GradientConversionInput *message, + ProtobufCBuffer *buffer); +GradientConversionInput * + gradient_conversion_input__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void gradient_conversion_input__free_unpacked + (GradientConversionInput *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*GradientConversionInput_Closure) + (const GradientConversionInput *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor gradient_conversion_input__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_GradientConversionInput_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.c new file mode 100644 index 000000000..cd5f260ef --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.c @@ -0,0 +1,118 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: GradientConversionOutput.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "GradientConversionOutput.pb-c.h" +void gradient_conversion_output__init + (GradientConversionOutput *message) +{ + static const GradientConversionOutput init_value = GRADIENT_CONVERSION_OUTPUT__INIT; + *message = init_value; +} +size_t gradient_conversion_output__get_packed_size + (const GradientConversionOutput *message) +{ + assert(message->base.descriptor == &gradient_conversion_output__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t gradient_conversion_output__pack + (const GradientConversionOutput *message, + uint8_t *out) +{ + assert(message->base.descriptor == &gradient_conversion_output__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t gradient_conversion_output__pack_to_buffer + (const GradientConversionOutput *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &gradient_conversion_output__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +GradientConversionOutput * + gradient_conversion_output__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (GradientConversionOutput *) + protobuf_c_message_unpack (&gradient_conversion_output__descriptor, + allocator, len, data); +} +void gradient_conversion_output__free_unpacked + (GradientConversionOutput *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &gradient_conversion_output__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor gradient_conversion_output__field_descriptors[3] = +{ + { + "Coordinates", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(GradientConversionOutput, n_coordinates), + offsetof(GradientConversionOutput, coordinates), + &output_coordinates__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "HasError", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(GradientConversionOutput, has_haserror), + offsetof(GradientConversionOutput, haserror), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ErrorMessage", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(GradientConversionOutput, errormessage), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned gradient_conversion_output__field_indices_by_name[] = { + 0, /* field[0] = Coordinates */ + 2, /* field[2] = ErrorMessage */ + 1, /* field[1] = HasError */ +}; +static const ProtobufCIntRange gradient_conversion_output__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor gradient_conversion_output__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "GradientConversionOutput", + "GradientConversionOutput", + "GradientConversionOutput", + "", + sizeof(GradientConversionOutput), + 3, + gradient_conversion_output__field_descriptors, + gradient_conversion_output__field_indices_by_name, + 1, gradient_conversion_output__number_ranges, + (ProtobufCMessageInit) gradient_conversion_output__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.h new file mode 100644 index 000000000..f3471b0f1 --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/GradientConversionOutput.pb-c.h @@ -0,0 +1,76 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: GradientConversionOutput.proto */ + +#ifndef PROTOBUF_C_GradientConversionOutput_2eproto__INCLUDED +#define PROTOBUF_C_GradientConversionOutput_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "OutputCoordinates.pb-c.h" + +typedef struct _GradientConversionOutput GradientConversionOutput; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _GradientConversionOutput +{ + ProtobufCMessage base; + size_t n_coordinates; + OutputCoordinates **coordinates; + protobuf_c_boolean has_haserror; + protobuf_c_boolean haserror; + char *errormessage; +}; +#define GRADIENT_CONVERSION_OUTPUT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&gradient_conversion_output__descriptor) \ + , 0,NULL, 0, 0, NULL } + + +/* GradientConversionOutput methods */ +void gradient_conversion_output__init + (GradientConversionOutput *message); +size_t gradient_conversion_output__get_packed_size + (const GradientConversionOutput *message); +size_t gradient_conversion_output__pack + (const GradientConversionOutput *message, + uint8_t *out); +size_t gradient_conversion_output__pack_to_buffer + (const GradientConversionOutput *message, + ProtobufCBuffer *buffer); +GradientConversionOutput * + gradient_conversion_output__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void gradient_conversion_output__free_unpacked + (GradientConversionOutput *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*GradientConversionOutput_Closure) + (const GradientConversionOutput *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor gradient_conversion_output__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_GradientConversionOutput_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.c b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.c new file mode 100644 index 000000000..42df1977b --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.c @@ -0,0 +1,118 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: InputRGB.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "InputRGB.pb-c.h" +void input_rgb__init + (InputRGB *message) +{ + static const InputRGB init_value = INPUT_RGB__INIT; + *message = init_value; +} +size_t input_rgb__get_packed_size + (const InputRGB *message) +{ + assert(message->base.descriptor == &input_rgb__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t input_rgb__pack + (const InputRGB *message, + uint8_t *out) +{ + assert(message->base.descriptor == &input_rgb__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t input_rgb__pack_to_buffer + (const InputRGB *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &input_rgb__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +InputRGB * + input_rgb__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (InputRGB *) + protobuf_c_message_unpack (&input_rgb__descriptor, + allocator, len, data); +} +void input_rgb__free_unpacked + (InputRGB *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &input_rgb__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor input_rgb__field_descriptors[3] = +{ + { + "Red", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(InputRGB, has_red), + offsetof(InputRGB, red), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Green", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(InputRGB, has_green), + offsetof(InputRGB, green), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Blue", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(InputRGB, has_blue), + offsetof(InputRGB, blue), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned input_rgb__field_indices_by_name[] = { + 2, /* field[2] = Blue */ + 1, /* field[1] = Green */ + 0, /* field[0] = Red */ +}; +static const ProtobufCIntRange input_rgb__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor input_rgb__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "InputRGB", + "InputRGB", + "InputRGB", + "", + sizeof(InputRGB), + 3, + input_rgb__field_descriptors, + input_rgb__field_indices_by_name, + 1, input_rgb__number_ranges, + (ProtobufCMessageInit) input_rgb__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.h b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.h new file mode 100644 index 000000000..841071716 --- /dev/null +++ b/Software/Visual_Studio/Native/Tango.ColorLib/PMR/ColorLab/InputRGB.pb-c.h @@ -0,0 +1,76 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: InputRGB.proto */ + +#ifndef PROTOBUF_C_InputRGB_2eproto__INCLUDED +#define PROTOBUF_C_InputRGB_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _InputRGB InputRGB; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _InputRGB +{ + ProtobufCMessage base; + protobuf_c_boolean has_red; + int32_t red; + protobuf_c_boolean has_green; + int32_t green; + protobuf_c_boolean has_blue; + int32_t blue; +}; +#define INPUT_RGB__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&input_rgb__descriptor) \ + , 0, 0, 0, 0, 0, 0 } + + +/* InputRGB methods */ +void input_rgb__init + (InputRGB *message); +size_t input_rgb__get_packed_size + (const InputRGB *message); +size_t input_rgb__pack + (const InputRGB *message, + uint8_t *out); +size_t input_rgb__pack_to_buffer + (const InputRGB *message, + ProtobufCBuffer *buffer); +InputRGB * + input_rgb__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void input_rgb__free_unpacked + (InputRGB *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*InputRGB_Closure) + (const InputRGB *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor input_rgb__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_InputRGB_2eproto__INCLUDED */ diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj index 65bfc667b..224588ad3 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj @@ -167,8 +167,11 @@ <ClInclude Include="PMR\ColorLab\ColorSpace.pb-c.h" /> <ClInclude Include="PMR\ColorLab\ConversionInput.pb-c.h" /> <ClInclude Include="PMR\ColorLab\ConversionOutput.pb-c.h" /> + <ClInclude Include="PMR\ColorLab\GradientConversionInput.pb-c.h" /> + <ClInclude Include="PMR\ColorLab\GradientConversionOutput.pb-c.h" /> <ClInclude Include="PMR\ColorLab\InputCoordinates.pb-c.h" /> <ClInclude Include="PMR\ColorLab\InputLiquid.pb-c.h" /> + <ClInclude Include="PMR\ColorLab\InputRGB.pb-c.h" /> <ClInclude Include="PMR\ColorLab\LiquidType.pb-c.h" /> <ClInclude Include="PMR\ColorLab\OutputCoordinates.pb-c.h" /> <ClInclude Include="PMR\ColorLab\OutputLiquid.pb-c.h" /> @@ -194,8 +197,11 @@ <ClCompile Include="PMR\ColorLab\ColorSpace.pb-c.c" /> <ClCompile Include="PMR\ColorLab\ConversionInput.pb-c.c" /> <ClCompile Include="PMR\ColorLab\ConversionOutput.pb-c.c" /> + <ClCompile Include="PMR\ColorLab\GradientConversionInput.pb-c.c" /> + <ClCompile Include="PMR\ColorLab\GradientConversionOutput.pb-c.c" /> <ClCompile Include="PMR\ColorLab\InputCoordinates.pb-c.c" /> <ClCompile Include="PMR\ColorLab\InputLiquid.pb-c.c" /> + <ClCompile Include="PMR\ColorLab\InputRGB.pb-c.c" /> <ClCompile Include="PMR\ColorLab\LiquidType.pb-c.c" /> <ClCompile Include="PMR\ColorLab\OutputCoordinates.pb-c.c" /> <ClCompile Include="PMR\ColorLab\OutputLiquid.pb-c.c" /> diff --git a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters index b929da503..5277161da 100644 --- a/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters +++ b/Software/Visual_Studio/Native/Tango.ColorLib/Tango.ColorLib.vcxproj.filters @@ -102,6 +102,15 @@ <ClInclude Include="PMR\ColorLab\ProcessRange.pb-c.h"> <Filter>PMR</Filter> </ClInclude> + <ClInclude Include="PMR\ColorLab\GradientConversionOutput.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> + <ClInclude Include="PMR\ColorLab\InputRGB.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> + <ClInclude Include="PMR\ColorLab\GradientConversionInput.pb-c.h"> + <Filter>PMR</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="Exports.cpp"> @@ -170,5 +179,14 @@ <ClCompile Include="PMR\ColorLab\ProcessRange.pb-c.c"> <Filter>PMR</Filter> </ClCompile> + <ClCompile Include="PMR\ColorLab\GradientConversionOutput.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> + <ClCompile Include="PMR\ColorLab\InputRGB.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> + <ClCompile Include="PMR\ColorLab\GradientConversionInput.pb-c.c"> + <Filter>PMR</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs index 37a246f10..32b743a88 100644 --- a/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs +++ b/Software/Visual_Studio/Tango.BL/ColorConversion/TangoColorConverter.cs @@ -329,7 +329,6 @@ namespace Tango.BL.ColorConversion double offset = (double)cm / segment.Length; var color = GetRelativeColor(segment.BrushStops.ToList(), offset); - var output = GetSuggestions(segment.Job, color); BrushStop s = new BrushStop(); s.Segment = segment; @@ -343,11 +342,44 @@ namespace Tango.BL.ColorConversion s.Blue = color.B; s.StopIndex = stopIndex++; - ApplyBrushStopCorrection(s, processTable, output); - stops.Add(s); } + var input = CreateConversionInput(stops.First()); + + GradientConversionInput conversionInput = new GradientConversionInput(); + conversionInput.Colors.AddRange(stops.Select(x => new InputRGB() { Red = x.Red, Green = x.Green, Blue = x.Blue })); + conversionInput.DeltaChroma = input.DeltaChroma; + conversionInput.DeltaL = input.DeltaL; + conversionInput.ForwardData = input.ForwardData; + conversionInput.InputLiquids.AddRange(input.InputCoordinates.InputLiquids); + conversionInput.ProcessRanges.AddRange(input.ProcessRanges); + conversionInput.SegmentLength = input.SegmentLength; + conversionInput.ThreadL = input.ThreadL; + conversionInput.ThreadA = input.ThreadA; + conversionInput.ThreadB = input.ThreadB; + + + IntPtr pDll = NativeMethods.LoadLibrary(@"Tango.ColorLib.dll"); + IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "ConvertGradient"); + NativeMethodDelegate convert = (NativeMethodDelegate)Marshal.GetDelegateForFunctionPointer( + pAddressOfFunctionToCall, + typeof(NativeMethodDelegate)); + NativePMR<GradientConversionInput, GradientConversionOutput> nativePMR = new NativePMR<GradientConversionInput, GradientConversionOutput>(convert); + GradientConversionOutput output = nativePMR.Invoke(conversionInput); + + bool result = NativeMethods.FreeLibrary(pDll); + + for (int i = 0; i < output.Coordinates.Count; i++) + { + var coords = output.Coordinates[i]; + var stop = stops[i]; + + ConversionOutput o = new ConversionOutput(); + o.SingleCoordinates = coords; + ApplyBrushStopCorrection(stop, processTable, o); + } + return stops; } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs index 45d31d9be..d4cc9ce21 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs @@ -41,7 +41,7 @@ namespace Tango.Integration.Operation /// </summary> public DefaultGradientGenerationConfiguration() { - ResolutionCM = 50; + ResolutionCM = 500; } /// <summary> @@ -54,6 +54,8 @@ namespace Tango.Integration.Operation /// <returns></returns> public List<BrushStop> Generate(Segment segment, Job job, ProcessParametersTable processParameters, Action<PreparingJobProgressEventArgs> progress = null) { + //var stops = TangoColorConverter.CreateSegmentLinearGradient(segment, processParameters, ResolutionCM); + List<BrushStop> stops = new List<BrushStop>(); var previousSegmentsLength = segment.GetPreviousSegments().Sum(x => x.Length); diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 9dab6cd65..e1b23cf9a 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -631,6 +631,11 @@ namespace Tango.Integration.Operation else { _last_embedded_debug_log.Repeated++; + + if (LogEmbeddedDebuggingToFile && EmbeddedLogManager != null) + { + EmbeddedLogManager.Log(new EmbeddedLogItem(data)); + } } } diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionInput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionInput.cs new file mode 100644 index 000000000..d267a6f0c --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionInput.cs @@ -0,0 +1,395 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GradientConversionInput.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ColorLab { + + /// <summary>Holder for reflection information generated from GradientConversionInput.proto</summary> + public static partial class GradientConversionInputReflection { + + #region Descriptor + /// <summary>File descriptor for GradientConversionInput.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GradientConversionInputReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1HcmFkaWVudENvbnZlcnNpb25JbnB1dC5wcm90bxISVGFuZ28uUE1SLkNv", + "bG9yTGFiGhJQcm9jZXNzUmFuZ2UucHJvdG8aEUlucHV0TGlxdWlkLnByb3Rv", + "Gg5JbnB1dFJHQi5wcm90byK7AgoXR3JhZGllbnRDb252ZXJzaW9uSW5wdXQS", + "DwoHVGhyZWFkTBgBIAEoARIPCgdUaHJlYWRBGAIgASgBEg8KB1RocmVhZEIY", + "AyABKAESEwoLRm9yd2FyZERhdGEYBCABKAwSFQoNU2VnbWVudExlbmd0aBgF", + "IAEoARITCgtEZWx0YUNocm9tYRgGIAEoARIOCgZEZWx0YUwYByABKAESLAoG", + "Q29sb3JzGAggAygLMhwuVGFuZ28uUE1SLkNvbG9yTGFiLklucHV0UkdCEjUK", + "DElucHV0TGlxdWlkcxgJIAMoCzIfLlRhbmdvLlBNUi5Db2xvckxhYi5JbnB1", + "dExpcXVpZBI3Cg1Qcm9jZXNzUmFuZ2VzGAogAygLMiAuVGFuZ28uUE1SLkNv", + "bG9yTGFiLlByb2Nlc3NSYW5nZUIeChxjb20udHdpbmUudGFuZ28ucG1yLmNv", + "bG9ybGFiYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.ProcessRangeReflection.Descriptor, global::Tango.PMR.ColorLab.InputLiquidReflection.Descriptor, global::Tango.PMR.ColorLab.InputRGBReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.GradientConversionInput), global::Tango.PMR.ColorLab.GradientConversionInput.Parser, new[]{ "ThreadL", "ThreadA", "ThreadB", "ForwardData", "SegmentLength", "DeltaChroma", "DeltaL", "Colors", "InputLiquids", "ProcessRanges" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GradientConversionInput : pb::IMessage<GradientConversionInput> { + private static readonly pb::MessageParser<GradientConversionInput> _parser = new pb::MessageParser<GradientConversionInput>(() => new GradientConversionInput()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<GradientConversionInput> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ColorLab.GradientConversionInputReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionInput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionInput(GradientConversionInput other) : this() { + threadL_ = other.threadL_; + threadA_ = other.threadA_; + threadB_ = other.threadB_; + forwardData_ = other.forwardData_; + segmentLength_ = other.segmentLength_; + deltaChroma_ = other.deltaChroma_; + deltaL_ = other.deltaL_; + colors_ = other.colors_.Clone(); + inputLiquids_ = other.inputLiquids_.Clone(); + processRanges_ = other.processRanges_.Clone(); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionInput Clone() { + return new GradientConversionInput(this); + } + + /// <summary>Field number for the "ThreadL" field.</summary> + public const int ThreadLFieldNumber = 1; + private double threadL_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ThreadL { + get { return threadL_; } + set { + threadL_ = value; + } + } + + /// <summary>Field number for the "ThreadA" field.</summary> + public const int ThreadAFieldNumber = 2; + private double threadA_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ThreadA { + get { return threadA_; } + set { + threadA_ = value; + } + } + + /// <summary>Field number for the "ThreadB" field.</summary> + public const int ThreadBFieldNumber = 3; + private double threadB_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ThreadB { + get { return threadB_; } + set { + threadB_ = value; + } + } + + /// <summary>Field number for the "ForwardData" field.</summary> + public const int ForwardDataFieldNumber = 4; + private pb::ByteString forwardData_ = pb::ByteString.Empty; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pb::ByteString ForwardData { + get { return forwardData_; } + set { + forwardData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "SegmentLength" field.</summary> + public const int SegmentLengthFieldNumber = 5; + private double segmentLength_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double SegmentLength { + get { return segmentLength_; } + set { + segmentLength_ = value; + } + } + + /// <summary>Field number for the "DeltaChroma" field.</summary> + public const int DeltaChromaFieldNumber = 6; + private double deltaChroma_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double DeltaChroma { + get { return deltaChroma_; } + set { + deltaChroma_ = value; + } + } + + /// <summary>Field number for the "DeltaL" field.</summary> + public const int DeltaLFieldNumber = 7; + private double deltaL_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double DeltaL { + get { return deltaL_; } + set { + deltaL_ = value; + } + } + + /// <summary>Field number for the "Colors" field.</summary> + public const int ColorsFieldNumber = 8; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.InputRGB> _repeated_colors_codec + = pb::FieldCodec.ForMessage(66, global::Tango.PMR.ColorLab.InputRGB.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.InputRGB> colors_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.InputRGB>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.InputRGB> Colors { + get { return colors_; } + } + + /// <summary>Field number for the "InputLiquids" field.</summary> + public const int InputLiquidsFieldNumber = 9; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.InputLiquid> _repeated_inputLiquids_codec + = pb::FieldCodec.ForMessage(74, global::Tango.PMR.ColorLab.InputLiquid.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.InputLiquid> inputLiquids_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.InputLiquid>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.InputLiquid> InputLiquids { + get { return inputLiquids_; } + } + + /// <summary>Field number for the "ProcessRanges" field.</summary> + public const int ProcessRangesFieldNumber = 10; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.ProcessRange> _repeated_processRanges_codec + = pb::FieldCodec.ForMessage(82, global::Tango.PMR.ColorLab.ProcessRange.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.ProcessRange> processRanges_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.ProcessRange>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.ProcessRange> ProcessRanges { + get { return processRanges_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GradientConversionInput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GradientConversionInput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (ThreadL != other.ThreadL) return false; + if (ThreadA != other.ThreadA) return false; + if (ThreadB != other.ThreadB) return false; + if (ForwardData != other.ForwardData) return false; + if (SegmentLength != other.SegmentLength) return false; + if (DeltaChroma != other.DeltaChroma) return false; + if (DeltaL != other.DeltaL) return false; + if(!colors_.Equals(other.colors_)) return false; + if(!inputLiquids_.Equals(other.inputLiquids_)) return false; + if(!processRanges_.Equals(other.processRanges_)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (ThreadL != 0D) hash ^= ThreadL.GetHashCode(); + if (ThreadA != 0D) hash ^= ThreadA.GetHashCode(); + if (ThreadB != 0D) hash ^= ThreadB.GetHashCode(); + if (ForwardData.Length != 0) hash ^= ForwardData.GetHashCode(); + if (SegmentLength != 0D) hash ^= SegmentLength.GetHashCode(); + if (DeltaChroma != 0D) hash ^= DeltaChroma.GetHashCode(); + if (DeltaL != 0D) hash ^= DeltaL.GetHashCode(); + hash ^= colors_.GetHashCode(); + hash ^= inputLiquids_.GetHashCode(); + hash ^= processRanges_.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (ThreadL != 0D) { + output.WriteRawTag(9); + output.WriteDouble(ThreadL); + } + if (ThreadA != 0D) { + output.WriteRawTag(17); + output.WriteDouble(ThreadA); + } + if (ThreadB != 0D) { + output.WriteRawTag(25); + output.WriteDouble(ThreadB); + } + if (ForwardData.Length != 0) { + output.WriteRawTag(34); + output.WriteBytes(ForwardData); + } + if (SegmentLength != 0D) { + output.WriteRawTag(41); + output.WriteDouble(SegmentLength); + } + if (DeltaChroma != 0D) { + output.WriteRawTag(49); + output.WriteDouble(DeltaChroma); + } + if (DeltaL != 0D) { + output.WriteRawTag(57); + output.WriteDouble(DeltaL); + } + colors_.WriteTo(output, _repeated_colors_codec); + inputLiquids_.WriteTo(output, _repeated_inputLiquids_codec); + processRanges_.WriteTo(output, _repeated_processRanges_codec); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (ThreadL != 0D) { + size += 1 + 8; + } + if (ThreadA != 0D) { + size += 1 + 8; + } + if (ThreadB != 0D) { + size += 1 + 8; + } + if (ForwardData.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(ForwardData); + } + if (SegmentLength != 0D) { + size += 1 + 8; + } + if (DeltaChroma != 0D) { + size += 1 + 8; + } + if (DeltaL != 0D) { + size += 1 + 8; + } + size += colors_.CalculateSize(_repeated_colors_codec); + size += inputLiquids_.CalculateSize(_repeated_inputLiquids_codec); + size += processRanges_.CalculateSize(_repeated_processRanges_codec); + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GradientConversionInput other) { + if (other == null) { + return; + } + if (other.ThreadL != 0D) { + ThreadL = other.ThreadL; + } + if (other.ThreadA != 0D) { + ThreadA = other.ThreadA; + } + if (other.ThreadB != 0D) { + ThreadB = other.ThreadB; + } + if (other.ForwardData.Length != 0) { + ForwardData = other.ForwardData; + } + if (other.SegmentLength != 0D) { + SegmentLength = other.SegmentLength; + } + if (other.DeltaChroma != 0D) { + DeltaChroma = other.DeltaChroma; + } + if (other.DeltaL != 0D) { + DeltaL = other.DeltaL; + } + colors_.Add(other.colors_); + inputLiquids_.Add(other.inputLiquids_); + processRanges_.Add(other.processRanges_); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 9: { + ThreadL = input.ReadDouble(); + break; + } + case 17: { + ThreadA = input.ReadDouble(); + break; + } + case 25: { + ThreadB = input.ReadDouble(); + break; + } + case 34: { + ForwardData = input.ReadBytes(); + break; + } + case 41: { + SegmentLength = input.ReadDouble(); + break; + } + case 49: { + DeltaChroma = input.ReadDouble(); + break; + } + case 57: { + DeltaL = input.ReadDouble(); + break; + } + case 66: { + colors_.AddEntriesFrom(input, _repeated_colors_codec); + break; + } + case 74: { + inputLiquids_.AddEntriesFrom(input, _repeated_inputLiquids_codec); + break; + } + case 82: { + processRanges_.AddEntriesFrom(input, _repeated_processRanges_codec); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionOutput.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionOutput.cs new file mode 100644 index 000000000..9ea51bd43 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/GradientConversionOutput.cs @@ -0,0 +1,210 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: GradientConversionOutput.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ColorLab { + + /// <summary>Holder for reflection information generated from GradientConversionOutput.proto</summary> + public static partial class GradientConversionOutputReflection { + + #region Descriptor + /// <summary>File descriptor for GradientConversionOutput.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static GradientConversionOutputReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5HcmFkaWVudENvbnZlcnNpb25PdXRwdXQucHJvdG8SElRhbmdvLlBNUi5D", + "b2xvckxhYhoXT3V0cHV0Q29vcmRpbmF0ZXMucHJvdG8ifgoYR3JhZGllbnRD", + "b252ZXJzaW9uT3V0cHV0EjoKC0Nvb3JkaW5hdGVzGAEgAygLMiUuVGFuZ28u", + "UE1SLkNvbG9yTGFiLk91dHB1dENvb3JkaW5hdGVzEhAKCEhhc0Vycm9yGAIg", + "ASgIEhQKDEVycm9yTWVzc2FnZRgDIAEoCUIeChxjb20udHdpbmUudGFuZ28u", + "cG1yLmNvbG9ybGFiYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.ColorLab.OutputCoordinatesReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.GradientConversionOutput), global::Tango.PMR.ColorLab.GradientConversionOutput.Parser, new[]{ "Coordinates", "HasError", "ErrorMessage" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class GradientConversionOutput : pb::IMessage<GradientConversionOutput> { + private static readonly pb::MessageParser<GradientConversionOutput> _parser = new pb::MessageParser<GradientConversionOutput>(() => new GradientConversionOutput()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<GradientConversionOutput> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ColorLab.GradientConversionOutputReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionOutput() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionOutput(GradientConversionOutput other) : this() { + coordinates_ = other.coordinates_.Clone(); + hasError_ = other.hasError_; + errorMessage_ = other.errorMessage_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public GradientConversionOutput Clone() { + return new GradientConversionOutput(this); + } + + /// <summary>Field number for the "Coordinates" field.</summary> + public const int CoordinatesFieldNumber = 1; + private static readonly pb::FieldCodec<global::Tango.PMR.ColorLab.OutputCoordinates> _repeated_coordinates_codec + = pb::FieldCodec.ForMessage(10, global::Tango.PMR.ColorLab.OutputCoordinates.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.ColorLab.OutputCoordinates> coordinates_ = new pbc::RepeatedField<global::Tango.PMR.ColorLab.OutputCoordinates>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.ColorLab.OutputCoordinates> Coordinates { + get { return coordinates_; } + } + + /// <summary>Field number for the "HasError" field.</summary> + public const int HasErrorFieldNumber = 2; + private bool hasError_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool HasError { + get { return hasError_; } + set { + hasError_ = value; + } + } + + /// <summary>Field number for the "ErrorMessage" field.</summary> + public const int ErrorMessageFieldNumber = 3; + private string errorMessage_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string ErrorMessage { + get { return errorMessage_; } + set { + errorMessage_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as GradientConversionOutput); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(GradientConversionOutput other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!coordinates_.Equals(other.coordinates_)) return false; + if (HasError != other.HasError) return false; + if (ErrorMessage != other.ErrorMessage) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + hash ^= coordinates_.GetHashCode(); + if (HasError != false) hash ^= HasError.GetHashCode(); + if (ErrorMessage.Length != 0) hash ^= ErrorMessage.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + coordinates_.WriteTo(output, _repeated_coordinates_codec); + if (HasError != false) { + output.WriteRawTag(16); + output.WriteBool(HasError); + } + if (ErrorMessage.Length != 0) { + output.WriteRawTag(26); + output.WriteString(ErrorMessage); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + size += coordinates_.CalculateSize(_repeated_coordinates_codec); + if (HasError != false) { + size += 1 + 1; + } + if (ErrorMessage.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(ErrorMessage); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(GradientConversionOutput other) { + if (other == null) { + return; + } + coordinates_.Add(other.coordinates_); + if (other.HasError != false) { + HasError = other.HasError; + } + if (other.ErrorMessage.Length != 0) { + ErrorMessage = other.ErrorMessage; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + coordinates_.AddEntriesFrom(input, _repeated_coordinates_codec); + break; + } + case 16: { + HasError = input.ReadBool(); + break; + } + case 26: { + ErrorMessage = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/ColorLab/InputRGB.cs b/Software/Visual_Studio/Tango.PMR/ColorLab/InputRGB.cs new file mode 100644 index 000000000..72df5bf73 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/ColorLab/InputRGB.cs @@ -0,0 +1,215 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: InputRGB.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.ColorLab { + + /// <summary>Holder for reflection information generated from InputRGB.proto</summary> + public static partial class InputRGBReflection { + + #region Descriptor + /// <summary>File descriptor for InputRGB.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static InputRGBReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Cg5JbnB1dFJHQi5wcm90bxISVGFuZ28uUE1SLkNvbG9yTGFiIjQKCElucHV0", + "UkdCEgsKA1JlZBgBIAEoBRINCgVHcmVlbhgCIAEoBRIMCgRCbHVlGAMgASgF", + "Qh4KHGNvbS50d2luZS50YW5nby5wbXIuY29sb3JsYWJiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.ColorLab.InputRGB), global::Tango.PMR.ColorLab.InputRGB.Parser, new[]{ "Red", "Green", "Blue" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class InputRGB : pb::IMessage<InputRGB> { + private static readonly pb::MessageParser<InputRGB> _parser = new pb::MessageParser<InputRGB>(() => new InputRGB()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<InputRGB> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.ColorLab.InputRGBReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InputRGB() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InputRGB(InputRGB other) : this() { + red_ = other.red_; + green_ = other.green_; + blue_ = other.blue_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public InputRGB Clone() { + return new InputRGB(this); + } + + /// <summary>Field number for the "Red" field.</summary> + public const int RedFieldNumber = 1; + private int red_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Red { + get { return red_; } + set { + red_ = value; + } + } + + /// <summary>Field number for the "Green" field.</summary> + public const int GreenFieldNumber = 2; + private int green_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Green { + get { return green_; } + set { + green_ = value; + } + } + + /// <summary>Field number for the "Blue" field.</summary> + public const int BlueFieldNumber = 3; + private int blue_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Blue { + get { return blue_; } + set { + blue_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as InputRGB); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(InputRGB other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Red != other.Red) return false; + if (Green != other.Green) return false; + if (Blue != other.Blue) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Red != 0) hash ^= Red.GetHashCode(); + if (Green != 0) hash ^= Green.GetHashCode(); + if (Blue != 0) hash ^= Blue.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Red != 0) { + output.WriteRawTag(8); + output.WriteInt32(Red); + } + if (Green != 0) { + output.WriteRawTag(16); + output.WriteInt32(Green); + } + if (Blue != 0) { + output.WriteRawTag(24); + output.WriteInt32(Blue); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Red != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Red); + } + if (Green != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Green); + } + if (Blue != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Blue); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(InputRGB other) { + if (other == null) { + return; + } + if (other.Red != 0) { + Red = other.Red; + } + if (other.Green != 0) { + Green = other.Green; + } + if (other.Blue != 0) { + Blue = other.Blue; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Red = input.ReadInt32(); + break; + } + case 16: { + Green = input.ReadInt32(); + break; + } + case 24: { + Blue = input.ReadInt32(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/AlarmSourceType.cs b/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/AlarmSourceType.cs index cff4ad539..d5e7690d7 100644 --- a/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/AlarmSourceType.cs +++ b/Software/Visual_Studio/Tango.PMR/EmbeddedParameters/AlarmSourceType.cs @@ -23,11 +23,12 @@ namespace Tango.PMR.EmbeddedParameters { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChVBbGFybVNvdXJjZVR5cGUucHJvdG8SHFRhbmdvLlBNUi5FbWJlZGRlZFBh", - "cmFtZXRlcnMqlwEKD0FsYXJtU291cmNlVHlwZRIUChBUZW1wZXJhdHVyZUFs", + "cmFtZXRlcnMq0AEKD0FsYXJtU291cmNlVHlwZRIUChBUZW1wZXJhdHVyZUFs", "YXJtEAASFAoQTGltaXRTd2l0Y2hBbGFybRABEhEKDVByZXNzdXJlQWxhcm0Q", "AhIQCgxDdXJyZW50QWxhcm0QAxIOCgpNb3RvckFsYXJtEAQSDwoLQ292ZXJz", - "QWxhcm0QBRISCg5Eb05vdFBvbGxBbGFybRAGQigKJmNvbS50d2luZS50YW5n", - "by5wbXIuZW1iZWRkZWRwYXJhbWV0ZXJzYgZwcm90bzM=")); + "QWxhcm0QBRISCg5Eb05vdFBvbGxBbGFybRAGEhIKDkhhcmRMaW1pdEFsYXJt", + "EAcSDgoKVGFjaG9BbGFybRAIEhMKD0ZsdWlkTGV2ZWxBbGFybRAJQigKJmNv", + "bS50d2luZS50YW5nby5wbXIuZW1iZWRkZWRwYXJhbWV0ZXJzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.EmbeddedParameters.AlarmSourceType), }, null)); @@ -44,6 +45,9 @@ namespace Tango.PMR.EmbeddedParameters { [pbr::OriginalName("MotorAlarm")] MotorAlarm = 4, [pbr::OriginalName("CoversAlarm")] CoversAlarm = 5, [pbr::OriginalName("DoNotPollAlarm")] DoNotPollAlarm = 6, + [pbr::OriginalName("HardLimitAlarm")] HardLimitAlarm = 7, + [pbr::OriginalName("TachoAlarm")] TachoAlarm = 8, + [pbr::OriginalName("FluidLevelAlarm")] FluidLevelAlarm = 9, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index ed20a5964..8a85fb875 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -53,8 +53,11 @@ <Compile Include="ColorLab\ColorSpace.cs" /> <Compile Include="ColorLab\ConversionInput.cs" /> <Compile Include="ColorLab\ConversionOutput.cs" /> + <Compile Include="ColorLab\GradientConversionInput.cs" /> + <Compile Include="ColorLab\GradientConversionOutput.cs" /> <Compile Include="ColorLab\InputCoordinates.cs" /> <Compile Include="ColorLab\InputLiquid.cs" /> + <Compile Include="ColorLab\InputRGB.cs" /> <Compile Include="ColorLab\LiquidType.cs" /> <Compile Include="ColorLab\OutputCoordinates.cs" /> <Compile Include="ColorLab\OutputLiquid.cs" /> @@ -263,7 +266,7 @@ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
