Jump to content

Colorize complex shape


Laura
 Share

Recommended Posts

Hello!

I am developing an application with Angular and PIXI JS which generates bitmap fonts using bezier curves. The curves represent the outlines of my letter and supposing I am drawing the letter O as seen in the image I attached (it is not a stylish drawing, but you get the point), I would like to fill in with colour the interior of my drawing - the letter itself.

I have not found away to do it. I have tried to create a texture from my graphics and then a sprite from the texture, then adding a tint to the sprite, as follows:

const bezierTexture = renderer.generateTexture(this._splineGraphics); // convert shape to texture
const sprite = new PIXI.Sprite(bezierTexture);
this._stage.addChild(sprite);
sprite.texture = PIXI.Texture.WHITE;
sprite.tint = 0xFF0000;
sprite.width = this._width;
sprite.height = this._height;

However, this is tinting my entire canvas.

Thank you,

Laura

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...