Accessing to a skin section properties and options at run time

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #38102
    Saeidd2016
    Participant

    Hello,

    Is it possible to access to properties and options of a skin section at run time? For example:

    1. Get the normal state color or gradient or texture of a section.

    2. Get the border image of a section.

    #58861
    Support
    Keymaster

    Hello

    Quote:
    1. Get the normal state color or gradient or texture of a section.

    Look these several links, they should help, I think:

    http://www.alphaskin…ndtip.php?num=8

    http://www.alphaskin…dtip.php?num=14

    http://www.alphaskin…dtip.php?num=21

    Colors may be changed easily, but changing of gradient or texture a more complex. You should know a format of gradient for creating own gradient data

    Quote:
    2. Get the border image of a section.

    Look this example of code

    Code:
    const
    SectionName = 'SectionName';
    var
    SkinIndex, ImgIndex : integer;
    begin
    SkinIndex := sSkinManager1.GetSkinIndex(SectionName);
    if sSkinManager1.IsValidSkinIndex(SkinIndex) then begin
    ImgIndex := sSkinManager1.GetMaskIndex(SectionName, 'BORDERSMASK');
    if sSkinManager1.IsValidImgIndex(ImgIndex) then begin
    sSkinManager1.ma[ImgIndex].Bmp <- This a the image
    sSkinManager1.ma[ImgIndex].R <- Rectangle of the image
    end;
    end;
    end;

    If you need just draw the border then more easy ways exists (like DrawSkinRect or DrawSkinRect32 procedures).

    You can specify what you need to do, I can help better then, I think.

    #58862
    Saeidd2016
    Participant
    'Support' wrote:

    You can specify what you need to do, I can help better then, I think.

    Thank you for early reply.

    I don't want to change any options of sections at run time. But I want two things:

    1. Setting of common colors and options of sections from Master.png (like colors, border, text color , etc).

    For example about section EDIT I want to set the normal state color from Master.png instead of setting it from color picker. so I've drawn a rectangle in Master.png width wanted color and I set the normal state texture with that rectangle.

    2. Getting some options of sections at run time to use them in other third party components like VirtualTreeView, DBGridEh, etc.

    For example I want to set the VirtualTreeView colors from my own sections at run time (such as background color, selection color , etc). So I need accessing to my own section color that given it as texture.

    Another example: I have created a section and set it border image from Master.png . At run time I want to access to that image and save it in temp folder and then add it to a AlphaImageList and use it for VirtualTreeView node images.

    Another example: Now if we want to use icons for buttons (TsButton, TsBitBtn, TsSpeedButton) we add all icons to a AlphaImageList and set the images property of buttons to it. But I have created a section for each button that I have in project and set it's icon from Master.png in BorderImage.

    The advantage of this idea is that by replacing the Master.png with another one, all common colors and all options of skin sections and all Icons used for components such as buttons, edits, third party, etc will be change without any changes in ImageLists, colors, etc.

    Please add this ability to set colors (all common colors and own colors for each skin section) from Master.png like textures.

    Excuse me for bad English.

    #58869
    Support
    Keymaster

    Ok, look this link: http://www.alphaskin…ndtip.php?num=8

    There you can see how to receive an access to the array of properties for any skin section.

    'GD' is an array of TsGeneralData records, where properties of sections are stored.

    Here is a declaration of this record:

    Code:
    TsGeneralData = record
    ParentClass, // Name of parent skin section (if exists)
    ClassName: string; // Name of skin section
    Props: TsProps; // Array of properties for different control states

    UseState2,
    GiveOwnFont, // Gives own font color for transparent child
    ShiftOnClick,
    ReservedBoolean: boolean; // Reserved

    States, // Count of defined control states
    ScrollBorderOffset, // Internal value which used for calculation of border width
    // Text Glow
    GlowCount, // Reserved
    GlowMargin, // Margin for glowing effect
    GlowSize,
    HotGlowSize,
    // Initialized values
    BorderIndex, // Index of border mask
    ImgTL, // Indexes
    ImgTR, // of
    ImgBL, // corner
    ImgBR: integer; // images

    HotGlowColor,
    GlowColor: TColor;

    // Outer effect
    OuterMode,
    OuterMask,
    OuterOpacity: integer;
    OuterOffset: TRect;

    OuterBlur,
    OuterRadius: integer;
    OuterColorL,
    OuterColorT,
    OuterColorR,
    OuterColorB: TColor;
    end;

    “Props: TsProps” is an array of TsGenState (drawing properties for different state of the section):

    Code:
    TsGenState = record
    GlowSize, // Size of text glowing
    ImagePercent, // Percent of texture in BG
    TextureIndex,
    Transparency, // Transparency of control
    GradientPercent: integer; // Percent of gradient in BG
    Color, // Color of background
    GlowColor: TColor; // Color of text glowing
    FontColor: TsFontColor; // Text color structure
    GradientArray: TsGradArray;
    end;

    Also, common colors of the current skin are accessible in the TsSkinManager.Palette array:

    Code:
    sSkinManager1.Palette[pcSelectionBG] := clRed; // Normal selection color
    sSkinManager1.Palette[pcSelectionBG_Focused] := clMaroon; // Focused selection color
    sSkinManager1.Palette[pcBorder] and others
    #58873
    Saeidd2016
    Participant

    Thanks a lot,

    What is the TextureIndex? How can I access to the section texture and get it's color? (I have set the color of state as texture)

    Is it possible to add an ability to set common colors or state colors from Master.png like textures?

    #58874
    Support
    Keymaster
    'Saeidd2016' wrote:
    What is the TextureIndex? How can I access to the section texture and get it's color? (I have set the color of state as texture)

    This is an index of texture in the array of available images. This array may be received like this:

    Code:
    sSkinManager1.CommonSkinData().ma[]

    Structure of image data from “ma” array:

    Code:
    TsMaskData = record
    Bmp: TBitmap;

    ClassName,
    PropertyName: string;

    R: TRect; // Rectangle of the image piece in MasterBitmap

    ImageCount, // Count of States, allowed for control (count of images in piece)
    MaskType, // Type of used mask (0 – not used, 1 – AlphaMask, 2… – reserved)
    DrawMode: smallint; // Fill type if ImgType is texture (0-tiled, 1-stretched, 2-tiled horizontal top, 3-tiled vertical left, 4-stretched horizontal top,
    // 5-stretched vertical left, 6-tiled hor. bottom, 7-tiled vert. right, 8-stretched hor. bottom, 9-stretched vert. right, A-discrete tiled,
    // B-stretch horz, C-stretch vert) (BDM_ACTIVEONLY used in borders)

    ImgType: TacImgType; // itisaBorder, itisaTexture, itisaGlyph //, itisanOldType (default)
    Manager: TObject;

    WL, // Border width / Left
    WT, // Top
    WR, // Right
    WB: smallint; // Bottom

    Cfg, // 1 – has transparent pixels, 2 – control region must be changed, 4 – external
    MulPPi,
    DivPPI,
    SkinIndex,
    Width,
    Height: integer;
    end;

    Quote:
    Is it possible to add an ability to set common colors or state colors from Master.png like textures?

    Do you mean a receiving of pixels from Master.png? I think, it's not a good idea, because there stored not finish images of the control.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.