ImageGear .NET v25.2 - Updated
ImageGear.Processing.Advanced Assembly / ImageGear.Processing Namespace / ImGearEffects Class / Mosaic Method
Page class object.
Fill parameters for mosaic operation. See ImGearMosaicFillParams description.
Parameters of the cell for mosaic operation. See ImGearMosaicCellParams description.
Parameters of cell borders. See ImGearMosaicBorderParams description.
Parameters of the shadow effect. See ImGearMosaicShadowParams description.
Example




In This Topic
    Mosaic Method
    In This Topic
    This method provides 3D mosaic effect on an image.
    Syntax

    Parameters

    page
    Page class object.
    fillParameters
    Fill parameters for mosaic operation. See ImGearMosaicFillParams description.
    cellParameters
    Parameters of the cell for mosaic operation. See ImGearMosaicCellParams description.
    borderParameters
    Parameters of cell borders. See ImGearMosaicBorderParams description.
    shadowParameters
    Parameters of the shadow effect. See ImGearMosaicShadowParams description.
    Remarks
    This method provides a 3D mosaic effect on an image.
    Example
    // Applies a mosaic effect to an image.
    
    // Parameter classes for Mosaic method.
    ImGearMosaicFillParams igMosaicFillParams = new ImGearMosaicFillParams();
    ImGearMosaicCellParams igMosaicCellParams = new ImGearMosaicCellParams();
    ImGearMosaicBorderParams igMosaicBorderParams = new ImGearMosaicBorderParams();
    ImGearMosaicShadowParams igMosaicShadowParams = new ImGearMosaicShadowParams();
    
    //Color for fill and border.
    ImGearPixel igPixel = new ImGearPixel(igRasterPage.DIB.ChannelCount, igRasterPage.DIB.BitsPerChannel);
    //Set the color to a dark gray based on the bits per channel.
    for (int i = 0; i < igPixel.ChannelCount; ++i)
        igPixel[i] = (int)Math.Pow(2, igRasterPage.DIB.BitsPerChannel) / 4;
    
    // Cell parameters
    igMosaicCellParams.Type = ImGearMosaicType.Cartesian;
    igMosaicCellParams.Width = 32;
    igMosaicCellParams.Height = 32;
    igMosaicCellParams.PolarCenterX = 100;
    igMosaicCellParams.PolarCenterY = 100;
    // Fill parameters
    igMosaicFillParams.Color = igPixel;
    igMosaicFillParams.Opacity = (float)0.20;
    // Border parameters
    igMosaicBorderParams.Width = 0;
    igMosaicBorderParams.Height = 0;
    igMosaicBorderParams.Color = igPixel;
    igMosaicBorderParams.Opacity = (float)0.30;
    igMosaicBorderParams.Irregularity = 0;
    // Shadow Parameters
    igMosaicShadowParams.Enabled = true;
    igMosaicShadowParams.Threshold = 0;
    igMosaicShadowParams.Direction = ImGearDirection.SouthEast;
    igMosaicShadowParams.HighResolution = false;
    igMosaicShadowParams.Intensity = (float)1.0;
    
    ImGearEffects.Mosaic(igRasterPage,
        igMosaicFillParams,
        igMosaicCellParams,
        igMosaicBorderParams,
        igMosaicShadowParams);
    ' Applies a mosaic effect to an image.
    
         ' Parameter classes for Mosaic function.
         Dim igMosaicFillParams As New ImGearMosaicFillParams()
         Dim igMosaicCellParams As New ImGearMosaicCellParams()
         Dim igMosaicBorderParams As New ImGearMosaicBorderParams()
         Dim igMosaicShadowParams As New ImGearMosaicShadowParams()
    
         'Color for fill and border.
         Dim igPixel As New ImGearPixel(igRasterPage.DIB.ChannelCount, igRasterPage.DIB.BitsPerChannel)
         For i As Integer = 0 To igPixel.ChannelCount - 1
             igPixel(i) = CInt(Math.Pow(2, igRasterPage.DIB.BitsPerChannel)) / 4
         Next
         'Set the color to a dark gray based on the bits per channel.
    
         ' Cell parameters
         igMosaicCellParams.Type = ImGearMosaicType.Cartesian
         igMosaicCellParams.Width = 32
         igMosaicCellParams.Height = 32
         igMosaicCellParams.PolarCenterX = 100
         igMosaicCellParams.PolarCenterY = 100
         ' Fill parameters
         igMosaicFillParams.Color = igPixel
         igMosaicFillParams.Opacity = CSng(0.2)
         ' Border parameters
         igMosaicBorderParams.Width = 0
         igMosaicBorderParams.Height = 0
         igMosaicBorderParams.Color = igPixel
         igMosaicBorderParams.Opacity = CSng(0.3)
         igMosaicBorderParams.Irregularity = 0
         ' Shadow Parameters
         igMosaicShadowParams.Enabled = True
         igMosaicShadowParams.Threshold = 0
         igMosaicShadowParams.Direction = ImGearDirection.SouthEast
         igMosaicShadowParams.HighResolution = False
         igMosaicShadowParams.Intensity = CSng(1)
    
         ImGearEffects.Mosaic(igRasterPage, igMosaicFillParams, _
    igMosaicCellParams, igMosaicBorderParams, igMosaicShadowParams)
    See Also