public virtual void RenderGlyph() { // dibujo el glyph if (textura != null) { TGCVector3 pos = new TGCVector3(center.X * ex, center.Y * ey, 0); TGCVector3 c0 = new TGCVector3(image_width / 2, image_height / 2, 0); // Determino la escala para que entre justo TGCVector2 scale = new TGCVector2(k * ex * rc.Width / image_width, k * ey * rc.Height / image_height); TGCVector2 offset = new TGCVector2(ox * ex, oy * ey); gui.sprite.Transform = TGCMatrix.Transformation2D(new TGCVector2(center.X * ex, center.Y * ey), 0, scale, TGCVector2.Zero, 0, offset) * gui.RTQ; gui.sprite.Draw(textura, c0, pos, Color.FromArgb(gui.alpha, 255, 255, 255).ToArgb()); } }
public virtual void InitRender(DXGui p_gui) { // inicializacion comun a todos los controles gui = p_gui; // estado del control sel = state == itemState.hover; // Calcula la escala pp dicha ex = gui.ex; ey = gui.ey; ox = gui.ox; oy = gui.oy; if (scrolleable) { // como este boton es un item scrolleable, tiene que aplicar tambien el origen sox,soy ox += gui.sox; oy += gui.soy; } // sobre escala por estar seleccionado k = 1; if (sel) { // aumento las escala k = 1 + (float)(0.5 * (gui.delay_sel0 - gui.delay_sel)); // Le aplico una matriz de escalado adicional, solo sobre el TEXTO. // El glyph tiene su propia matriz // Este kilombo es porque una cosa es la escala global que se aplica uniformemente en todo el gui // y esta centrada en el origen. // Pero esta escala es local, del texto, que se aplica centra en centro del texto, luego de haberlo // escalado por la escala global. gui.sprite.Transform = gui.sprite.Transform * TGCMatrix.Transformation2D(new TGCVector2((center.X + ox) * ex, (center.Y + oy) * ey), 0, new TGCVector2(k, k), TGCVector2.Zero, 0, TGCVector2.Zero); } }
private void UpdateTransformationMatrix() { TransformationMatrix = TGCMatrix.Transformation2D(scalingCenter, 0, scaling, rotationCenter, rotation, position); }