Announcement

Collapse
No announcement yet.

Image transparency

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

  • Image transparency

    Hi, so I have been playing with image transparency and it is working as I'd expect except for the fact that gfx_Set(TRANSPARENCY, ON) seems to refresh the entire screen and replace any areas of the specified transparency color with the background pixels.

    This is not exactly ideal, my hope was that the command would only enable transparency so that subsequent img_Show would result in that specific image being displayed with transparency. It also seems attempting to call gfx_Set(TRANSPARENCY, OFF) will refresh the screen so that no images have transparency. Is there any resolution for this so that just a single image may have transparency (besides using some random color in the image not used by any others) or is there a planned update for future releases?

    Thanks,
    Michael

  • #2


    Hi Michael,
    I'm presuming your using an image control.You raise a good point, currently, if you wish to use transparency with an image control, it will be necessary to disable the image from the image control group, and refresh it separately, enabling / disabling transparency and image manually. A good idea would be a future addition of PmmC to incorporate one of the spare bits in the IMAGE_FLAGS to control transparency for image controls.
    Regards,
    Dave

    Comment


    • #3


      I'm having a similar issue with the transparency but slightly different.
      I'm on a OLED 32028 with pmmc r22 if I'm right.

      I have a movie composed of 630 frames that I have to access individually. It's not a movie per say but a sequence of frame. It's stored on a RAW partition of the uSD.

      I display the frame this way

      HTML Code:
      DrawSprite();
      gfx_Set(TRANSPARENT_COLOUR, WHITE);
      gfx_Set(TRANSPARENCY,1);
      media_VideoFrame(0,0,MovieFrame);
      gfx_Set(TRANSPARENCY,0);
      
      MovieFrame++;
      ProgressIndex++;
      if(MovieFrame >= (MovieBaseFrame + FrameNumber))
      ProcessProgress := 0;
      endif
      the drawsprite is just a gfx_bullet of radius 10 in the middle of the picture.
      If the transparency color is set to black, my background picture (the movie frame) is indeed refreshing everything EXCEPT the black. But it I turn the transparency to WHITE (or to the color of the sprite I'm drawing), it's wiped anyway when the frame refreshes.

      what am I doing wrong ? why is it ok with black and not with other colors ?

      thanks
      irvin

      Comment


      • #4


        I think I got the transparency logic wrong, but this leads me to another question.

        What I was trying to do was avoiding the *background* to be re drawn when of a certain color. Obviously, there's no frame memory so I don't think it's possible : transparency applies only to the new picture / shape being drawn.

        Am I correct ?

        anyhow : do you see a solution for having a shape or image of a single color on the background (a bullet / spot) that will stay what ever you apply on top of it ?

        my other solution would be to have a negative/inverted logic for the clipping box redraw outside of the box). However, that would require in my case to define a circle of exclusion.
        Would it be possible in a future release ? I mean, coding a in?out routine for a circle is easy, so I though I'd ask.

        thanks
        Irvin

        Comment


        • #5


          Hi meldalvia, I don't think you understand or perhaps I misunderstand you. From what I can tell, gfx_Set(TRANSPARENCY, ON) will cause a refresh of whatever images are on screen to be re-displayed with transparency. Calling gfx_Set(TRANSPARENCY, OFF) will cause a refresh disabling transparency for all images on screen.

          This makes it afaik impossible to have multiple images on screen with only one having transparency enabled. Please let me know if i am incorrect?

          Comment


          • #6


            The function gfx_Set(TRANSPARENCY, x); or the shortcut gfx_Transparency(x) simply sets or clears a flag internally to signal the behaviour of the next draw to a GRAM area - so in essence, if you are using an image control, and you eg:- use img_Show(j, ALL); - all of the images will be redrawn with the current transparency setting because img_Show(j, ALL) will block until all images are redrawn. If you need to control transparency of individual images you would need to loop through the images setting or clearing transparency as required. It would be possible to utilize IMAGE_TAG or IMAGE_TAG2 (image control user variables)
            for this purpose. These are intended to hold function vectors for event driven touch applications, but can be used for any purpose.
            Regards,
            Dave

            Comment


            • #7


              thanks for clarifying. Any hint about my own request on transparency (see above) ? thanks.

              Comment

              Working...
              X