Skip to content
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

Add SKImage::makeRawShader to the C API #119

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/c/sk_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SK_C_API sk_colortype_t sk_image_get_color_type(const sk_image_t* image);
SK_C_API sk_colorspace_t* sk_image_get_colorspace(const sk_image_t* image);
SK_C_API bool sk_image_is_alpha_only(const sk_image_t* image);
SK_C_API sk_shader_t* sk_image_make_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
SK_C_API sk_shader_t* sk_image_make_raw_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
SK_C_API bool sk_image_peek_pixels(const sk_image_t* image, sk_pixmap_t* pixmap);
SK_C_API bool sk_image_is_texture_backed(const sk_image_t* image);
SK_C_API bool sk_image_is_lazy_generated(const sk_image_t* image);
Expand Down
8 changes: 8 additions & 0 deletions src/c/sk_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ sk_shader_t* sk_image_make_shader(const sk_image_t* image, sk_shader_tilemode_t
return ToShader(AsImage(image)->makeShader((SkTileMode)tileX, (SkTileMode)tileY, *AsSamplingOptions(sampling), cmatrix ? &m : nullptr).release());
}

sk_shader_t* sk_image_make_raw_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix) {
SkMatrix m;
if (cmatrix) {
m = AsMatrix(cmatrix);
}
return ToShader(AsImage(image)->makeRawShader((SkTileMode)tileX, (SkTileMode)tileY, *AsSamplingOptions(sampling), cmatrix ? &m : nullptr).release());
}

bool sk_image_peek_pixels(const sk_image_t* image, sk_pixmap_t* pixmap) {
return AsImage(image)->peekPixels(AsPixmap(pixmap));
}
Expand Down
Loading