void CreateMaterialImage(List <PictureBoxHotspot.ImageElement> pc, Point matpos, Size matsize, string text, string mattag, string mattip, Color matcolour, Color textcolour) { System.Drawing.Imaging.ColorMap colormap = new System.Drawing.Imaging.ColorMap(); colormap.OldColor = Color.White; // this is the marker colour to replace colormap.NewColor = matcolour; Bitmap mat = BitMapHelpers.ReplaceColourInBitmap(EDDiscovery.Properties.Resources.materialmarkerorangefilled, new System.Drawing.Imaging.ColorMap[] { colormap }); BitMapHelpers.DrawTextCentreIntoBitmap(ref mat, text, stdfont, textcolour); PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement( new Rectangle(matpos.X, matpos.Y, matsize.Width, matsize.Height), mat, mattag, mattip); pc.Add(ie); }
private void DrawToScreen(JournalScan sd, int vpos) { var information = new StringBuilder(); if (sd.Mapped) { information.Append("\u2713"); // let the cmdr see that this body is already mapped - this is a check } // Name information.Append(sd.BodyName); // Additional information information.Append((sd.AmmoniaWorld) ? @" is an ammonia world.".Tx(this) : null); information.Append((sd.Earthlike) ? @" is an earth like world.".Tx(this) : null); information.Append((sd.WaterWorld && !sd.Terraformable) ? @" is a water world.".Tx(this) : null); information.Append((sd.WaterWorld && sd.Terraformable) ? @" is a terraformable water world.".Tx(this) : null); information.Append((sd.Terraformable && !sd.WaterWorld) ? @" is a terraformable planet.".Tx(this) : null); information.Append((sd.HasRings) ? @" Has ring.".Tx(this) : null); information.Append((sd.HasMeaningfulVolcanism) ? @" Has ".Tx(this) + sd.Volcanism : null); information.Append(@" " + sd.DistanceFromArrivalText); if (sd.WasMapped == true && sd.WasDiscovered == true) { information.Append(" (Mapped & Discovered)".Tx(this)); } else if (sd.WasMapped == true) { information.Append(" (Mapped)".Tx(this)); } else if (sd.WasDiscovered == true) { information.Append(" (Discovered)".Tx(this)); } var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; var backcolour = IsTransparent ? Color.Transparent : this.BackColor; using (var bitmap = new Bitmap(1, 1)) { var grfx = Graphics.FromImage(bitmap); var containerSize = new Size(Math.Max(pictureBoxSurveyor.Width, 24), 24); // note when minimized, we could have a tiny width, so need to protect var label = information.ToString(); var bounds = BitMapHelpers.DrawTextIntoAutoSizedBitmap(label, containerSize, Font, textcolour, backcolour, 1.0F); if (align == Alignment.center) { labelOffset = (int)((containerSize.Width - bounds.Width) / 2); } else if (align == Alignment.right) { labelOffset = (int)(containerSize.Width - bounds.Width); } else { labelOffset = 0; } pictureBoxSurveyor?.AddTextAutoSize( new Point(labelOffset, vpos), new Size((int)bounds.Width, 24), information.ToString(), Font, textcolour, backcolour, 1.0F); } }
private void DrawToScreen(WantedBodies body, int bodiesCount) { var information = new StringBuilder(); // Is already surface mapped or not? if (body.Mapped) { information.Append("o "); // let the cmdr see that this body is already mapped } // Name information.Append(body.Name); // Additional information information.Append((body.Ammonia) ? @" is an ammonia world.".Tx(this) : null); information.Append((body.Earthlike) ? @" is an earth like world.".Tx(this) : null); information.Append((body.WaterWorld && !body.Terraformable) ? @" is a water world.".Tx(this) : null); information.Append((body.WaterWorld && body.Terraformable) ? @" is a terraformable water world.".Tx(this) : null); information.Append((body.Terraformable && !body.WaterWorld) ? @" is a terraformable planet.".Tx(this) : null); information.Append((body.Ringed) ? @" Has ring.".Tx(this) : null); information.Append((body.Volcanism) ? @" Has ".Tx(this) + body.VolcanismString : null); information.Append(@" " + body.DistanceFromArrival); //Debug.Print(information.ToString()); // for testing // Drawing Elements const int rowHeight = 24; var vPos = (bodiesCount * rowHeight) - rowHeight; var textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor; var backcolour = IsTransparent ? Color.Transparent : this.BackColor; using (var bitmap = new Bitmap(1, 1)) { var grfx = Graphics.FromImage(bitmap); using (var font = new Font(displayfont, FontStyle.Regular)) { if (body != null) { if (!body.Mapped || (body.Mapped && !hideAlreadyMappedBodiesToolStripMenuItem.Checked)) { var containerSize = new Size(Math.Max(pictureBoxSurveyor.Width, 24), 24); // note when minimized, we could have a tiny width, so need to protect var label = information.ToString(); var bounds = BitMapHelpers.DrawTextIntoAutoSizedBitmap(label, containerSize, displayfont, textcolour, backcolour, 1.0F); if (align == Alignment.center) { labelOffset = (int)((containerSize.Width - bounds.Width) / 2); } else if (align == Alignment.right) { labelOffset = (int)(containerSize.Width - bounds.Width); } else { labelOffset = 0; } pictureBoxSurveyor?.AddTextAutoSize( new Point(labelOffset, vPos + 4), new Size((int)bounds.Width, 24), information.ToString(), displayfont, textcolour, backcolour, 1.0F); } pictureBoxSurveyor.Refresh(); } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); gl3dcontroller = new Controller3D(); gl3dcontroller.PaintObjects = ControllerDraw; gl3dcontroller.ZoomDistance = 100F; gl3dcontroller.MatrixCalc.PerspectiveNearZDistance = 0.1f; gl3dcontroller.Start(glwfc, new Vector3(0, 0, 0), new Vector3(110f, 0, 0f), 1F); gl3dcontroller.KeyboardTravelSpeed = (ms, eyedist) => { return((float)ms / 20.0f); }; { items.Add(new GLColorShaderWorld(), "COS"); GLRenderState rl = GLRenderState.Lines(1); rObjects.Add(items.Shader("COS"), GLRenderableItem.CreateVector4Color4(items, PrimitiveType.Lines, rl, GLShapeObjectFactory.CreateBox(400, 200, 40, new Vector3(0, 0, 0), new Vector3(0, 0, 0)), new Color4[] { Color.Red, Color.Red, Color.Green, Color.Green })); } { items.Add(new GLTexturedShaderObjectTranslation(), "TEX"); using (var bmp = BitMapHelpers.DrawTextIntoAutoSizedBitmap("200,100", new Size(200, 100), new Font("Arial", 10.0f), System.Drawing.Text.TextRenderingHint.ClearTypeGridFit, Color.Yellow, Color.Blue)) { items.Add(new GLTexture2D(bmp, SizedInternalFormat.Rgba8), "200,100"); } using (var bmp = GLOFC.Utils.BitMapHelpers.DrawTextIntoAutoSizedBitmap("-200,-100", new Size(200, 100), new Font("Arial", 10.0f), System.Drawing.Text.TextRenderingHint.ClearTypeGridFit, Color.Yellow, Color.Blue)) { items.Add(new GLTexture2D(bmp, SizedInternalFormat.Rgba8), "-200,-100"); } GLRenderState rq = GLRenderState.Quads(); rObjects.Add(items.Shader("TEX"), GLRenderableItem.CreateVector4Vector2(items, PrimitiveType.Quads, rq, GLShapeObjectFactory.CreateQuad(20.0f, 20.0f, new Vector3(-90f.Radians(), 0, 0)), GLShapeObjectFactory.TexQuadCW, new GLRenderDataTranslationRotationTexture(items.Tex("200,100"), new Vector3(200, 0, 100)))); rObjects.Add(items.Shader("TEX"), GLRenderableItem.CreateVector4Vector2(items, PrimitiveType.Quads, rq, GLShapeObjectFactory.CreateQuad(20.0f, 20.0f, new Vector3(-90f.Radians(), 0, 0)), GLShapeObjectFactory.TexQuadCW, new GLRenderDataTranslationRotationTexture(items.Tex("-200,-100"), new Vector3(-200, 0, -100)))); } { items.Add(new GLStarPoints(), "STARS"); Vector3[] stars = GLPointsFactory.RandomStars(10000, -200, 200, -100, 100, 20, -20); GLRenderState rp = GLRenderState.PointsByProgram(); rObjects.Add(items.Shader("STARS"), "Stars", GLRenderableItem.CreateVector3Packed2(items, PrimitiveType.Points, rp, stars, new Vector3(50000, 50000, 50000), 16)); } items.Add(new GLMatrixCalcUniformBlock(), "MCUB"); // def binding of 0 Closed += ShaderTest_Closed; }