ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Rich Text Area control
  • Drawing a surface chart
grSurfaceAltitudeColor (Example)
Drawing a surface chart
This example is used to draw a surface chart representing the lightness of an image. The chart is drawn in the "CHART_Surface" control.
x, y, z are real
wImage is Image
 
// Load the photo found in memory in an Image variable
wImage = "sunset.jpg"
 
// Display the photo
IMG_photo = wImage
 
// Erase the previous chart
grClearPict(CHART_Surface)
// Delete data from the previous chart
grDeleteSeries(CHART_Surface)
 
// Delete the different colors of the previous altitudes
grSurfaceDeleteAltitudeColor(CHART_Surface, 0)
grSurfaceDeleteAltitudeColor(CHART_Surface, 33)
grSurfaceDeleteAltitudeColor(CHART_Surface, 66)
grSurfaceDeleteAltitudeColor(CHART_Surface, 100)
 
 
IF CBOX_Color THEN
// Chart in color
grSurfaceAltitudeColor(CHART_Surface, 0, PastelBlue)
grSurfaceAltitudeColor(CHART_Surface, 33, PastelGreen)
grSurfaceAltitudeColor(CHART_Surface, 66, PastelYellow)
grSurfaceAltitudeColor(CHART_Surface, 100, PastelRed)
ELSE
// Chart in Black & White
grSurfaceAltitudeColor(CHART_Surface, 0, Black)
grSurfaceAltitudeColor(CHART_Surface, 100, White)
END
 
// Scan the image and all the points
// to define the rate of lightness for the point
// via ColorLightness
FOR I = 1 _TO_ wImage.Width STEP 4
FOR j = 1 _TO_ wImage.Height STEP 4
x = I
y = j
z = ColorLightness(dPixelColor(wImage, x, y))
grSurfaceAddData(CHART_Surface, x, y, z)
END
END
 
// Performs a slight rotation of 35°
// to highlight the raised effect
grRotation(CHART_Surface, grAxisX, -35)
 
// Draws the chart in the Chart control
grDraw(CHART_Surface)
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help