My objective is to color a rectangle shape in winRT.When the brush leaves rectangle border the coloring should stop.So after coloring I need a fill colored rectangle.
Any help will be really appreciated.
Thanks in advance.
You can use the Clip property to clip any element to a rectangle shape. Note though that right now it only support rectangle clips and for more you would need to use Direct2D or process all the pixels yourself.
Related
I am drawing a coloured circle within an NSView that is contained in an NSMenuItem. When I do so, the circle is drawn in a darker colour to the one I specify and when I add a subview with no drawing code, the area occupied by that view is drawn in the true colour, as illustrated by the image. Could someone explain to me why this is happening and how to fix it?
Many Thanks, Ben.
Is it possible in any way to create box-shadows around a transparent image? For example, a logo has many corners and i want the shadow to be drawn around these corners. When I add some box-shadow, it will draw rect-shaped shadows.
Thanks
It is possible. Click here for more information, an explanation and a demo:
http://demosthenes.info/blog/600/Creating-a-True-Cross-Browser-Drop-Shadow-Effect-With-CSS3-amp-SVG
Unfortunately, box-shadow can generate shadow only around the box of the element, which is always rectangular. There is CSS filter property that can generate shadows around non-transparent areas of the image (see http://demosthenes.info/blog/598/boxshadow-property-vs-dropshadow-filter-a-complete-comparison), but its browser support is still limited.
I have a number of square regions in my game screen which, when actors move across these regions, I want the background image to show through from behind.
So, is it possible to draw to a SpriteBatch such that a region is subtracted/deleted from the texture (effectively "punching a hole" in it)?
I can't think how else to achieve this... Scissors seem incredibly impractical for my purpose, as I want to clip the areas INSIDE a number of squares. This is the inverse of Scissors - which clip areas OUTSIDE the scissors' bounds. The thought of calculating dozens of Scissor regions to fill the inverse areas between an assortment of square regions seems too impractical to be the solution... especially if the regions are moving.
Any help or suggestions appreciated!
UPDATE: Image attached.
I want the background to always be visible in the areas marked with the dotted lines. The dotted areas will move, so I'd rather not create more sprites from the background to lay on top, but rather have parts of the actors intersecting the dotted squares not be drawn. (Or any method that will achieve the same effect.)
I think the best hack is to not try and be so precise about clipping your actors, but to just re-draw the background on top the actors (and to clip that).
Specifically:
draw the whole background
draw your actors/sprites
draw the background with one cliprect for one part that "shows through"
draw the background with another cliprect for the other part that "shows through"
draw the dotted boxes around your cliprect areas
Great image, by the way. Easily worth 1000 words. :)
How to add border on an irregular polygon in flash with perspective?
I have a Movieclip which let the user draw a surface and then apply a bitmap to fill in. I want the clip should be applied as a floor tile and then apply a custom border to the sprite which also has the same perspective as the floor?
Thanks in advance.
When you use Graphics.drawTriangles() and Graphics.beginBitmapFill() to draw two triangles to create a rectangle face, when the face is not square or rectangle, but rather a trapezoid, or an irregular shape, the bitmap used to fill the face is distorted. In order to correct the distortion, Papervision3D has a Boolean property precise. But how does it work?
Thanks! :)