AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.4k stars 291 forks source link

Canvas.DrawImage #784

Closed Shadowblitz16 closed 3 years ago

Shadowblitz16 commented 4 years ago

Summary

Please add the following for easy image drawing through the canvas... void Canvas.DrawImage(Rect dst, Rect src, Material material, float rotation, ColorRgba blend);

Analysis

This allows for high level image drawing. both rects would be in pixels

Pros

ilexp commented 3 years ago

Partially addressed in #878: There is now a high-level canvas.DrawImage method that provides a shortcut for quickly drawing a texture as-is, at a specified position.

The more complex operations that you mentioned can already be achieved by using existing Canvas API and would lead to an explosion in the number of required overloads when incorporated directly into DrawImage, so they're not part of the API for now. This could be added later on, if needed, but would require additional design consideration.

Closing this for now, to be potentially re-evaluated as needed.