STK Graphics PrimitivesSend comments on this topic.
IAgStkGraphicsLevelsFilter Interface

Description

Adjusts the band levels of the source raster linearly.

Public Methods

Public Method ClearAdjustmentsClears the level adjustment values for all bands.
Public Method SetLevelAdjustmentSets the linear level adjustment value for the given Raster Band. Both negative and positive values are accepted.

Interfaces

Implemented Interface
IAgStkGraphicsRasterFilter

CoClasses that Implement IAgStkGraphicsLevelsFilter

Example

Adjust the color levels of an image
[C#]
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsScreenOverlayCollectionBase overlayManager = (IAgStkGraphicsScreenOverlayCollectionBase)manager.ScreenOverlays.Overlays;
//
// The URI can be a file path, http, https, or ftp location
//
IAgStkGraphicsRaster image = manager.Initializers.Raster.InitializeWithStringUri(
    imageFile);

//
// Adjust the color levels of the image
//
IAgStkGraphicsLevelsFilter levelsFilter = manager.Initializers.LevelsFilter.Initialize();
levelsFilter.SetLevelAdjustment(AgEStkGraphicsRasterBand.eStkGraphicsRasterBandBlue, -255);
levelsFilter.SetLevelAdjustment(AgEStkGraphicsRasterBand.eStkGraphicsRasterBandGreen, -255);
image.ApplyInPlace((IAgStkGraphicsRasterFilter)levelsFilter);

IAgStkGraphicsRendererTexture2D texture = manager.Textures.FromRaster(image);

//
// Display the image using a screen overlay
//
IAgStkGraphicsTextureScreenOverlay overlay = manager.Initializers.TextureScreenOverlay.Initialize();
((IAgStkGraphicsOverlay)overlay).Width = 0.2;
((IAgStkGraphicsOverlay)overlay).WidthUnit = AgEStkGraphicsScreenOverlayUnit.eStkGraphicsScreenOverlayUnitFraction;
((IAgStkGraphicsOverlay)overlay).Height = 0.2;
((IAgStkGraphicsOverlay)overlay).HeightUnit = AgEStkGraphicsScreenOverlayUnit.eStkGraphicsScreenOverlayUnitFraction;
((IAgStkGraphicsOverlay)overlay).Origin = AgEStkGraphicsScreenOverlayOrigin.eStkGraphicsScreenOverlayOriginBottomRight;
overlay.Texture = texture;

overlayManager.Add((IAgStkGraphicsScreenOverlay)overlay);
Adjust the color levels of an image
[Visual Basic .NET]
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim overlayManager As IAgStkGraphicsScreenOverlayCollectionBase = DirectCast(manager.ScreenOverlays.Overlays, IAgStkGraphicsScreenOverlayCollectionBase)
'
' The URI can be a file path, http, https, or ftp location
'
Dim image As IAgStkGraphicsRaster = manager.Initializers.Raster.InitializeWithStringUri( _
    imageFile)

'
' Adjust the color levels of the image
'
Dim levelsFilter As IAgStkGraphicsLevelsFilter = manager.Initializers.LevelsFilter.Initialize()
levelsFilter.SetLevelAdjustment(AgEStkGraphicsRasterBand.eStkGraphicsRasterBandBlue, -255)
levelsFilter.SetLevelAdjustment(AgEStkGraphicsRasterBand.eStkGraphicsRasterBandGreen, -255)
image.ApplyInPlace(DirectCast(levelsFilter, IAgStkGraphicsRasterFilter))

Dim texture As IAgStkGraphicsRendererTexture2D = manager.Textures.FromRaster(image)

Dim overlay As IAgStkGraphicsTextureScreenOverlay = manager.Initializers.TextureScreenOverlay.Initialize()
DirectCast(overlay, IAgStkGraphicsOverlay).Width = 0.2
DirectCast(overlay, IAgStkGraphicsOverlay).WidthUnit = AgEStkGraphicsScreenOverlayUnit.eStkGraphicsScreenOverlayUnitFraction
DirectCast(overlay, IAgStkGraphicsOverlay).Height = 0.2
DirectCast(overlay, IAgStkGraphicsOverlay).HeightUnit = AgEStkGraphicsScreenOverlayUnit.eStkGraphicsScreenOverlayUnitFraction
overlay.Texture = texture
DirectCast(overlay, IAgStkGraphicsOverlay).Origin = AgEStkGraphicsScreenOverlayOrigin.eStkGraphicsScreenOverlayOriginBottomRight

overlayManager.Add(DirectCast(overlay, IAgStkGraphicsScreenOverlay))
© 2024 Analytical Graphics, Inc. All Rights Reserved.