System.Byte

Posted by Roger Blanchard on 07-May-2014 09:48

I have the following C# code I am trying to translate to OE.


C#:

byte[] buffer = new byte[data.Height * data.Stride];

OE ABL syntax:

oSystemByte = NEW "System.Byte[]" (Data:HEIGHT * Data:Stride). 

C#:

Marshal.Copy(data.Scan0, buffer, 0, buffer.Length);

OE:

System.Runtime.InteropServices.Marshal:Copy( Data:Scan0, oSystemByte, 0, oSystemByte:Length ).  C#:

byte alpha = buffer[y * data.Stride + 4 * x + 3];

What would the OE syntax for the above be?

I have tried the following with no luck:

DEFINE VARIABLE oAlpha AS "System.Byte[]" NO-UNDO.

oAlpha:SetValue(oBuffer, (y * oData:Stride + 4 * x + 3) ).


All Replies

Posted by Brian K. Maher on 07-May-2014 11:13
Hi Roger,
 
Try the following:
 
DEFINE VARIABLE oAlpha AS "System.Byte[]" NO-UNDO.
 
oAlpha = NEW "System.Byte[]" (y * oData:Stride + 4 * x + 3).
 
oAlpha:SetValue(oBuffer, (y * oData:Stride + 4 * x + 3) ).
 
Brian
Posted by jquerijero on 07-May-2014 13:24

I think this should just be;

DEFINE VARIABLE oAlpha AS System.Byte NO-UNDO.

The variable alpha is not an array.

Posted by Roger Blanchard on 07-May-2014 14:11

DEFINE VARIABLE oAlpha AS System.Byte NO-UNDO will not compile. In reading docs that maps to an ABL INTEGER.

If I define iAlppha AS INT and then use the following code it does compile.

iAlpha = oSystemByte:GetValue(y * oBitmapData:Stride + 4 * x + 3).

I am testing the results.

This thread is closed