Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace KKtImgLib
- {
- static class BitmapExtensions
- {
- public const float _4bit = 255 / 15f;
- public const float _5bit = 255 / 31f;
- public const float _6bit = 255 / 63f;
- public static Bitmap.R8G8B8A8[] ToR8G8B8A8(this Bitmap.R8[] R)
- {
- Bitmap.R8G8B8A8[] RGBA = new Bitmap.R8G8B8A8[16];
- for (byte i = 0; i < 16; i++) RGBA[i] = new Bitmap.R8G8B8A8(R[i].R, 0, 0, 0xFF);
- return RGBA;
- }
- public static Bitmap.R8G8B8A8[] ToR8G8B8A8(this Bitmap.R8G8[] RG)
- {
- Bitmap.R8G8B8A8[] RGB = new Bitmap.R8G8B8A8[16];
- for (byte i = 0; i < 16; i++) RGB[i] = new Bitmap.R8G8B8A8(RG[i].R, RG[i].G, 0, 0xFF);
- return RGB;
- }
- public static Bitmap.R8G8B8A8[] ToR8G8B8A8(this Bitmap.R8G8B8[] RGB)
- {
- Bitmap.R8G8B8A8[] RGBA = new Bitmap.R8G8B8A8[16];
- for (byte i = 0; i < 16; i++) RGBA[i] = (Bitmap.R8G8B8A8)RGB[i];
- return RGBA;
- }
- public static Bitmap.R8G8B8[] ToR8G8B8(this Bitmap.R8G8B8A8[] RGBA)
- {
- Bitmap.R8G8B8[] RGB = new Bitmap.R8G8B8[16];
- for (byte i = 0; i < 16; i++) RGB[i] = (Bitmap.R8G8B8)RGBA[i];
- return RGB;
- }
- public static Bitmap.R16G16B16A16[] ToR16G16B16A16(this Bitmap.R8G8B8A8[] RGBA)
- {
- Bitmap.R16G16B16A16[] RGBA16 = new Bitmap.R16G16B16A16[16];
- for (byte i = 0; i < 16; i++) RGBA16[i] = (Bitmap.R16G16B16A16)RGBA[i];
- return RGBA16;
- }
- public static Bitmap.R16G16B16[] ToR16G16B16(this Bitmap.R8G8B8A8[] RGBA)
- {
- Bitmap.R16G16B16[] RGB = new Bitmap.R16G16B16[16];
- for (byte i = 0; i < 16; i++) RGB[i] = (Bitmap.R16G16B16)(Bitmap.R8G8B8)RGBA[i];
- return RGB;
- }
- }
- }
Add Comment
Please, Sign In to add comment