May I ask if "BitmapData. draw" and "BitmapData. copiPixels" are "CPU" or "GPU" operations?

May I ask if “BitmapData. draw” and “BitmapData. copiPixels” are “CPU” or “GPU” operations?

“BitmapData.draw”
“BitmapData.copyPixels”

Is it CPU or GPU operation?

Because I use “bitmap” and “BitmapData” to organize animations

And I hope to receive support for GPU

Some friends invited me to join the group chat, but I don’t have a “VPN” and I can’t get in. There have been several “network errors” and I can only continue posting and delivering the building

If you read the documentation here:

Essentially most BitmapData manipulation in both Lime and in OpenFL require manipulation of bytes data or similar. You can check the lime and openfl github files related to graphics and the internal ones. The advantage of Tilemap is can allow a single bitmap data to be used with rectangle information for batching quads, so the bitmapdata is only sent once when a render happens ( if you only use one bitmap with one tilemap in your program then it will only happen the first time ).
It is quite complex to follow the internals. The alternative is to look at stage3d where you can use a Texture based on a bitmapData or on bytes from images.

It maybe best to use stage3d with the starling library for instance see here:

I may not have covered all details but it should give you an overview. Lime does allow you to construct your own shaders much like OpenGL so you can also explore that route.
In general you should assume lots of BitmapData processing is done with a nested for loop iteration through the height and width. This is why in general using Tiles when speed is critical is advised as it is easier to minimize cpu.

There maybe details and exceptions I have not covered, but I did spend a few minutes looking though the current OpenFL and Lime repositories to see where pixels were being manipulated and in many instance for loops were manipulating the pixel data / colour channels, so in cases like clone etc.. Someone may drop in and add more detail on specific commands but just experiment with Tilemap. There used to be something called flump that exported swf data to tiles from flash I used to use flash everyday but have not touched it in nearly a decade so I can’t advise much on that now.

Rather than ask lots of questions, best to look thought the github of lime and openfl and do your own experiments, as likely you will learn a lot more than just getting a few answers to random questions.

1 Like

If using Starling, a RenderTexture can be used with a similar draw method to draw objects onto a Texture, as a GPU operation.

1 Like