/// <summary> /// Renders checkbox tick /// </summary> /// <param name="graphics">graphics t orender to</param> /// <param name="X">X position</param> /// <param name="Y">Y position</param> protected void RenderCheck(Graphics graphics, int x, int y) { if (true == this.Checked) { if (null == this.tick) { this.tick = this.Engine.CreateImage(this.Window.Desktop.Theme.ThemeFolder + "/images/checkbox_tick"); } if (null != this.tick) { int off = (this.Bounds.Height - this.tick.Height) / 2; graphics.DrawImage(off + x + this.Bounds.X, off + y + this.Bounds.Y, this.tick.Width, this.tick.Height, this.tick); } } }
public void Render(Graphics graphics, int x, int y, int w, int h, Color color, float opacity, ImageLayout layout) { if (false == this.missing) { if (null == this.image) { this.image = this.engine.CreateImage(this.Name); if (null == this.image) { this.missing = true; return; } } if ((0.0f == this.image.Width) || (0.0f == this.image.Height)) { return; } if ((null == color) || (opacity <= 0.0f) || (opacity == 1.0f && (color.A <= 0.0f))) { return; } graphics.SetColor(color, opacity); switch (layout) { case ImageLayout.ImageLayoutNone: // + { graphics.SetRegion(x, y, w, h); graphics.DrawImage(x, y, this.image.Width, this.image.Height, this.image); graphics.ClearRegion(); } break; case ImageLayout.ImageLayoutCenter: // + { int offX = (w - this.image.Width) / 2; int offY = (h - this.image.Height) / 2; graphics.SetRegion(x, y, w, h); graphics.DrawImage(x + offX, y + offY, this.image.Width, this.image.Height, this.image); graphics.ClearRegion(); } break; case ImageLayout.ImageLayoutStretch: graphics.DrawImage(x, y, w, h, this.image); break; case ImageLayout.ImageLayoutTile: // + { float u = (float)(w) / (float)(this.image.Width); float v = (float)(h) / (float)(this.image.Height); graphics.DrawImage(x, y, w, h, this.image, u, v); } break; case ImageLayout.ImageLayoutZoom: // + { float ri = (float)(this.image.Width) / (float)(this.image.Height); int newW = w; int newH = (int)((float)(newW) / ri); int px = x; int py = y + (h - newH) / 2; if (newH > h) { newH = h; newW = (int)((float)(newH) * ri); px = x + (w - newW) / 2; py = y; } graphics.DrawImage(px, py, newW, newH, this.image); } break; case ImageLayout.ImageLayoutFillWidth: { int dy = (int)((w - h) / 2); graphics.SetRegion(x, y, w, h); graphics.DrawImage(x, y - dy, w, h + dy * 2, this.image); graphics.ClearRegion(); } break; default: break; } } }
/// <summary> /// Render letter /// </summary> /// <param name="render">graphics to render to.</param> /// <param name="X">X position.</param> /// <param name="Y">Y position.</param> /// <returns></returns> public int Render(Graphics render, int x, int y) { if (false == this.loaded) // branch prediction will do the job. { Load(false); } if (null != this.image) { render.DrawImage(x + this.offsetX, y + this.offsetY, this.textureWidth, this.textureHeight, this.image, this.uvs); } return this.width; }
/// <summary> /// Render cursor at the specified position /// </summary> internal void Render(Graphics render, int x, int y, Theme theme) { render.SetColor(white); if (null == this.textures[0]) { String themeFolder = theme.ThemeFolder + "/images/cursor_"; this.textures[(int)MousePointers.PointerStandard] = this.engine.CreateImage(themeFolder + "default"); this.textures[(int)MousePointers.PointerWait] = this.engine.CreateImage(themeFolder + "clock"); this.textures[(int)MousePointers.PointerMove] = this.engine.CreateImage(themeFolder + "move"); this.textures[(int)MousePointers.PointerHResize] = this.engine.CreateImage(themeFolder + "hsize"); this.textures[(int)MousePointers.PointerVResize] = this.engine.CreateImage(themeFolder + "vsize"); this.textures[(int)MousePointers.PointerResize1] = this.engine.CreateImage(themeFolder + "resize1"); this.textures[(int)MousePointers.PointerResize2] = this.engine.CreateImage(themeFolder + "resize2"); this.textures[(int)MousePointers.PointerText] = this.engine.CreateImage(themeFolder + "text"); this.textures[(int)MousePointers.PointerHand] = this.engine.CreateImage(themeFolder + "hand"); } if (null != this.textures[(int)this.activeCursor]) { if (MousePointers.PointerStandard == this.activeCursor) { render.DrawImage(x, y, 32, 32, this.textures[(int)this.activeCursor]); } else { render.DrawImage(x - 16, y - 16, this.textures[(int)this.activeCursor].Width, this.textures[(int)this.activeCursor].Height, this.textures[(int)this.activeCursor]); } } }
public int Render(Graphics graphics, int x, int y) { graphics.DrawImage(x, y, this.width, this.height, this.texture, this.texCoords); return this.letterWidth; }