Announcement

Collapse
No announcement yet.

what does gfx transparency do

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • what does gfx transparency do

    I tried the following and the line is displayed...

    gfx_Cls[FF82 ] 0.023 (ACK)
    gfx_BGcolour[FF48 4416] 0.001 (ACK 0 0x0000)
    gfx_Cls[FF82 ] 0.023 (ACK)
    gfx_Transparency[FF44 0001] 0.001 (ACK 0 0x0000)
    gfx_TransparentColour[FF45 3D8E] 0.001 (ACK 0 0x0000)
    gfx_Line[FF7D 0000 0000 0028 0028 3D8E] 0.002 (ACK)

  • #2
    even stranger, if I perform the following...

    gfx_ScreenMode[FF42 0002] 0.001 (ACK 2 0x0002)
    gfx_Cls[FF82 ] 0.023 (ACK)
    gfx_TransparentColour[FF45 FFFF] 0.001 (ACK 0 0x0000)
    gfx_Transparency[FF44 0001] 0.001 (ACK 0 0x0000)
    file_Mount[FE3C ] 0.100 (ACK 16375 0x3FF7)
    file_Open[000A "splash.gci" 'r'] 0.006 (ACK 16090 0x3EDA)
    file_Image[FE4A 0000 0000 3EDA] 0.102 (ACK 0 0x0000)

    the effect is that any pixels with the transparency color (0xffff) are stripped from the image and the whole image is sheared.
    I would have expected it to replace the transparent pixels with the background color

    Comment


    • #3
      gfx_TransparentColour() and gfx_Transparency() only apply to images and image controls.

      As for the shearing, are you saying that the shearing does not occur until you use transparency? (I suspect your image is too large for the screen and will always shear)

      If that is not the problem please zip up and attache the GCI as we cannot see that particular behavior here
      Mark

      Comment


      • #4
        dead easy to reproduce. - produce a bitmap with two colors and play with the transparency and image, here is one I used... expt-png-gci.zi
        ​And yes displaying the bitmap without transparency works fine, but setting the transparency color to one of the image colors those pixels are removed and the image is distorted and shortened,
        Attached Files
        Last edited by Peter Kenyon; 11th February 2016, 03:56 PM.

        Comment


        • #5
          What display are you using?

          What are versions of the PmmC and Driver?

          Is that the entire Serial Commander log, or are there some previous commands?
          Mark

          Comment


          • #6
            43DT, SPE2 1.1 Pmmc 1.7.
            I have a customised ulcd-43dt.inc to display a boot message,
            var h;

            // set screen into portrait mode
            gfx_ScreenMode(2);

            // mount file system
            file_Mount();
            // start playing
            snd_Volume(127);
            file_PlayWAV("chimes.wav");
            // load and display splash screen
            h := file_LoadImageControl("splash.dat", "splash.gci", 0);
            img_Show(h, 0);
            mem_Free(h);

            //file_Open("noname2.gci", "r");
            //file_Image(0,0, h);
            //file_Close(h);
            //print("Handle: ", h);
            //file_Image(0, 0, h);
            //file_Unmount();
            // nb need to wait for wav to finish
            //gfx_RectangleFilled(0,0,272-1,480-1, gfx_RGBto565(255,255,255));
            //txt_FontID(4) ;
            //txt_Opacity(TRANSPARENT);
            //txt_MoveCursor(1, 4);
            //txt_Height(3);
            //txt_BGcolour(BLUE);
            //txt_FGcolour(WHITE);
            //putch(' '); putch('e'); putch('g');
            //txt_BGcolour(WHITE);
            //txt_FGcolour(BLUE);
            //print("technology");
            //txt_Width(3);
            //putstr("eg technology UCD 2016") ;

            // display messages
            //txt_FontID(FONT2) ;
            txt_FontID(3);
            txt_FGcolour(WHITE);
            txt_Opacity(TRANSPARENT);

            txt_MoveCursor(4, 0);
            print("eg technology 2016.");
            txt_MoveCursor(5, 0);
            print("Bootloader version 1.0");
            txt_MoveCursor(6, 0);
            print("SPE2 rev ", version >> 8, ".", version & 0x0F);
            txt_MoveCursor(7, 0);
            print("PmmC rev ", pmmcversion >> 8, ".", pmmcversion & 0x0F);
            txt_MoveCursor(8, 0);
            print("Comms >?SerialBaud?<") ;

            pause(2000);
            file_Unmount();

            txt_MoveCursor(10, 0) ;
            print("Please wait....");

            gfx_Contrast(1);
            //gfx_Panel(0, 105, 205, 275, 67, DARKGRAY);
            //txt_Opacity(TRANSPARENT);
            //txt_MoveCursor(18, 17);
            //txt_FGcolour(DARKBLUE);
            //putstr(" Getting Started:") ;

            //txt_MoveCursor(19, 14);
            //putstr(" Please refer to the Quick Start\n Guide on the uLCD-43DT Product\nPage from the 4D Systems Website.") ;

            txt_FontID(FONT3) ; // reset everything we changed
            txt_FGcolour(LIME);
            txt_MoveCursor(0, 0);


            Comment


            • #7
              AHA, I replace the original and now the anomaly has gone away, so its something in my custom ulcd-43dt.inc file that is leaving the EVE in a strange state ?
              I don't see anything too strange so its over to you guys.
              Actually a relief coz I couldn't believe what I was seeing

              Comment


              • #8
                I wonder if its
                txt_Opacity(TRANSPARENT);
                Try reversing that at the end of your inc file (i.e. make it OPAQUE)

                I'll test in the morning
                Mark

                Comment


                • #9
                  I'm playing with the file now, so ill post if that works - thanks for your help.
                  Last edited by Peter Kenyon; 11th February 2016, 05:58 PM.

                  Comment


                  • #10
                    OK its not the txt_Opacity, but the LoadImageControl and image_Show.
                    I have replaced with file_Open and file_Image and everthings OK

                    Comment


                    • #11
                      I changed my startup script to this and everything works....

                      var h;
                      gfx_ScreenMode(2);

                      file_Mount();

                      snd_Volume(127);
                      file_PlayWAV("chimes.wav");

                      h := file_Open("splash.gci", 'r');
                      file_Image(0, 0, h);
                      file_Close(h);
                      // doing this leaves the EVE? in a strange state wrt gfx_Transparency
                      //h := file_LoadImageControl("splash.dat", "splash.gci", 0);
                      //img_Show(h, 0);
                      //mem_Free(h);

                      txt_FontID(3);
                      txt_FGcolour(WHITE);
                      txt_Opacity(TRANSPARENT);

                      txt_MoveCursor(4, 0);
                      print("Bootloader version 1.0");
                      txt_MoveCursor(5, 0);
                      print("eg technology 2016.");
                      txt_MoveCursor(7, 0);
                      print("SPE2 rev ", version >> 8, ".", version & 0x0F);
                      txt_MoveCursor(8, 0);
                      print("PmmC rev ", pmmcversion >> 8, ".", pmmcversion & 0x0F);
                      txt_MoveCursor(9, 0);
                      print("Comms >?SerialBaud?<");

                      txt_MoveCursor(11, 0);
                      print("Initialising...") ;

                      while (snd_Playing() > 0)
                      wend
                      //pause(2000);
                      file_Unmount();

                      // reset everything we changed
                      txt_FontID(FONT3);
                      txt_FGcolour(LIME);
                      txt_MoveCursor(0, 0);

                      Comment


                      • #12
                        Thanks,

                        It stuffs up when an img_show() type image 'display' is followed by a file_image() type 'display'.

                        Any other combination seems to be ok.

                        Most people seem to consistently use one or the other, which probably explains why we haven't seen this before.

                        We will get it investigated and fixed.
                        Mark

                        Comment


                        • #13
                          No problem.
                          ​btw I hacked some C# code to convert a png into a gci file... I know the designer can do it but I wanted a command line option

                          using System;
                          using System.Collections.Generic;
                          using System.Linq;
                          using System.Text;
                          using System.Threading.Tasks;
                          using System.Drawing;
                          using System.Drawing.Imaging;
                          using System.IO;

                          namespace ConsoleApplication2
                          {
                          class Program
                          {
                          static void Main(string[] args)
                          {
                          // open bitmap file
                          Bitmap bmp = new Bitmap("blank.png");

                          //bmp.
                          using (BinaryWriter writer = new BinaryWriter(File.Open("blank.rgb565", FileMode.OpenOrCreate)))
                          {
                          // for gci format we require

                          // write two bytes for x be
                          writer.Write((byte)(bmp.Width / 256));
                          writer.Write((byte)(bmp.Width & 0xff));

                          // write two bytes for y
                          writer.Write((byte)(bmp.Height / 256));
                          writer.Write((byte)(bmp.Height & 0xff));

                          // write format
                          writer.Write((ushort)0x0010);

                          for (int y = 0; y < bmp.Height; y++)
                          {
                          for (int x = 0; x < bmp.Width; x++)
                          {
                          Color c = bmp.GetPixel(x, y);

                          // convert to 16 bit 565 format
                          int pixel = ((c.R >> 3) << 11) | ((c.G >> 2) << 5) | (c.B >> 3);
                          byte h = (byte)(pixel >> 8);
                          byte l = (byte)(pixel & 0xff);
                          // is this the right way round - for paint.net
                          //writer.Write(l);
                          // for gci files we do this
                          writer.Write(h);
                          writer.Write(l);
                          }
                          }

                          // q do we need to pad to sector size ??
                          }
                          }

                          }
                          }

                          Comment


                          • #14
                            > // q do we need to pad to sector size ??
                            Yes, every image should be aligned to the next sector multiple, of course for a single image file this isn't needed, so the padding isn't strictly needed as there is no 'next file'.
                            Mark

                            Comment

                            Working...
                            X