public void Ready() { EmueraBehaviour.Ready(); option_window.Ready(); option_window.gameObject.SetActive(true); background.color = GenericUtils.ToUnityColor(Config.BackColor); background_color = Config.BackColor; content_width = Config.WindowX; FontUtils.SetDefaultFont(Config.FontName); template_text.color = EmueraBehaviour.FontColor; template_text.font = FontUtils.default_font; if (template_text.font == null) { template_text.font = FontUtils.default_font; } template_text.fontSize = EmueraBehaviour.FontSize; template_text.rectTransform.sizeDelta = new Vector2(template_text.rectTransform.sizeDelta.x, 0); template_text.gameObject.SetActive(false); console_lines_ = new List <EmueraBehaviour.LineDesc>(max_log_count); while (console_lines_.Count < max_log_count) { console_lines_.Add(null); } invalid_count = max_log_count; }
//private static byte[] BytesFromBitmap(Bitmap bmp) //{ // BitmapData bmpData = bmp.LockBits( // new Rectangle(0, 0, bmp.Width, bmp.Height), // ImageLockMode.ReadOnly, // 書き込むときはReadAndWriteで // PixelFormat.Format32bppArgb // ); // if (bmpData.Stride < 0) // throw new Exception();//変な形式のが送られてくることはありえないはずだが一応 // byte[] pixels = new byte[bmpData.Stride * bmp.Height]; // try // { // IntPtr ptr = bmpData.Scan0; // System.Runtime.InteropServices.Marshal.Copy(ptr, pixels, 0, pixels.Length); // } // finally // { // bmp.UnlockBits(bmpData); // } // return pixels; //} /// <summary> /// GTOARRAY int ID, var array /// エラーチェックは呼び出し元でのみ行う /// <returns></returns> //public bool GBitmapToInt64Array(Int64[,] array, int xstart, int ystart) //{ // if (g == null || Bitmap == null) // throw new NullReferenceException(); // int w = Bitmap.Width; // int h = Bitmap.Height; // if (xstart + w > array.GetLength(0) || ystart + h > array.GetLength(1)) // return false; // Rectangle rect = new Rectangle(0, 0, w, h); // System.Drawing.Imaging.BitmapData bmpData = // Bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, // PixelFormat.Format32bppArgb); // IntPtr ptr = bmpData.Scan0; // byte[] rgbValues = new byte[w * h * 4]; // Marshal.Copy(ptr, rgbValues, 0, rgbValues.Length); // Bitmap.UnlockBits(bmpData); // int i = 0; // for (int y = 0; y < h; y++) // { // for (int x = 0; x < w; x++) // { // array[x + xstart, y + ystart] = // rgbValues[i++] + //B // (((Int64)rgbValues[i++]) << 8) + //G // (((Int64)rgbValues[i++]) << 16) + //R // (((Int64)rgbValues[i++]) << 24); //A // } // } // return true; //} /// <summary> /// GFROMARRAY int ID, var array /// エラーチェックは呼び出し元でのみ行う /// <returns></returns> //public bool GByteArrayToBitmap(Int64[,] array, int xstart, int ystart) //{ // if (g == null || Bitmap == null) // throw new NullReferenceException(); // int w = Bitmap.Width; // int h = Bitmap.Height; // if (xstart + w > array.GetLength(0) || ystart + h > array.GetLength(1)) // return false; // byte[] rgbValues = new byte[w * h * 4]; // int i = 0; // for (int y = 0; y < h; y++) // { // for (int x = 0; x < w; x++) // { // Int64 c = array[x + xstart, y + ystart]; // rgbValues[i++] = (byte)(c & 0xFF);//B // rgbValues[i++] = (byte)((c >> 8) & 0xFF);//G // rgbValues[i++] = (byte)((c >> 16) & 0xFF);//R // rgbValues[i++] = (byte)((c >> 24) & 0xFF);//A // } // } // Rectangle rect = new Rectangle(0, 0, w, h); // System.Drawing.Imaging.BitmapData bmpData = // Bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.WriteOnly, // PixelFormat.Format32bppArgb); // IntPtr ptr = bmpData.Scan0; // Marshal.Copy(rgbValues, 0, ptr, rgbValues.Length); // Bitmap.UnlockBits(bmpData); // return true; //} #endregion #region Bitmap読み込み・削除 /// <summary> /// 未作成ならエラー /// </summary> //public Bitmap GetBitmap() //{ // if (Bitmap == null) // throw new NullReferenceException(); // //UnlockGraphics(); // return Bitmap; //} /// <summary> /// GSETCOLOR(int ID, int cARGB, int x, int y) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GSetColor(uEmuera.Drawing.Color c, int x, int y) { if (Bitmap == null) { throw new NullReferenceException(); } // //UnlockGraphics(); // Bitmap.SetPixel(x, y, c); }
public void SetBackgroundColor(uEmuera.Drawing.Color color) { if (background_color == color) { return; } background.color = GenericUtils.ToUnityColor(color); background_color = color; }
/// <summary> /// GCLEAR(int ID, int cARGB) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GClear(uEmuera.Drawing.Color c) { // if (g == null) // throw new NullReferenceException(); // g.Clear(c); }
public static void DrawText(uEmuera.Drawing.Graphics graph, string Str, uEmuera.Drawing.Font font, uEmuera.Drawing.Point pt, uEmuera.Drawing.Color color, TextFormatFlags flags) { }
public static void SetBackgroundColor(uEmuera.Drawing.Color color) { text_content.SetBackgroundColor(color); }
public static string GetColorCode(uEmuera.Drawing.Color color) { return(string.Format("{0:x8}", color.ToRGBA())); }
public static UnityEngine.Color ToUnityColor(uEmuera.Drawing.Color color) { return(new UnityEngine.Color(color.r, color.g, color.b, color.a)); }