public QColor[] GetPixels() { var c = new QColor[Width * Height]; _texture.GetData(c); return(c); }
public QTexture GetPartialTexture(QRectangle source) { Texture2D t = new Texture2D(_texture.GraphicsDevice, source.Width, source.Height); QColor[] colors = new QColor[t.Width * t.Height]; _texture.GetData(0, source, colors, 0, colors.Length); t.SetData(0, source, colors, 0, colors.Length); return(new QTexture(Manager, t)); }
/// <summary> /// Adds a custom rectanlge texture to the game /// </summary> /// <param name="n"></param> /// <param name="w"></param> /// <param name="h"></param> /// <param name="color"></param> public void Rectangle(string n, int w, int h, QColor color) { var t = new Texture2D(cm.MonoGraphicsDevice, w, h); var c = new QColor[w * h]; for (var i = 0; i < c.Length; i++) { c[i] = color; } t.SetData(c); if (!cm.LoadCustomTexture(n, t)) { t.Dispose(); } }
internal QContentManager(Game engine) { MonoGraphicsDevice = engine.GraphicsDevice; MonoContentManager = engine.Content; Atlases = new List <QTextureAtlas>(); Textures = new Dictionary <string, QTexture>(); Fonts = new Dictionary <string, QFont>(); Sounds = new Dictionary <string, QSound>(); Music = new Dictionary <string, QMusic>(); //setting up the unknown texture once if (UnknownTexture == null) { var texture = new Texture2D(MonoGraphicsDevice, 2, 2); var c = new QColor[] { QColor.White, QColor.Purple, QColor.White, QColor.Purple }; texture.SetData(c); UnknownTexture = new QTexture(this, texture); } }
static QColor() { TransparentBlack = new QColor(0U); Transparent = new QColor(0U); AliceBlue = new QColor(4294965488U); AntiqueWhite = new QColor(4292340730U); Aqua = new QColor(4294967040U); Aquamarine = new QColor(4292149119U); Azure = new QColor(4294967280U); Beige = new QColor(4292670965U); Bisque = new QColor(4291093759U); Black = new QColor(4278190080U); BlanchedAlmond = new QColor(4291685375U); Blue = new QColor(4294901760U); BlueViolet = new QColor(4293012362U); Brown = new QColor(4280953509U); BurlyWood = new QColor(4287084766U); CadetBlue = new QColor(4288716383U); Chartreuse = new QColor(4278255487U); Chocolate = new QColor(4280183250U); Coral = new QColor(4283465727U); CornflowerBlue = new QColor(4293760356U); Cornsilk = new QColor(4292671743U); Crimson = new QColor(4282127580U); Cyan = new QColor(4294967040U); DarkBlue = new QColor(4287299584U); DarkCyan = new QColor(4287335168U); DarkGoldenrod = new QColor(4278945464U); DarkGray = new QColor(4289309097U); DarkGreen = new QColor(4278215680U); DarkKhaki = new QColor(4285249469U); DarkMagenta = new QColor(4287299723U); DarkOliveGreen = new QColor(4281297749U); DarkOrange = new QColor(4278226175U); DarkOrchid = new QColor(4291572377U); DarkRed = new QColor(4278190219U); DarkSalmon = new QColor(4286224105U); DarkSeaGreen = new QColor(4287347855U); DarkSlateBlue = new QColor(4287315272U); DarkSlateGray = new QColor(4283387695U); DarkTurquoise = new QColor(4291939840U); DarkViolet = new QColor(4292018324U); DeepPink = new QColor(4287829247U); DeepSkyBlue = new QColor(4294950656U); DimGray = new QColor(4285098345U); DodgerBlue = new QColor(4294938654U); Firebrick = new QColor(4280427186U); FloralWhite = new QColor(4293982975U); ForestGreen = new QColor(4280453922U); Fuchsia = new QColor(4294902015U); Gainsboro = new QColor(4292664540U); GhostWhite = new QColor(4294965496U); Gold = new QColor(4278245375U); Goldenrod = new QColor(4280329690U); Gray = new QColor(4286611584U); Green = new QColor(4278222848U); GreenYellow = new QColor(4281335725U); Honeydew = new QColor(4293984240U); HotPink = new QColor(4290013695U); IndianRed = new QColor(4284243149U); Indigo = new QColor(4286709835U); Ivory = new QColor(4293984255U); Khaki = new QColor(4287424240U); Lavender = new QColor(4294633190U); LavenderBlush = new QColor(4294308095U); LawnGreen = new QColor(4278254716U); LemonChiffon = new QColor(4291689215U); LightBlue = new QColor(4293318829U); LightCoral = new QColor(4286611696U); LightCyan = new QColor(4294967264U); LightGoldenrodYellow = new QColor(4292016890U); LightGray = new QColor(4292072403U); LightGreen = new QColor(4287688336U); LightPink = new QColor(4290885375U); LightSalmon = new QColor(4286226687U); LightSeaGreen = new QColor(4289376800U); LightSkyBlue = new QColor(4294626951U); LightSlateGray = new QColor(4288252023U); LightSteelBlue = new QColor(4292789424U); LightYellow = new QColor(4292935679U); Lime = new QColor(4278255360U); LimeGreen = new QColor(4281519410U); Linen = new QColor(4293325050U); Magenta = new QColor(4294902015U); Maroon = new QColor(4278190208U); MediumAquamarine = new QColor(4289383782U); MediumBlue = new QColor(4291624960U); MediumOrchid = new QColor(4292040122U); MediumPurple = new QColor(4292571283U); MediumSeaGreen = new QColor(4285641532U); MediumSlateBlue = new QColor(4293814395U); MediumSpringGreen = new QColor(4288346624U); MediumTurquoise = new QColor(4291613000U); MediumVioletRed = new QColor(4286911943U); MidnightBlue = new QColor(4285536537U); MintCream = new QColor(4294639605U); MistyRose = new QColor(4292994303U); Moccasin = new QColor(4290110719U); MonoGameOrange = new QColor(4278205671U); NavajoWhite = new QColor(4289584895U); Navy = new QColor(4286578688U); OldLace = new QColor(4293326333U); Olive = new QColor(4278222976U); OliveDrab = new QColor(4280520299U); Orange = new QColor(4278232575U); OrangeRed = new QColor(4278207999U); Orchid = new QColor(4292243674U); PaleGoldenrod = new QColor(4289390830U); PaleGreen = new QColor(4288215960U); PaleTurquoise = new QColor(4293848751U); PaleVioletRed = new QColor(4287852763U); PapayaWhip = new QColor(4292210687U); PeachPuff = new QColor(4290370303U); Peru = new QColor(4282353101U); Pink = new QColor(4291543295U); Plum = new QColor(4292714717U); PowderBlue = new QColor(4293320880U); Purple = new QColor(4286578816U); Red = new QColor(4278190335U); RosyBrown = new QColor(4287598524U); RoyalBlue = new QColor(4292962625U); SaddleBrown = new QColor(4279453067U); Salmon = new QColor(4285694202U); SandyBrown = new QColor(4284523764U); SeaGreen = new QColor(4283927342U); SeaShell = new QColor(4293850623U); Sienna = new QColor(4281160352U); Silver = new QColor(4290822336U); SkyBlue = new QColor(4293643911U); SlateBlue = new QColor(4291648106U); SlateGray = new QColor(4287660144U); Snow = new QColor(4294638335U); SpringGreen = new QColor(4286578432U); SteelBlue = new QColor(4290019910U); Tan = new QColor(4287411410U); Teal = new QColor(4286611456U); Thistle = new QColor(4292394968U); Tomato = new QColor(4282868735U); Turquoise = new QColor(4291878976U); Violet = new QColor(4293821166U); Wheat = new QColor(4289978101U); White = new QColor(uint.MaxValue); WhiteSmoke = new QColor(4294309365U); Yellow = new QColor(4278255615U); YellowGreen = new QColor(4281519514U); }
public static QColor Lerp(QColor a, QColor b, float amount) { return(Color.Lerp(a, b, amount)); }
public bool Equals(QColor other) { return(_color.Equals(other._color)); }
/// <summary> /// Helper function to create a good circle texture /// </summary> /// <param name="g"></param> /// <param name="r"></param> /// <param name="c"></param> /// <returns></returns> Texture2D CreateCircle(GraphicsDevice g, int r, QColor c) { int outerRadius = r * 2 + 2; // So circle doesn't go out of bounds Texture2D texture = new Texture2D(g, outerRadius, outerRadius); QColor[] data = new QColor[outerRadius * outerRadius]; // Colour the entire texture transparent first. for (int i = 0; i < data.Length; i++) { data[i] = QColor.Transparent; } // Work out the minimum step necessary using trigonometry + sine approximation. double angleStep = 1f / r; for (double angle = 0; angle < Math.PI * 2; angle += angleStep) { // Use the parametric definition of a circle: http://en.wikipedia.org/wiki/Circle#Cartesian_coordinates int x = (int)Math.Round(r + r * Math.Cos(angle)); int y = (int)Math.Round(r + r * Math.Sin(angle)); data[y * outerRadius + x + 1] = QColor.White; } bool finished = false; int firstSkip = 0; int lastSkip = 0; for (int i = 0; i <= data.Length - 1; i++) { if (finished == false) { //T = transparent W = White; //Find the First Batch of Colors TTTTWWWTTTT The top of the circle if ((data[i] == QColor.White) && (firstSkip == 0)) { while (data[i + 1] == QColor.White) { i++; } firstSkip = 1; i++; } //Now Start Filling TTTTTTTTWWTTTTTTTT //circle in Between TTTTTTW--->WTTTTTT //transaparent blancks TTTTTWW--->WWTTTTT // TTTTTTW--->WTTTTTT // TTTTTTTTWWTTTTTTTT if (firstSkip == 1) { if (data[i] == QColor.White && data[i + 1] != QColor.White) { i++; while (data[i] != QColor.White) { //Loop to check if its the last row of pixels //We need to check this because of the //int outerRadius = radius * 2 + -->'2'<--; for (int j = 1; j <= outerRadius; j++) { if (data[i + j] != QColor.White) { lastSkip++; } } //If its the last line of pixels, end drawing if (lastSkip == outerRadius) { break; finished = true; } else { data[i] = QColor.White; i++; lastSkip = 0; } } while (data[i] == QColor.White) { i++; } i--; } } } } texture.SetData(data); return(texture); }
internal virtual void ClearScreen(QColor color) { gd.Clear(color); }
// /// <summary> // /// Draws filled in circle // /// </summary> // /// <param name="t"></param> // /// <param name="radius"></param> // /// <param name="c"></param> // public void DrawCircle(QTransform t, float radius, QColor c) // { // sb.DrawCircle(t.Position, radius, 20, c, radius); // } // // /// <summary> // /// Assumes that the rectangle origin is in the middle // /// </summary> // /// <param name="t"></param> // /// <param name="width"></param> // /// <param name="height"></param> // /// <param name="color"></param> // public void DrawRect(QTransform t, float width, float height, QColor color) // { // var v = t.Position; // //sb.DrawRectangle(v - new QVec(width, height)/2f, new QVec(width, height), color); // sb.FillRectangle(v - new QVec(width, height)/2f, new QVec(width, height), color); // //sb.FillRectangle(t.Position.X, t.Position.Y, width, height, color, t.Rotation); // } internal virtual void Draw(QTexture t, QVector2 pos, QColor c) { sb.Draw(t, pos, c); }