Gradient Fill


Gradient Fill

A gradient fill is used to fill a rectangular (or triangular) area using two colors. The gradient fill provides a smooth transition from one color to another one.
Un relleno de gradiente es usado para llenar una área rectangular (o triangular) usando dos colores. El relleno de gradiente proporciona una transición suave de un color a otro.

Problem 1
Create a Window Application using Wintempla called Grad to test gradient fills. Do not forget to check the Paint event (Window_Paint).
Cree una aplicación de Ventana usando Wintempla llamada Grad para probar los rellenos de gradiente. No se olvide de seleccionar el evento Paint (Window_Paint).

GradRun

Grap.cpp
...
void Grad::Window_Open(Win::Event& e)
{
}

void Grad::Window_Paint(Win::Event& e)
{
     CG::Gdi gdi(hWnd, true, false);
     //________________________________________________________ Rectangle
     GRADIENT_RECT rectangle[1];
     rectangle[0].UpperLeft = 0;
     rectangle[0].LowerRight = 1;
     TRIVERTEX vertexRect[2];
     vertexRect[0].x = 10;
     vertexRect[0].y = 20;
     vertexRect[0].Alpha = 0;
     vertexRect[0].Red = 0;
     vertexRect[0].Green = 0;
     vertexRect[0].Blue = 32000;
     //
     vertexRect[1].x = 500;
     vertexRect[1].y = 200;
     vertexRect[1].Alpha = 0;
     vertexRect[1].Red = 0;
     vertexRect[1].Green = 32000;
     vertexRect[1].Blue = 0;
     //
     gdi.GradientFillRectH(vertexRect, 2, rectangle, 1);
     //________________________________________________________ Triangle
     GRADIENT_TRIANGLE triangle[1];
     triangle[0].Vertex1 = 0;
     triangle[0].Vertex2 = 1;
     triangle[0].Vertex3 = 2;
     TRIVERTEX vertexTrian[3];
     vertexTrian[0].x = 10;
     vertexTrian[0].y = 300;
     vertexTrian[0].Alpha = 0;
     vertexTrian[0].Red = 0;
     vertexTrian[0].Green = 0;
     vertexTrian[0].Blue = 64000;
     //
     vertexTrian[1].x = 500;
     vertexTrian[1].y = 300;
     vertexTrian[1].Alpha = 0;
     vertexTrian[1].Red = 0;
     vertexTrian[1].Green = 64000;
     vertexTrian[1].Blue = 0;
     //
     vertexTrian[2].x = 200;
     vertexTrian[2].y = 700;
     vertexTrian[2].Alpha = 0;
     vertexTrian[2].Red = 64000;
     vertexTrian[2].Green = 0;
     vertexTrian[2].Blue = 0;
     //
     gdi.GradientFillTriangle(vertexTrian, 3, triangle, 1);
}


© Copyright 2000-2019 Wintempla selo. All Rights Reserved. Sep 05 2019. Home