4 Replies Latest reply on Mar 20, 2012 4:00 PM by fazstp

    8 Bit Color Fill Wrong paletteIndex

    fazstp

      I am having an issue with creating a mask on the fly in Director 11 on Windows.

       

      This is an abridged version of my routine just to highlight the problem;

       

      on Test me, v_width, v_height

       

        myMask = image( v_width, v_height, 8, #grayscale )

        myMask.fill( myMask.rect, [#shapeType: #roundRect, #color: color( 255, 255, 255 )] )

        put myMask.getPixel( 100, 100 )

       

      end Test

       

       

      Basically if I make an image of 127 x 127 it sets a paletteIndex of 0 as expected, if I go over that and create an image of 128 x 128 it sets a paletteIndex of 168. It seems to only happen with the #roundRect shape. Any thoughts or suggestions? Can other people confirm this as a bug?

        • 1. Re: 8 Bit Color Fill Wrong paletteIndex
          fazstp Level 2

          I can probably use a flood fill to correct the colour but I would still like to know if this is a bug or something I am doing wrong.

           

          on Test me, v_width, v_height

           

            myMask = image( v_width, v_height, 8, #grayscale )

            myMask.fill( myMask.rect, [#shapeType: #roundRect, #color: color( 255, 255, 255 )] )

            myMask.fill( point( v_width/ 2, v_height/ 2 ), color( 255, 255, 255 ) )


            put myMask.getPixel( 100, 100 )

           

          end Test

          • 2. Re: 8 Bit Color Fill Wrong paletteIndex
            fazstp Level 2

            Seems to affect #roundRect and #oval shapeType but not #rect and not if at least one dimension is under 128 pixels.

            • 3. Re: 8 Bit Color Fill Wrong paletteIndex
              josh_chunick

              Are you using Director 11 or 11.5?... sorry, if you're using D11, because it's just buggy like that.

               

              Try using a vectorshape instead and take the image of the vectorshape.... I have functions that'll create all sorts of shapes using vectorshapes, which can be found here: http://www.mediamacros.com/item/item-1006687738/ - check out the dropdown list for the 13 other vectorshape functions toward the bottom.

               

              so it might look something like this:

              vertList = createRectangle(320, 240, 12)

              m = new(#vectorshape)

              m.vertexList = vertList

              m.strokeWidth = 0

              m.closed = true

              m.fillMode = #solid

              m.fillColor = color(255,255,255)

              mask = m.image.duplicate()

              img = image(320,240,8,#grayscale)

              img.floodfill(point(0,0), color(0,0,0))

              img.copyPixels(mask, img.rect, mask.rect)

              newMask = new(#bitmap)

              newMask.image = img.duplicate()

              -- then you can do what you need to from here.

              • 4. Re: 8 Bit Color Fill Wrong paletteIndex
                fazstp Level 2

                Thanks Josh. I am using Director 11.5

                 

                To get around the issue I am creating the image at 32 bits and copying it to the 8 bit version.