-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added BitmapBrush #119
Added BitmapBrush #119
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great though @jingwood should sign off.
Would be amazing if you could add an example of using this to one of the demo apps.
/// | ||
/// Extend the edges of the source out by clamping sample points outside the source | ||
/// to the edges. | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using <summary>
will allow these docs to appear in IDE tooling etc.
/// | |
/// Extend the edges of the source out by clamping sample points outside the source | |
/// to the edges. | |
/// | |
/// <summary> | |
/// Extend the edges of the source out by clamping sample points outside the source | |
/// to the edges. | |
/// </summary> |
Ditto below.
@@ -129,7 +131,7 @@ inline void SafeRelease(Interface **ppInterfaceToRelease) | |||
} | |||
|
|||
#define RetrieveContext(ctx) D2DContext* context = reinterpret_cast<D2DContext*>(ctx) | |||
#define RetrieveD2DBitmap(ctx, handle) ID2D1Bitmap* ctx = reinterpret_cast<ID2D1Bitmap*>(handle) | |||
#define RetrieveD2DBitmap(ctx) ID2D1Bitmap* d2dbitmap = reinterpret_cast<ID2D1Bitmap*>(d2dbitmapHandle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this right? It seems to rely upon there being a d2dbitmapHandle
value in scope, where the previous code (and the #define
above) only rely on their "arguments".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that both arguments, contextHandle
and bitmapHandle
, should be used. However, RetrieveD2DBitmap
is currently not being utilized anywhere. I plan to fix this in the future.
{ | ||
public class D2DBitmapBrush : D2DBrush | ||
{ | ||
public D2DBitmap Bitmap { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be get-only.
public D2DBitmap Bitmap { get; private set; } | |
public D2DBitmap Bitmap { get; } |
Hi @beklemeto! Thanks very much for your work on this. Could you please address the points that @drewnoakes raised? I'll merge this PR once those issues are resolved. Additionally, if you could provide an example program, that would be great. It will help us better understand how your feature works. |
I'm going to merge this and make a simple example code to test it. |
Thank you for dealing with it. I'm not able to react swiftly. Maybe it would be useful to point my exact code excerpt on how I used it:
The code repeats a pattern horizontally and vertically (Wrap extend mode) as long as the polygon is fully filled. Please note the double Bitmap conversion through byte array and then drawing onto a bitmap graphics. This was the only way possible to convert transparent GDI Bitmap into a transparent D2DBitmap. Excellen description on how to use the extend parameters of the brush can be found here: |
This pull request adds a BitmapBrush. Tested and used successfully for months with v1.4.1. I tried to port the changes to the master branch. Sorry for the untidy pull-request, as it's my first here on github.