How to add AlphaHints using ImgData ?

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #70629
    Koushik Halder
    Participant

    I have coded to add the AlphaHints on FormCreation using MemoryStream. To do this I have copied ImgData from my DFM File to MemoryStream and tried to load my custom Procedure as LoadAlphaHintsData. I am getting error as Argument out of range. What is the solution?

    I this regard, I have another question that what is the code to activate sAlphaHints1.Templates[1] by coding?

    Attachments:
    You must be logged in to view attached files.
    #70632
    Support
    Keymaster

    Thanks for the demo.
    You should add new item before properties defining, like this:

    sAlphaHints1.Templates.Add;

    But I’m not sure your AText parameter has the correct image format.
    Maybe you can store it in the TsAlphaImageLsit and load it in the run-time?
    Or load from external file?

    #70636
    Koushik Halder
    Participant

    I am hundred percent sure AText parameter has the correct image format. I can create TsAlphaImageLsitusing AText parameter. Please see there is something more.

    #70638
    Koushik Halder
    Participant

    Using the same piece of code I can add sImage1.Picture and sBitBtn1.Glyph so why I am unable to load sAlphaHints1.Image?
    As per you suggestion I have added sAlphaHints1.Templates.Add;, no my Argument out of range is gone but new error has come as Cannot load image. Invalid or unexpected PNG image format.. So I thinks it can be done with some little bit of modification. So you are requested to help me to modify my LoadAlphaHintsData.
    Another thing is that when I am defining a variable as AacHintImage: TacHintImage; and trying to use AsAlphaHints.Templates[TemplatesIndex].AacHintImage.LoadFromStream(LData); instead of AsAlphaHints.Templates[TemplatesIndex].ImageDefault.LoadFromStream(LData);, I a am getting error at AacHintImage as Undeclared identifier. What is the correct way?

    FYI : I don’t like to load sAlphaHints1.Image from TsAlphaImageLsit or from from external file run-time.

    I have updated my project. Please see details.

    Attachments:
    You must be logged in to view attached files.
    #70651
    Support
    Keymaster

    I need to know what you want to do, then I can suggest a best way.
    I’m not sure that copying of binary data from Dfm is good idea.

    Type of ImageDefault is TacHintImage.
    It’s not the image, this is an object including an image and some other information (look the TacHintImage type in the acAlphaHints.pas unit).

    #70663
    Koushik Halder
    Participant

    My requirement is very simple. I don’t like to allow me like simple user to extract my own sAlphaHintsTemplate using PE Editors like PE Explorer, Resource Tuner and Resource Hacker etc. So I have decided not store any Binary Data to my PE. I will load Binary Data into Memory Stream then I will call it at Runtime. So I need to create to create sAlphaHintsTemplate from Memory Stream using Binary Data. So what is the solution of conversion?

    #70674
    Support
    Keymaster

    The ImageDefault.Image property should have Png format for loading.
    In the new release I will add support of Bitmaps also (at the nearest days).
    Will be possible using of such code:
    LoadGlyphData(sAlphaHints1.Templates[0].ImageDefault.Image, 'B6430000424DB6430000000000003600000028000000480000003C....

    #70676
    Koushik Halder
    Participant

    The above solution is not working. I am getting error as Cannot load image. Invalid or unexpected PNG image format.

    #70680
    Support
    Keymaster

    Sorry, you are right, I have added some changes in the package and this Image can load bitmaps on my side.
    Your package can load Png only there. Please, wait new release at the nearest days.

    #70685
    Koushik Halder
    Participant

    No! No! I don’t have no problem with PNG Image. Please modify my project to load PNG image.

    #70686
    Support
    Keymaster

    You just need have Png there as a text parameter, pass it in the my demo instead of bitmap text.

    #70687
    Support
    Keymaster

    Look the new demo with Png

    Attachments:
    You must be logged in to view attached files.
    #70689
    Koushik Halder
    Participant

    I have a checked you demo. I have not found PNG Data. I have tried to add Image Data from to code to Image1: TImage; in DFM File but no image is shown in Image1: TImage;. Please see the case again. I need to load real PNG Data which is available in DFM File.

    #70695
    Support
    Keymaster

    Binary data is Png there, but you can try bitmap also with v16.22 released today.

    #70703
    Koushik Halder
    Participant

    Thanks a lot. Now it is working flawlessly. I have checked using Frame also and working properly.

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