Jump to content

rendering bitmapData


L2L2L
 Share

Recommended Posts

I'm trying to render a bitmap data multiple times. the code is very simple. I just do what I have to with the ctx property of the bitmap, this works when I just game.add[sprite|image](0,0,bitmapData); but is slow.

 

I try to use sprite.setTexture(bitmapData); or image.setTexture(bitmapData); but does not work.

Link to comment
Share on other sites

This is the recommended way to use a single bitmapData across many sprites: http://examples.phaser.io/_site/view_full.html?d=bitmapdata&f=cached+bitmapdata.js&t=cached%20bitmapdata

 

You could use loadTexture too, but it should only be done once, when the sprite is created. After that you just update the bitmapData itself and flag it as dirty.

Link to comment
Share on other sites

thanks for responding, and the help. It work,,, but the dynamic created graphic that I will use from bitmapData is not rendering right. This graphic is a imageData that is create through canvas 2d render's methods. Do you have any suggestion for that.

 

What I'm doing:

 

1. Creating dynamic graphic with the bitmapData using it's property context.

2. take the image data off that canvas and altering the pixels

3. rendering the result to canvas through sprite aka display object.

 

the result is blur... if that help.

 

Thanks again for the help.

Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

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...