mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-14 02:04:14 +01:00
Merge pull request #60 from max619/fix/pix_fmt_order
Fixed color pallette (issue #58)
Former-commit-id: 9ed4996bc0
This commit is contained in:
commit
4d7a464627
2 changed files with 5 additions and 3 deletions
|
@ -30,12 +30,14 @@ private static BitmapVideoFrameWrapper CreateVideoFrame(int index, PixelFormat f
|
||||||
for (int y = 0; y < h; y++)
|
for (int y = 0; y < h; y++)
|
||||||
for (int x = 0; x < w; x++)
|
for (int x = 0; x < w; x++)
|
||||||
{
|
{
|
||||||
|
var xf = x / (float)w;
|
||||||
|
var yf = y / (float)h;
|
||||||
var nx = x * scaleNoise + offset;
|
var nx = x * scaleNoise + offset;
|
||||||
var ny = y * scaleNoise + offset;
|
var ny = y * scaleNoise + offset;
|
||||||
|
|
||||||
var value = (int)((Perlin.Noise(nx, ny) + 1.0f) / 2.0f * 255);
|
var value = (int)((Perlin.Noise(nx, ny) + 1.0f) / 2.0f * 255);
|
||||||
|
|
||||||
var color = Color.FromArgb(value, value, value);
|
var color = Color.FromArgb((int)(value * xf), (int)(value * yf), value);
|
||||||
|
|
||||||
bitmap.SetPixel(x, y, color);
|
bitmap.SetPixel(x, y, color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,9 @@ private static string ConvertStreamFormat(PixelFormat fmt)
|
||||||
case PixelFormat.Format16bppRgb565:
|
case PixelFormat.Format16bppRgb565:
|
||||||
return "bgr565le";
|
return "bgr565le";
|
||||||
case PixelFormat.Format24bppRgb:
|
case PixelFormat.Format24bppRgb:
|
||||||
return "rgb24";
|
return "bgr24";
|
||||||
case PixelFormat.Format32bppArgb:
|
case PixelFormat.Format32bppArgb:
|
||||||
return "rgba";
|
return "bgra";
|
||||||
case PixelFormat.Format32bppPArgb:
|
case PixelFormat.Format32bppPArgb:
|
||||||
//This is not really same as argb32
|
//This is not really same as argb32
|
||||||
return "argb";
|
return "argb";
|
||||||
|
|
Loading…
Reference in a new issue