Packaging application-specific glyphs in the skin file?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #42030
    Iruau
    Participant

      Ok, I finally figured out how to achieve that.

      1) Obviously, define a new section for a specific glyph
      2) Code (it's C++ but you Delphi people should have no problems to port it):

      CODE
      // imgList is a TsAlphaImageList
      imgList->AcBeginUpdate();
      imgList->Clear();
      imgList->Items->Clear();

      // For each glyph…
      std::auto_ptr bmp(sGraphUtils::CreateBmp32(imgList->Width,imgList->Height));
      sGraphUtils::PaintSection(bmp.get(),”MY_GLYPH_SECTION”,””,0,skinProvider->SkinData->SkinManager,TPoint(0,0),SomeColor);
      imgList->Add(bmp.get(),0);
      bmp.reset();

      imgList->AcEndUpdate();

      Maybe there is a more efficient way, but at least that works.

      #42128
      Support
      Keymaster

        Hello

        You can have directly access to Bitmap (if this image was contained in separated Bmp file).
        Here is a 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
            end;
          end;
        end;


        Maybe this way will be faster.

        #42133
        Iruau
        Participant

          Thanks Serge, I will try that.

          #42182
          Iruau
          Participant

            Hi,

            I'm still stuck on this. Your solution gives me a raw bitmap, so I have to recombine the alpha mask by myself which isn't quite satisfying. Moreover, it doesn't benefit from ASkin's capability to use borders (so that the glyph is extensible), textures and what not, which would be a really neat feature to add to the glyphs. Anyway I also need those features for other uses.

            And when it comes to my own solution that I already posted, it has a serious drawback : it *needs* a background color, but I want the resulting bitmap to have alpha transparency (ie. “background” color is transparent) which I can't achieve.

            In other words, I'm trying to find a way to do something as simple as CreateAlphaBitmap32OrPngFromSkin(skinManager, skinSection, state, sizeX, sizeY, destinationBitmap).

            Any ideas ?

            #42218
            Support
            Keymaster

              I'll make a small demo soon

              #42271
              Support
              Keymaster

                Hello
                Here is a demo, try it please.
                Options.dat changing is not required here. New way is much easier.

                #42273
                Iruau
                Participant

                  Thank you very much for the demo Serge, this is exactly what I need ! Perfect.

                  Have a nice day and keep up the good work.

                  #42274
                  Support
                  Keymaster

                    Topic was moved to Tricks <img src="style_emoticons//smile.gif” style=”vertical-align:middle” emoid=”:)” border=”0″ alt=”smile.gif” />

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