Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created July 22, 2011 01:29
Show Gist options
  • Select an option

  • Save follesoe/1098666 to your computer and use it in GitHub Desktop.

Select an option

Save follesoe/1098666 to your computer and use it in GitHub Desktop.
PhotoCameraLuminanceSource
public class PhotoCameraLuminanceSource : LuminanceSource
{
public byte[] PreviewBufferY { get; private set; }
public PhotoCameraLuminanceSource(int width, int height) : base(width, height)
{
PreviewBufferY = new byte[width * height];
}
public override sbyte[] Matrix
{
get { return (sbyte[])(Array)PreviewBufferY; }
}
public override sbyte[] getRow(int y, sbyte[] row)
{
if (row == null || row.Length < Width)
{
row = new sbyte[Width];
}
for (int i = 0; i < Height; i++)
row[i] = (sbyte)PreviewBufferY[i * Width + y];
return row;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment