forked from old/legacy-imlib2
imlib_image_draw_ellipse()
Check test/imlib2 for example. Clipped too. TODO: Not antialiased. yet. point drawing needs to be inlined, or something. SVN revision: 3287
This commit is contained in:
parent
1250f13969
commit
0794fb0f14
|
@ -251,6 +251,10 @@ void imlib_polygon_add_point(ImlibPolygon poly, int x, int y);
|
|||
void imlib_image_draw_polygon(ImlibPolygon poly);
|
||||
void imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2, int *py2);
|
||||
|
||||
/* ellipses */
|
||||
void
|
||||
imlib_image_draw_ellipse(int xc, int yc, int a, int b);
|
||||
|
||||
Imlib_Color_Range imlib_create_color_range(void);
|
||||
void imlib_free_color_range(void);
|
||||
void imlib_add_color_to_color_range(int distance_away);
|
||||
|
|
422
src/api.c
422
src/api.c
|
@ -60,8 +60,9 @@ if (!(param)) \
|
|||
}
|
||||
|
||||
/* internal typedefs for function pointers */
|
||||
typedef void (*Imlib_Internal_Progress_Function) (void *, char, int, int,
|
||||
int, int);
|
||||
typedef void (*Imlib_Internal_Progress_Function) (void *, char, int, int, int,
|
||||
|
||||
int);
|
||||
typedef void (*Imlib_Internal_Data_Destructor_Function) (void *, void *);
|
||||
|
||||
/* context - all operations use this context for their state */
|
||||
|
@ -90,7 +91,8 @@ static Imlib_Rectangle ctxt_cliprect = {0,0,0,0};
|
|||
|
||||
/* context setting/getting functions */
|
||||
|
||||
void imlib_context_set_cliprect(int x, int y, int w, int h)
|
||||
void
|
||||
imlib_context_set_cliprect(int x, int y, int w, int h)
|
||||
{
|
||||
ctxt_cliprect.x = x;
|
||||
ctxt_cliprect.y = y;
|
||||
|
@ -98,7 +100,8 @@ void imlib_context_set_cliprect(int x, int y, int w, int h)
|
|||
ctxt_cliprect.h = h;
|
||||
}
|
||||
|
||||
void imlib_context_get_cliprect(int *x, int *y, int *w, int *h)
|
||||
void
|
||||
imlib_context_get_cliprect(int *x, int *y, int *w, int *h)
|
||||
{
|
||||
*x = ctxt_cliprect.x;
|
||||
*y = ctxt_cliprect.y;
|
||||
|
@ -137,7 +140,8 @@ imlib_context_set_colormap(Colormap colormap)
|
|||
ctxt_colormap = colormap;
|
||||
}
|
||||
|
||||
Colormap imlib_context_get_colormap(void)
|
||||
Colormap
|
||||
imlib_context_get_colormap(void)
|
||||
{
|
||||
return ctxt_colormap;
|
||||
}
|
||||
|
@ -148,7 +152,8 @@ imlib_context_set_drawable(Drawable drawable)
|
|||
ctxt_drawable = drawable;
|
||||
}
|
||||
|
||||
Drawable imlib_context_get_drawable(void)
|
||||
Drawable
|
||||
imlib_context_get_drawable(void)
|
||||
{
|
||||
return ctxt_drawable;
|
||||
}
|
||||
|
@ -159,7 +164,8 @@ imlib_context_set_mask(Pixmap mask)
|
|||
ctxt_mask = mask;
|
||||
}
|
||||
|
||||
Pixmap imlib_context_get_mask(void)
|
||||
Pixmap
|
||||
imlib_context_get_mask(void)
|
||||
{
|
||||
return ctxt_mask;
|
||||
}
|
||||
|
@ -218,7 +224,8 @@ imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier)
|
|||
ctxt_color_modifier = color_modifier;
|
||||
}
|
||||
|
||||
Imlib_Color_Modifier imlib_context_get_color_modifier(void)
|
||||
Imlib_Color_Modifier
|
||||
imlib_context_get_color_modifier(void)
|
||||
{
|
||||
return ctxt_color_modifier;
|
||||
}
|
||||
|
@ -229,7 +236,8 @@ imlib_context_set_operation(Imlib_Operation operation)
|
|||
ctxt_operation = operation;
|
||||
}
|
||||
|
||||
Imlib_Operation imlib_context_get_operation(void)
|
||||
Imlib_Operation
|
||||
imlib_context_get_operation(void)
|
||||
{
|
||||
return ctxt_operation;
|
||||
}
|
||||
|
@ -240,7 +248,8 @@ imlib_context_set_font(Imlib_Font font)
|
|||
ctxt_font = font;
|
||||
}
|
||||
|
||||
Imlib_Font imlib_context_get_font(void)
|
||||
Imlib_Font
|
||||
imlib_context_get_font(void)
|
||||
{
|
||||
return ctxt_font;
|
||||
}
|
||||
|
@ -263,7 +272,8 @@ imlib_context_get_angle(void)
|
|||
return ctxt_angle;
|
||||
}
|
||||
|
||||
Imlib_Text_Direction imlib_context_get_direction(void)
|
||||
Imlib_Text_Direction
|
||||
imlib_context_get_direction(void)
|
||||
{
|
||||
return ctxt_direction;
|
||||
}
|
||||
|
@ -298,7 +308,8 @@ imlib_context_set_color_range(Imlib_Color_Range color_range)
|
|||
ctxt_color_range = color_range;
|
||||
}
|
||||
|
||||
Imlib_Color_Range imlib_context_get_color_range(void)
|
||||
Imlib_Color_Range
|
||||
imlib_context_get_color_range(void)
|
||||
{
|
||||
return ctxt_color_range;
|
||||
}
|
||||
|
@ -309,7 +320,8 @@ imlib_context_set_progress_function(Imlib_Progress_Function progress_function)
|
|||
ctxt_progress_func = progress_function;
|
||||
}
|
||||
|
||||
Imlib_Progress_Function imlib_context_get_progress_function(void)
|
||||
Imlib_Progress_Function
|
||||
imlib_context_get_progress_function(void)
|
||||
{
|
||||
return ctxt_progress_func;
|
||||
}
|
||||
|
@ -332,7 +344,8 @@ imlib_context_set_image(Imlib_Image image)
|
|||
ctxt_image = image;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_context_get_image(void)
|
||||
Imlib_Image
|
||||
imlib_context_get_image(void)
|
||||
{
|
||||
return ctxt_image;
|
||||
}
|
||||
|
@ -376,7 +389,8 @@ imlib_flush_loaders(void)
|
|||
int
|
||||
imlib_get_visual_depth(Display * display, Visual * visual)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_get_visual_depth", "display", display, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_get_visual_depth", "display", display,
|
||||
0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_get_visual_depth", "visual", visual, 0);
|
||||
return __imlib_XActualDepth(display, visual);
|
||||
}
|
||||
|
@ -391,7 +405,8 @@ imlib_get_best_visual(Display * display, int screen, int *depth_return)
|
|||
return __imlib_BestVisual(display, screen, depth_return);
|
||||
}
|
||||
|
||||
Imlib_Image imlib_load_image(const char *file)
|
||||
Imlib_Image
|
||||
imlib_load_image(const char *file)
|
||||
{
|
||||
Imlib_Image im = NULL;
|
||||
Imlib_Image prev_ctxt_image;
|
||||
|
@ -405,7 +420,8 @@ Imlib_Image imlib_load_image(const char *file)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_load_image_immediately(const char *file)
|
||||
Imlib_Image
|
||||
imlib_load_image_immediately(const char *file)
|
||||
{
|
||||
Imlib_Image im = NULL;
|
||||
Imlib_Image prev_ctxt_image;
|
||||
|
@ -420,7 +436,8 @@ Imlib_Image imlib_load_image_immediately(const char *file)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_load_image_without_cache(const char *file)
|
||||
Imlib_Image
|
||||
imlib_load_image_without_cache(const char *file)
|
||||
{
|
||||
Imlib_Image im = NULL;
|
||||
Imlib_Image prev_ctxt_image;
|
||||
|
@ -435,7 +452,8 @@ Imlib_Image imlib_load_image_without_cache(const char *file)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_load_image_immediately_without_cache(const char *file)
|
||||
Imlib_Image
|
||||
imlib_load_image_immediately_without_cache(const char *file)
|
||||
{
|
||||
Imlib_Image im = NULL;
|
||||
Imlib_Image prev_ctxt_image;
|
||||
|
@ -450,7 +468,8 @@ Imlib_Image imlib_load_image_immediately_without_cache(const char *file)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_load_image_with_error_return(const char *file,
|
||||
Imlib_Image
|
||||
imlib_load_image_with_error_return(const char *file,
|
||||
Imlib_Load_Error * error_return)
|
||||
{
|
||||
Imlib_Image im = NULL;
|
||||
|
@ -518,7 +537,8 @@ imlib_image_get_width(void)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_width", "image", ctxt_image, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_width", "image", ctxt_image,
|
||||
0);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
return im->w;
|
||||
}
|
||||
|
@ -528,7 +548,8 @@ imlib_image_get_height(void)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_height", "image", ctxt_image, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_height", "image", ctxt_image,
|
||||
0);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
return im->h;
|
||||
}
|
||||
|
@ -567,8 +588,8 @@ imlib_image_get_data_for_reading_only(void)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_data_for_reading_only", "image",
|
||||
ctxt_image, NULL);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_data_for_reading_only",
|
||||
"image", ctxt_image, NULL);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if ((!(im->data)) && (im->loader) && (im->loader->load))
|
||||
im->loader->load(im, NULL, 0, 1);
|
||||
|
@ -595,7 +616,8 @@ imlib_image_has_alpha(void)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_has_alpha", "image", ctxt_image, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_has_alpha", "image", ctxt_image,
|
||||
0);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if (IMAGE_HAS_ALPHA(im))
|
||||
return 1;
|
||||
|
@ -635,7 +657,8 @@ imlib_image_set_border(Imlib_Border * border)
|
|||
CHECK_PARAM_POINTER("imlib_image_set_border", "image", ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_image_set_border", "border", border);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if ((im->border.left == border->left) && (im->border.right == border->right)
|
||||
if ((im->border.left == border->left)
|
||||
&& (im->border.right == border->right)
|
||||
&& (im->border.top == border->top)
|
||||
&& (im->border.bottom == border->bottom))
|
||||
return;
|
||||
|
@ -705,7 +728,8 @@ imlib_image_set_irrelevant_alpha(char irrelevant)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_image_set_irrelevant_alpha", "image", ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_image_set_irrelevant_alpha", "image",
|
||||
ctxt_image);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if (irrelevant)
|
||||
{
|
||||
|
@ -722,7 +746,8 @@ imlib_image_format(void)
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_format", "image", ctxt_image, NULL);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_format", "image", ctxt_image,
|
||||
NULL);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
return im->format;
|
||||
}
|
||||
|
@ -748,8 +773,8 @@ imlib_render_pixmaps_for_whole_image(Pixmap * pixmap_return,
|
|||
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image", "image",
|
||||
ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image", "pixmap_return",
|
||||
pixmap_return);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image",
|
||||
"pixmap_return", pixmap_return);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image", "mask_return",
|
||||
mask_return);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
|
@ -759,8 +784,8 @@ imlib_render_pixmaps_for_whole_image(Pixmap * pixmap_return,
|
|||
return;
|
||||
__imlib_CreatePixmapsForImage(ctxt_display, ctxt_drawable, ctxt_visual,
|
||||
ctxt_depth, ctxt_colormap, im, pixmap_return,
|
||||
mask_return, 0, 0, im->w, im->h, im->w, im->h,
|
||||
0, ctxt_dither, ctxt_dither_mask,
|
||||
mask_return, 0, 0, im->w, im->h, im->w,
|
||||
im->h, 0, ctxt_dither, ctxt_dither_mask,
|
||||
ctxt_color_modifier);
|
||||
}
|
||||
|
||||
|
@ -771,8 +796,8 @@ imlib_render_pixmaps_for_whole_image_at_size(Pixmap * pixmap_return,
|
|||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image_at_size", "image",
|
||||
ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image_at_size",
|
||||
"image", ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image_at_size",
|
||||
"pixmap_return", pixmap_return);
|
||||
CHECK_PARAM_POINTER("imlib_render_pixmaps_for_whole_image_at_size",
|
||||
|
@ -784,9 +809,9 @@ imlib_render_pixmaps_for_whole_image_at_size(Pixmap * pixmap_return,
|
|||
return;
|
||||
__imlib_CreatePixmapsForImage(ctxt_display, ctxt_drawable, ctxt_visual,
|
||||
ctxt_depth, ctxt_colormap, im, pixmap_return,
|
||||
mask_return, 0, 0, im->w, im->h, width, height,
|
||||
ctxt_anti_alias, ctxt_dither, ctxt_dither_mask,
|
||||
ctxt_color_modifier);
|
||||
mask_return, 0, 0, im->w, im->h, width,
|
||||
height, ctxt_anti_alias, ctxt_dither,
|
||||
ctxt_dither_mask, ctxt_color_modifier);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -806,9 +831,9 @@ imlib_render_image_on_drawable(int x, int y)
|
|||
im->loader->load(im, NULL, 0, 1);
|
||||
if (!(im->data))
|
||||
return;
|
||||
__imlib_RenderImage(ctxt_display, im, ctxt_drawable, ctxt_mask, ctxt_visual,
|
||||
ctxt_colormap, ctxt_depth, 0, 0, im->w, im->h, x, y,
|
||||
im->w, im->h, 0, ctxt_dither, ctxt_blend,
|
||||
__imlib_RenderImage(ctxt_display, im, ctxt_drawable, ctxt_mask,
|
||||
ctxt_visual, ctxt_colormap, ctxt_depth, 0, 0, im->w,
|
||||
im->h, x, y, im->w, im->h, 0, ctxt_dither, ctxt_blend,
|
||||
ctxt_dither_mask, ctxt_color_modifier, ctxt_operation);
|
||||
}
|
||||
|
||||
|
@ -824,16 +849,18 @@ imlib_render_image_on_drawable_at_size(int x, int y, int width, int height)
|
|||
im->loader->load(im, NULL, 0, 1);
|
||||
if (!(im->data))
|
||||
return;
|
||||
__imlib_RenderImage(ctxt_display, im, ctxt_drawable, ctxt_mask, ctxt_visual,
|
||||
ctxt_colormap, ctxt_depth, 0, 0, im->w, im->h, x, y,
|
||||
width, height, ctxt_anti_alias, ctxt_dither, ctxt_blend,
|
||||
ctxt_dither_mask, ctxt_color_modifier, ctxt_operation);
|
||||
__imlib_RenderImage(ctxt_display, im, ctxt_drawable, ctxt_mask,
|
||||
ctxt_visual, ctxt_colormap, ctxt_depth, 0, 0, im->w,
|
||||
im->h, x, y, width, height, ctxt_anti_alias,
|
||||
ctxt_dither, ctxt_blend, ctxt_dither_mask,
|
||||
ctxt_color_modifier, ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_render_image_part_on_drawable_at_size(int source_x, int source_y,
|
||||
int source_width, int source_height,
|
||||
int x, int y, int width, int height)
|
||||
int source_width,
|
||||
int source_height, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -871,10 +898,10 @@ imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha,
|
|||
if ((abs(destination_width) < (source_width >> 7))
|
||||
|| (abs(destination_height) < (source_height >> 7)))
|
||||
__imlib_BlendImageToImage(im_src, im_dst, 0, ctxt_blend, merge_alpha,
|
||||
source_x, source_y, source_width, source_height,
|
||||
destination_x, destination_y, destination_width,
|
||||
destination_height, ctxt_color_modifier,
|
||||
ctxt_operation);
|
||||
source_x, source_y, source_width,
|
||||
source_height, destination_x, destination_y,
|
||||
destination_width, destination_height,
|
||||
ctxt_color_modifier, ctxt_operation);
|
||||
else
|
||||
__imlib_BlendImageToImage(im_src, im_dst, ctxt_anti_alias, ctxt_blend,
|
||||
merge_alpha, source_x, source_y, source_width,
|
||||
|
@ -883,7 +910,8 @@ imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha,
|
|||
ctxt_color_modifier, ctxt_operation);
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_image(int width, int height)
|
||||
Imlib_Image
|
||||
imlib_create_image(int width, int height)
|
||||
{
|
||||
DATA32 *data;
|
||||
|
||||
|
@ -895,7 +923,8 @@ Imlib_Image imlib_create_image(int width, int height)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_image_using_data(int width, int height, DATA32 * data)
|
||||
Imlib_Image
|
||||
imlib_create_image_using_data(int width, int height, DATA32 * data)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -909,8 +938,8 @@ Imlib_Image imlib_create_image_using_data(int width, int height, DATA32 * data)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_image_using_copied_data(int width, int height,
|
||||
DATA32 * data)
|
||||
Imlib_Image
|
||||
imlib_create_image_using_copied_data(int width, int height, DATA32 * data)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -932,9 +961,9 @@ Imlib_Image imlib_create_image_using_copied_data(int width, int height,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_image_from_drawable(Pixmap mask, int x, int y,
|
||||
int width, int height,
|
||||
char need_to_grab_x)
|
||||
Imlib_Image
|
||||
imlib_create_image_from_drawable(Pixmap mask, int x, int y, int width,
|
||||
int height, char need_to_grab_x)
|
||||
{
|
||||
ImlibImage *im;
|
||||
char domask = 0;
|
||||
|
@ -950,9 +979,9 @@ Imlib_Image imlib_create_image_from_drawable(Pixmap mask, int x, int y,
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
|
||||
int source_y,
|
||||
int source_width,
|
||||
Imlib_Image
|
||||
imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
|
||||
int source_y, int source_width,
|
||||
int source_height,
|
||||
int destination_width,
|
||||
int destination_height,
|
||||
|
@ -990,8 +1019,8 @@ Imlib_Image imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
|
|||
|
||||
tmpmask = 1;
|
||||
mask =
|
||||
XCreatePixmap(ctxt_display, ctxt_drawable, source_width, source_height,
|
||||
1);
|
||||
XCreatePixmap(ctxt_display, ctxt_drawable, source_width,
|
||||
source_height, 1);
|
||||
rect =
|
||||
XShapeGetRectangles(ctxt_display, ctxt_drawable, ShapeBounding,
|
||||
&rect_num, &rect_ord);
|
||||
|
@ -1013,7 +1042,8 @@ Imlib_Image imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
|
|||
XCopyArea(ctxt_display, ctxt_drawable, p, gc, source_x + xx, 0, 1,
|
||||
source_height, xx, 0);
|
||||
if (m != None)
|
||||
XCopyArea(ctxt_display, mask, m, mgc, xx, 0, 1, source_height, xx, 0);
|
||||
XCopyArea(ctxt_display, mask, m, mgc, xx, 0, 1, source_height, xx,
|
||||
0);
|
||||
}
|
||||
for (x = 0; x < destination_height; x++)
|
||||
{
|
||||
|
@ -1099,13 +1129,14 @@ imlib_copy_drawable_to_image(Pixmap mask, int x, int y, int width, int height,
|
|||
__imlib_DirtyImage(im);
|
||||
__imlib_DirtyPixmapsForImage(im);
|
||||
return __imlib_GrabDrawableToRGBA(im->data, destination_x, destination_y,
|
||||
im->w, im->h, ctxt_display, ctxt_drawable,
|
||||
mask, ctxt_visual, ctxt_colormap,
|
||||
ctxt_depth, x, y, width, height, domask,
|
||||
need_to_grab_x);
|
||||
im->w, im->h, ctxt_display,
|
||||
ctxt_drawable, mask, ctxt_visual,
|
||||
ctxt_colormap, ctxt_depth, x, y, width,
|
||||
height, domask, need_to_grab_x);
|
||||
}
|
||||
|
||||
Imlib_Image imlib_clone_image(void)
|
||||
Imlib_Image
|
||||
imlib_clone_image(void)
|
||||
{
|
||||
ImlibImage *im, *im_old;
|
||||
|
||||
|
@ -1144,12 +1175,13 @@ Imlib_Image imlib_clone_image(void)
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_cropped_image(int x, int y, int width, int height)
|
||||
Imlib_Image
|
||||
imlib_create_cropped_image(int x, int y, int width, int height)
|
||||
{
|
||||
ImlibImage *im, *im_old;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_create_cropped_image", "image", ctxt_image,
|
||||
NULL);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_create_cropped_image", "image",
|
||||
ctxt_image, NULL);
|
||||
CAST_IMAGE(im_old, ctxt_image);
|
||||
if ((!(im_old->data)) && (im_old->loader) && (im_old->loader->load))
|
||||
im_old->loader->load(im_old, NULL, 0, 1);
|
||||
|
@ -1162,14 +1194,15 @@ Imlib_Image imlib_create_cropped_image(int x, int y, int width, int height)
|
|||
__imlib_FreeImage(im);
|
||||
return NULL;
|
||||
}
|
||||
__imlib_BlendImageToImage(im_old, im, 0, 0, 0, x, y, abs(width), abs(height),
|
||||
0, 0, width, height, NULL, IMLIB_OP_COPY);
|
||||
__imlib_BlendImageToImage(im_old, im, 0, 0, 0, x, y, abs(width),
|
||||
abs(height), 0, 0, width, height, NULL,
|
||||
IMLIB_OP_COPY);
|
||||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_cropped_scaled_image(int source_x, int source_y,
|
||||
int source_width,
|
||||
int source_height,
|
||||
Imlib_Image
|
||||
imlib_create_cropped_scaled_image(int source_x, int source_y,
|
||||
int source_width, int source_height,
|
||||
int destination_width,
|
||||
int destination_height)
|
||||
{
|
||||
|
@ -1210,7 +1243,8 @@ Imlib_Image imlib_create_cropped_scaled_image(int source_x, int source_y,
|
|||
return (Imlib_Image) im;
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_clone(Imlib_Updates updates)
|
||||
Imlib_Updates
|
||||
imlib_updates_clone(Imlib_Updates updates)
|
||||
{
|
||||
ImlibUpdate *u;
|
||||
|
||||
|
@ -1218,8 +1252,8 @@ Imlib_Updates imlib_updates_clone(Imlib_Updates updates)
|
|||
return (Imlib_Updates) __imlib_DupUpdates(u);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y,
|
||||
int w, int h)
|
||||
Imlib_Updates
|
||||
imlib_update_append_rect(Imlib_Updates updates, int x, int y, int w, int h)
|
||||
{
|
||||
ImlibUpdate *u;
|
||||
|
||||
|
@ -1227,7 +1261,8 @@ Imlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y,
|
|||
return (Imlib_Updates) __imlib_AddUpdate(u, x, y, w, h);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h)
|
||||
Imlib_Updates
|
||||
imlib_updates_merge(Imlib_Updates updates, int w, int h)
|
||||
{
|
||||
ImlibUpdate *u;
|
||||
|
||||
|
@ -1235,8 +1270,8 @@ Imlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h)
|
|||
return (Imlib_Updates) __imlib_MergeUpdate(u, w, h, 0);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates, int w,
|
||||
int h)
|
||||
Imlib_Updates
|
||||
imlib_updates_merge_for_rendering(Imlib_Updates updates, int w, int h)
|
||||
{
|
||||
ImlibUpdate *u;
|
||||
|
||||
|
@ -1253,7 +1288,8 @@ imlib_updates_free(Imlib_Updates updates)
|
|||
__imlib_FreeUpdates(u);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_get_next(Imlib_Updates updates)
|
||||
Imlib_Updates
|
||||
imlib_updates_get_next(Imlib_Updates updates)
|
||||
{
|
||||
ImlibUpdate *u;
|
||||
|
||||
|
@ -1315,18 +1351,20 @@ imlib_render_image_updates_on_drawable(Imlib_Updates updates, int x, int y)
|
|||
{
|
||||
__imlib_RenderImage(ctxt_display, im, ctxt_drawable, 0, ctxt_visual,
|
||||
ctxt_colormap, ctxt_depth, u->x, u->y, u->w, u->h,
|
||||
x + u->x, y + u->y, u->w, u->h, 0, ctxt_dither, 0, 0,
|
||||
ctxt_color_modifier, OP_COPY);
|
||||
x + u->x, y + u->y, u->w, u->h, 0, ctxt_dither, 0,
|
||||
0, ctxt_color_modifier, OP_COPY);
|
||||
}
|
||||
__imlib_SetMaxXImageCount(ctxt_display, 0);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_init(void)
|
||||
Imlib_Updates
|
||||
imlib_updates_init(void)
|
||||
{
|
||||
return (Imlib_Updates) NULL;
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates,
|
||||
Imlib_Updates
|
||||
imlib_updates_append_updates(Imlib_Updates updates,
|
||||
Imlib_Updates appended_updates)
|
||||
{
|
||||
ImlibUpdate *u, *uu;
|
||||
|
@ -1520,7 +1558,8 @@ imlib_image_tile(void)
|
|||
__imlib_TileImageVert(im);
|
||||
}
|
||||
|
||||
Imlib_Font imlib_load_font(const char *font_name)
|
||||
Imlib_Font
|
||||
imlib_load_font(const char *font_name)
|
||||
{
|
||||
return (Imlib_Font) __imlib_load_font(font_name);
|
||||
}
|
||||
|
@ -1697,8 +1736,8 @@ imlib_text_get_index_and_location(const char *text, int x, int y,
|
|||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_text_get_index_and_location", "font",
|
||||
ctxt_font, -1);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_text_get_index_and_location", "text", text,
|
||||
-1);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_text_get_index_and_location", "text",
|
||||
text, -1);
|
||||
fn = (ImlibFont *) ctxt_font;
|
||||
switch (ctxt_direction)
|
||||
{
|
||||
|
@ -1777,7 +1816,8 @@ imlib_text_get_location_at_index(const char *text, int index,
|
|||
ImlibFont *fn;
|
||||
int cx, cy, cw, ch, w, h;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_text_get_index_and_location", "font", ctxt_font);
|
||||
CHECK_PARAM_POINTER("imlib_text_get_index_and_location", "font",
|
||||
ctxt_font);
|
||||
CHECK_PARAM_POINTER("imlib_text_get_index_and_location", "text", text);
|
||||
fn = (ImlibFont *) ctxt_font;
|
||||
switch (ctxt_direction)
|
||||
|
@ -1905,7 +1945,8 @@ imlib_get_maximum_font_descent(void)
|
|||
return ((ImlibFont *) ctxt_font)->max_ascent;
|
||||
}
|
||||
|
||||
Imlib_Color_Modifier imlib_create_color_modifier(void)
|
||||
Imlib_Color_Modifier
|
||||
imlib_create_color_modifier(void)
|
||||
{
|
||||
return (Imlib_Color_Modifier) __imlib_CreateCmod();
|
||||
}
|
||||
|
@ -1940,8 +1981,8 @@ imlib_modify_color_modifier_brightness(double brightness_value)
|
|||
void
|
||||
imlib_modify_color_modifier_contrast(double contrast_value)
|
||||
{
|
||||
CHECK_PARAM_POINTER("imlib_modify_color_modifier_contrast", "color_modifier",
|
||||
ctxt_color_modifier);
|
||||
CHECK_PARAM_POINTER("imlib_modify_color_modifier_contrast",
|
||||
"color_modifier", ctxt_color_modifier);
|
||||
__imlib_CmodModContrast((ImlibColorModifier *) ctxt_color_modifier,
|
||||
contrast_value);
|
||||
}
|
||||
|
@ -1952,8 +1993,8 @@ imlib_set_color_modifier_tables(DATA8 * red_table, DATA8 * green_table,
|
|||
{
|
||||
CHECK_PARAM_POINTER("imlib_set_color_modifier_tables", "color_modifier",
|
||||
ctxt_color_modifier);
|
||||
__imlib_CmodSetTables((ImlibColorModifier *) ctxt_color_modifier, red_table,
|
||||
green_table, blue_table, alpha_table);
|
||||
__imlib_CmodSetTables((ImlibColorModifier *) ctxt_color_modifier,
|
||||
red_table, green_table, blue_table, alpha_table);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1962,8 +2003,8 @@ imlib_get_color_modifier_tables(DATA8 * red_table, DATA8 * green_table,
|
|||
{
|
||||
CHECK_PARAM_POINTER("imlib_get_color_modifier_tables", "color_modifier",
|
||||
ctxt_color_modifier);
|
||||
__imlib_CmodGetTables((ImlibColorModifier *) ctxt_color_modifier, red_table,
|
||||
green_table, blue_table, alpha_table);
|
||||
__imlib_CmodGetTables((ImlibColorModifier *) ctxt_color_modifier,
|
||||
red_table, green_table, blue_table, alpha_table);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2036,8 +2077,8 @@ imlib_apply_color_modifier_to_rectangle(int x, int y, int width, int height)
|
|||
(ImlibColorModifier *) ctxt_color_modifier);
|
||||
}
|
||||
|
||||
Imlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2,
|
||||
char make_updates)
|
||||
Imlib_Updates
|
||||
imlib_image_draw_line(int x1, int y1, int x2, int y2, char make_updates)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -2054,14 +2095,18 @@ Imlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2,
|
|||
{
|
||||
return (Imlib_Updates) __imlib_draw_line_clipped(im, x1, y1, x2, y2,
|
||||
ctxt_cliprect.x,
|
||||
ctxt_cliprect.x + ctxt_cliprect.w,
|
||||
ctxt_cliprect.x +
|
||||
ctxt_cliprect.w,
|
||||
ctxt_cliprect.y,
|
||||
ctxt_cliprect.y + ctxt_cliprect.h,
|
||||
ctxt_cliprect.y +
|
||||
ctxt_cliprect.h,
|
||||
(DATA8) ctxt_color.red,
|
||||
(DATA8) ctxt_color.green,
|
||||
(DATA8) ctxt_color.blue,
|
||||
(DATA8) ctxt_color.alpha,
|
||||
ctxt_operation,
|
||||
(DATA8) ctxt_color.
|
||||
green,
|
||||
(DATA8) ctxt_color.
|
||||
blue,
|
||||
(DATA8) ctxt_color.
|
||||
alpha, ctxt_operation,
|
||||
(char) make_updates);
|
||||
}
|
||||
else
|
||||
|
@ -2071,7 +2116,8 @@ Imlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2,
|
|||
(DATA8) ctxt_color.green,
|
||||
(DATA8) ctxt_color.blue,
|
||||
(DATA8) ctxt_color.alpha,
|
||||
ctxt_operation, (char)make_updates);
|
||||
ctxt_operation,
|
||||
(char) make_updates);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2090,19 +2136,19 @@ imlib_image_draw_rectangle(int x, int y, int width, int height)
|
|||
__imlib_DirtyPixmapsForImage(im);
|
||||
if (ctxt_cliprect.w)
|
||||
{
|
||||
__imlib_draw_box_clipped(im, x, y, width, height,
|
||||
ctxt_cliprect.x,
|
||||
__imlib_draw_box_clipped(im, x, y, width, height, ctxt_cliprect.x,
|
||||
ctxt_cliprect.x + ctxt_cliprect.w,
|
||||
ctxt_cliprect.y,
|
||||
ctxt_cliprect.y + ctxt_cliprect.h,
|
||||
ctxt_color.red,
|
||||
ctxt_color.green, ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_color.red, ctxt_color.green,
|
||||
ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_operation);
|
||||
}
|
||||
else
|
||||
{
|
||||
__imlib_draw_box(im, x, y, width, height, ctxt_color.red, ctxt_color.green,
|
||||
ctxt_color.blue, ctxt_color.alpha, ctxt_operation);
|
||||
__imlib_draw_box(im, x, y, width, height, ctxt_color.red,
|
||||
ctxt_color.green, ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_operation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2120,8 +2166,8 @@ imlib_image_fill_rectangle(int x, int y, int width, int height)
|
|||
__imlib_DirtyImage(im);
|
||||
__imlib_DirtyPixmapsForImage(im);
|
||||
__imlib_draw_filled_box(im, x, y, width, height, ctxt_color.red,
|
||||
ctxt_color.green, ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_operation);
|
||||
ctxt_color.green, ctxt_color.blue,
|
||||
ctxt_color.alpha, ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2151,7 +2197,8 @@ imlib_image_copy_alpha_to_image(Imlib_Image image_source, int x, int y)
|
|||
void
|
||||
imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source, int x,
|
||||
int y, int width, int height,
|
||||
int destination_x, int destination_y)
|
||||
int destination_x,
|
||||
int destination_y)
|
||||
{
|
||||
ImlibImage *im, *im2;
|
||||
|
||||
|
@ -2218,7 +2265,8 @@ imlib_image_scroll_rect(int x, int y, int width, int height, int delta_x,
|
|||
}
|
||||
|
||||
void
|
||||
imlib_image_copy_rect(int x, int y, int width, int height, int new_x, int new_y)
|
||||
imlib_image_copy_rect(int x, int y, int width, int height, int new_x,
|
||||
int new_y)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -2233,7 +2281,8 @@ imlib_image_copy_rect(int x, int y, int width, int height, int new_x, int new_y)
|
|||
__imlib_copy_image_data(im, x, y, width, height, new_x, new_y);
|
||||
}
|
||||
|
||||
Imlib_Color_Range imlib_create_color_range(void)
|
||||
Imlib_Color_Range
|
||||
imlib_create_color_range(void)
|
||||
{
|
||||
return (Imlib_Color_Range) __imlib_CreateRange();
|
||||
}
|
||||
|
@ -2265,8 +2314,8 @@ imlib_image_fill_color_range_rectangle(int x, int y, int width, int height,
|
|||
|
||||
CHECK_PARAM_POINTER("imlib_image_fill_color_range_rectangle", "image",
|
||||
ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_image_fill_color_range_rectangle", "color_range",
|
||||
ctxt_color_range);
|
||||
CHECK_PARAM_POINTER("imlib_image_fill_color_range_rectangle",
|
||||
"color_range", ctxt_color_range);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if ((!(im->data)) && (im->loader) && (im->loader->load))
|
||||
im->loader->load(im, NULL, 0, 1);
|
||||
|
@ -2275,7 +2324,8 @@ imlib_image_fill_color_range_rectangle(int x, int y, int width, int height,
|
|||
__imlib_DirtyImage(im);
|
||||
__imlib_DirtyPixmapsForImage(im);
|
||||
__imlib_DrawGradient(im, x, y, width, height,
|
||||
(ImlibRange *) ctxt_color_range, angle, ctxt_operation);
|
||||
(ImlibRange *) ctxt_color_range, angle,
|
||||
ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2285,7 +2335,8 @@ imlib_image_query_pixel(int x, int y, Imlib_Color * color_return)
|
|||
DATA32 *p;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_image_query_pixel", "image", ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_image_query_pixel", "color_return", color_return);
|
||||
CHECK_PARAM_POINTER("imlib_image_query_pixel", "color_return",
|
||||
color_return);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if ((!(im->data)) && (im->loader) && (im->loader->load))
|
||||
im->loader->load(im, NULL, 0, 1);
|
||||
|
@ -2345,7 +2396,8 @@ imlib_image_get_attached_value(const char *key)
|
|||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_attached_value", "image",
|
||||
ctxt_image, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_attached_value", "key", key, 0);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_image_get_attached_value", "key", key,
|
||||
0);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
t = __imlib_GetTag(im, key);
|
||||
if (t)
|
||||
|
@ -2373,8 +2425,8 @@ imlib_image_remove_and_free_attached_data_value(const char *key)
|
|||
|
||||
CHECK_PARAM_POINTER("imlib_image_remove_and_free_attached_data_value",
|
||||
"image", ctxt_image);
|
||||
CHECK_PARAM_POINTER("imlib_image_remove_and_free_attached_data_value", "key",
|
||||
key);
|
||||
CHECK_PARAM_POINTER("imlib_image_remove_and_free_attached_data_value",
|
||||
"key", key);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
t = __imlib_RemoveTag(im, key);
|
||||
__imlib_FreeTag(im, t);
|
||||
|
@ -2423,15 +2475,16 @@ imlib_save_image_with_error_return(const char *filename,
|
|||
ctxt_image = prev_ctxt_image;
|
||||
}
|
||||
|
||||
Imlib_Image imlib_create_rotated_image(double angle)
|
||||
Imlib_Image
|
||||
imlib_create_rotated_image(double angle)
|
||||
{
|
||||
ImlibImage *im, *im_old;
|
||||
DATA32 *data;
|
||||
int x, y, dx, dy, sz;
|
||||
double x1, y1, d;
|
||||
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_create_rotated_image", "image", ctxt_image,
|
||||
NULL);
|
||||
CHECK_PARAM_POINTER_RETURN("imlib_create_rotated_image", "image",
|
||||
ctxt_image, NULL);
|
||||
CAST_IMAGE(im_old, ctxt_image);
|
||||
if ((!(im_old->data)) && (im_old->loader) && (im_old->loader->load))
|
||||
im_old->loader->load(im_old, NULL, 0, 1);
|
||||
|
@ -2462,7 +2515,8 @@ Imlib_Image imlib_create_rotated_image(double angle)
|
|||
#ifdef DO_MMX_ASM
|
||||
if (__imlib_get_cpuid() & CPUID_MMX)
|
||||
__imlib_mmx_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
|
||||
im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
|
||||
im_old->h, im->w, sz, sz, x, y, dx, dy, -dy,
|
||||
dx);
|
||||
else
|
||||
#endif
|
||||
__imlib_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
|
||||
|
@ -2488,27 +2542,29 @@ imlib_blend_image_onto_image_at_angle(Imlib_Image source_image,
|
|||
{
|
||||
ImlibImage *im_src, *im_dst;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_blend_image_onto_image_at_angle", "source_image",
|
||||
source_image);
|
||||
CHECK_PARAM_POINTER("imlib_blend_image_onto_image_at_angle",
|
||||
"source_image", source_image);
|
||||
CHECK_PARAM_POINTER("imlib_blend_image_onto_image_at_angle", "image",
|
||||
ctxt_image);
|
||||
CAST_IMAGE(im_src, source_image);
|
||||
CAST_IMAGE(im_dst, ctxt_image);
|
||||
__imlib_DirtyImage(im_dst);
|
||||
__imlib_DirtyPixmapsForImage(im_dst);
|
||||
__imlib_BlendImageToImageSkewed(im_src, im_dst, ctxt_anti_alias, ctxt_blend,
|
||||
merge_alpha, source_x, source_y,
|
||||
source_width, source_height, destination_x,
|
||||
destination_y, angle_x, angle_y, 0, 0,
|
||||
ctxt_color_modifier, ctxt_operation);
|
||||
__imlib_BlendImageToImageSkewed(im_src, im_dst, ctxt_anti_alias,
|
||||
ctxt_blend, merge_alpha, source_x,
|
||||
source_y, source_width, source_height,
|
||||
destination_x, destination_y, angle_x,
|
||||
angle_y, 0, 0, ctxt_color_modifier,
|
||||
ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_blend_image_onto_image_skewed(Imlib_Image source_image, char merge_alpha,
|
||||
int source_x, int source_y,
|
||||
int source_width, int source_height,
|
||||
int destination_x, int destination_y,
|
||||
int h_angle_x, int h_angle_y, int v_angle_x,
|
||||
imlib_blend_image_onto_image_skewed(Imlib_Image source_image,
|
||||
char merge_alpha, int source_x,
|
||||
int source_y, int source_width,
|
||||
int source_height, int destination_x,
|
||||
int destination_y, int h_angle_x,
|
||||
int h_angle_y, int v_angle_x,
|
||||
int v_angle_y)
|
||||
{
|
||||
ImlibImage *im_src, *im_dst;
|
||||
|
@ -2521,12 +2577,12 @@ imlib_blend_image_onto_image_skewed(Imlib_Image source_image, char merge_alpha,
|
|||
CAST_IMAGE(im_dst, ctxt_image);
|
||||
__imlib_DirtyImage(im_dst);
|
||||
__imlib_DirtyPixmapsForImage(im_dst);
|
||||
__imlib_BlendImageToImageSkewed(im_src, im_dst, ctxt_anti_alias, ctxt_blend,
|
||||
merge_alpha, source_x, source_y,
|
||||
source_width, source_height, destination_x,
|
||||
destination_y, h_angle_x, h_angle_y,
|
||||
v_angle_x, v_angle_y, ctxt_color_modifier,
|
||||
ctxt_operation);
|
||||
__imlib_BlendImageToImageSkewed(im_src, im_dst, ctxt_anti_alias,
|
||||
ctxt_blend, merge_alpha, source_x,
|
||||
source_y, source_width, source_height,
|
||||
destination_x, destination_y, h_angle_x,
|
||||
h_angle_y, v_angle_x, v_angle_y,
|
||||
ctxt_color_modifier, ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2549,10 +2605,10 @@ imlib_render_image_on_drawable_skewed(int source_x, int source_y,
|
|||
__imlib_RenderImageSkewed(ctxt_display, im, ctxt_drawable, ctxt_mask,
|
||||
ctxt_visual, ctxt_colormap, ctxt_depth, source_x,
|
||||
source_y, source_width, source_height,
|
||||
destination_x, destination_y, h_angle_x, h_angle_y,
|
||||
v_angle_x, v_angle_y, ctxt_anti_alias, ctxt_dither,
|
||||
ctxt_blend, ctxt_dither_mask, ctxt_color_modifier,
|
||||
ctxt_operation);
|
||||
destination_x, destination_y, h_angle_x,
|
||||
h_angle_y, v_angle_x, v_angle_y, ctxt_anti_alias,
|
||||
ctxt_dither, ctxt_blend, ctxt_dither_mask,
|
||||
ctxt_color_modifier, ctxt_operation);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2574,8 +2630,8 @@ imlib_render_image_on_drawable_at_angle(int source_x, int source_y,
|
|||
__imlib_RenderImageSkewed(ctxt_display, im, ctxt_drawable, ctxt_mask,
|
||||
ctxt_visual, ctxt_colormap, ctxt_depth, source_x,
|
||||
source_y, source_width, source_height,
|
||||
destination_x, destination_y, angle_x, angle_y, 0,
|
||||
0, ctxt_anti_alias, ctxt_dither, ctxt_blend,
|
||||
destination_x, destination_y, angle_x, angle_y,
|
||||
0, 0, ctxt_anti_alias, ctxt_dither, ctxt_blend,
|
||||
ctxt_dither_mask, ctxt_color_modifier,
|
||||
ctxt_operation);
|
||||
}
|
||||
|
@ -2597,7 +2653,8 @@ imlib_image_filter(void)
|
|||
__imlib_FilterImage(im, (ImlibFilter *) ctxt_filter);
|
||||
}
|
||||
|
||||
Imlib_Filter imlib_create_filter(int initsize)
|
||||
Imlib_Filter
|
||||
imlib_create_filter(int initsize)
|
||||
{
|
||||
return (Imlib_Filter) __imlib_CreateFilter(initsize);
|
||||
}
|
||||
|
@ -2616,7 +2673,8 @@ imlib_context_set_filter(Imlib_Filter filter)
|
|||
ctxt_filter = filter;
|
||||
}
|
||||
|
||||
Imlib_Filter imlib_context_get_filter(void)
|
||||
Imlib_Filter
|
||||
imlib_context_get_filter(void)
|
||||
{
|
||||
return ctxt_filter;
|
||||
}
|
||||
|
@ -2703,24 +2761,28 @@ imlib_apply_filter(char *script, ...)
|
|||
va_end(param_list);
|
||||
}
|
||||
|
||||
ImlibPolygon imlib_polygon_new(int type)
|
||||
ImlibPolygon
|
||||
imlib_polygon_new(int type)
|
||||
{
|
||||
return (ImlibPolygon) __imlib_polygon_new(type);
|
||||
}
|
||||
|
||||
void imlib_polygon_add_point(ImlibPolygon poly, int x, int y)
|
||||
void
|
||||
imlib_polygon_add_point(ImlibPolygon poly, int x, int y)
|
||||
{
|
||||
CHECK_PARAM_POINTER("imlib_polygon_add_point", "polygon", poly);
|
||||
__imlib_polygon_add_point(poly, x, y);
|
||||
}
|
||||
|
||||
void imlib_polygon_free(ImlibPolygon poly)
|
||||
void
|
||||
imlib_polygon_free(ImlibPolygon poly)
|
||||
{
|
||||
CHECK_PARAM_POINTER("imlib_polygon_free", "polygon", poly);
|
||||
__imlib_polygon_free(poly);
|
||||
}
|
||||
|
||||
void imlib_image_draw_polygon(ImlibPolygon poly)
|
||||
void
|
||||
imlib_image_draw_polygon(ImlibPolygon poly)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
|
@ -2734,13 +2796,13 @@ void imlib_image_draw_polygon(ImlibPolygon poly)
|
|||
__imlib_DirtyPixmapsForImage(im);
|
||||
if (ctxt_cliprect.w)
|
||||
{
|
||||
__imlib_draw_polygon_clipped(im, poly,
|
||||
ctxt_cliprect.x,
|
||||
__imlib_draw_polygon_clipped(im, poly, ctxt_cliprect.x,
|
||||
ctxt_cliprect.x + ctxt_cliprect.w,
|
||||
ctxt_cliprect.y,
|
||||
ctxt_cliprect.y + ctxt_cliprect.h,
|
||||
ctxt_color.red, ctxt_color.green,
|
||||
ctxt_color.blue, ctxt_color.alpha, ctxt_operation);
|
||||
ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_operation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2749,8 +2811,42 @@ void imlib_image_draw_polygon(ImlibPolygon poly)
|
|||
}
|
||||
}
|
||||
|
||||
void imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2, int *py2)
|
||||
void
|
||||
imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2,
|
||||
int *py2)
|
||||
{
|
||||
CHECK_PARAM_POINTER("imlib_polygon_get_bounds", "polygon", poly);
|
||||
__imlib_polygon_get_bounds(poly, px1, py1, px2, py2);
|
||||
}
|
||||
|
||||
void
|
||||
imlib_image_draw_ellipse(int xc, int yc, int a, int b)
|
||||
{
|
||||
ImlibImage *im;
|
||||
|
||||
CHECK_PARAM_POINTER("imlib_draw_ellipse", "image", ctxt_image);
|
||||
CAST_IMAGE(im, ctxt_image);
|
||||
if ((!(im->data)) && (im->loader) && (im->loader->load))
|
||||
im->loader->load(im, NULL, 0, 1);
|
||||
if (!(im->data))
|
||||
return;
|
||||
__imlib_DirtyImage(im);
|
||||
__imlib_DirtyPixmapsForImage(im);
|
||||
|
||||
if (ctxt_cliprect.w)
|
||||
{
|
||||
/* TODO */
|
||||
__imlib_draw_ellipse_clipped(im, xc, yc, a, b, ctxt_cliprect.x,
|
||||
ctxt_cliprect.x + ctxt_cliprect.w,
|
||||
ctxt_cliprect.y,
|
||||
ctxt_cliprect.y + ctxt_cliprect.h,
|
||||
ctxt_color.red, ctxt_color.green,
|
||||
ctxt_color.blue, ctxt_color.alpha,
|
||||
ctxt_operation);
|
||||
}
|
||||
else
|
||||
{
|
||||
__imlib_draw_ellipse(im, xc, yc, a, b, ctxt_color.red, ctxt_color.green,
|
||||
ctxt_color.blue, ctxt_color.alpha, ctxt_operation);
|
||||
}
|
||||
}
|
||||
|
|
238
src/rgbadraw.c
238
src/rgbadraw.c
|
@ -9,6 +9,9 @@
|
|||
#include "updates.h"
|
||||
#include "rgbadraw.h"
|
||||
|
||||
#define XY_IN_RECT(x, y, rx, ry, rw, rh) \
|
||||
(((x) >= (rx)) && ((y) >= (ry)) && ((x) <= ((rx) + (rw))) && ((y) <= ((ry) + (rh))))
|
||||
|
||||
void
|
||||
__imlib_FlipImageHoriz(ImlibImage * im)
|
||||
{
|
||||
|
@ -317,8 +320,7 @@ void
|
|||
__imlib_TileImageHoriz(ImlibImage * im)
|
||||
{
|
||||
DATA32 *p1, *p2, *p3, *p, *data;
|
||||
int x, y, per, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr,
|
||||
gg, bb;
|
||||
int x, y, per, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr, gg, bb;
|
||||
|
||||
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||
p1 = im->data;
|
||||
|
@ -391,9 +393,7 @@ void
|
|||
__imlib_TileImageVert(ImlibImage * im)
|
||||
{
|
||||
DATA32 *p1, *p2, *p, *data;
|
||||
int x, y, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr, gg,
|
||||
|
||||
bb;
|
||||
int x, y, tmp, na, nr, ng, nb, mix, a, r, g, b, aa, rr, gg, bb;
|
||||
|
||||
data = malloc(im->w * im->h * sizeof(DATA32));
|
||||
p = data;
|
||||
|
@ -1228,13 +1228,15 @@ __imlib_draw_line(ImlibImage * im, int x1, int y1, int x2, int y2, DATA8 r,
|
|||
}
|
||||
|
||||
void
|
||||
__imlib_draw_box(ImlibImage * im, int x, int y, int w, int h, DATA8 r, DATA8 g,
|
||||
DATA8 b, DATA8 a, ImlibOp op)
|
||||
__imlib_draw_box(ImlibImage * im, int x, int y, int w, int h, DATA8 r,
|
||||
DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
__imlib_draw_line(im, x, y, x + w - 1, y, r, g, b, a, op, 0);
|
||||
__imlib_draw_line(im, x, y, x, y + h - 1, r, g, b, a, op, 0);
|
||||
__imlib_draw_line(im, x, y + h - 1, x + w - 1, y + h - 1, r, g, b, a, op, 0);
|
||||
__imlib_draw_line(im, x + w - 1, y, x + w - 1, y + h - 1, r, g, b, a, op, 0);
|
||||
__imlib_draw_line(im, x, y + h - 1, x + w - 1, y + h - 1, r, g, b, a, op,
|
||||
0);
|
||||
__imlib_draw_line(im, x + w - 1, y, x + w - 1, y + h - 1, r, g, b, a, op,
|
||||
0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1247,12 +1249,12 @@ __imlib_draw_box_clipped(ImlibImage * im, int x, int y, int w, int h,
|
|||
clip_ymin, clip_ymax, r, g, b, a, op, 0);
|
||||
__imlib_draw_line_clipped(im, x, y, x, y + h - 1, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op, 0);
|
||||
__imlib_draw_line_clipped(im, x, y + h - 1, x + w - 1, y + h - 1, clip_xmin,
|
||||
clip_xmax, clip_ymin, clip_ymax, r, g, b, a, op,
|
||||
0);
|
||||
__imlib_draw_line_clipped(im, x + w - 1, y, x + w - 1, y + h - 1, clip_xmin,
|
||||
clip_xmax, clip_ymin, clip_ymax, r, g, b, a, op,
|
||||
0);
|
||||
__imlib_draw_line_clipped(im, x, y + h - 1, x + w - 1, y + h - 1,
|
||||
clip_xmin, clip_xmax, clip_ymin, clip_ymax, r, g,
|
||||
b, a, op, 0);
|
||||
__imlib_draw_line_clipped(im, x + w - 1, y, x + w - 1, y + h - 1,
|
||||
clip_xmin, clip_xmax, clip_ymin, clip_ymax, r, g,
|
||||
b, a, op, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1439,8 +1441,8 @@ __imlib_copy_image_data(ImlibImage * im, int x, int y, int w, int h, int nx,
|
|||
}
|
||||
|
||||
void
|
||||
__imlib_copy_alpha_data(ImlibImage * src, ImlibImage * dst, int x, int y, int w,
|
||||
int h, int nx, int ny)
|
||||
__imlib_copy_alpha_data(ImlibImage * src, ImlibImage * dst, int x, int y,
|
||||
int w, int h, int nx, int ny)
|
||||
{
|
||||
int xx, yy, jump, jump2;
|
||||
DATA32 *p1, *p2;
|
||||
|
@ -1531,8 +1533,8 @@ __imlib_draw_line_clipped(ImlibImage * im, int x1, int y1, int x2, int y2,
|
|||
int cx0, cx1, cy0, cy1;
|
||||
|
||||
if (imlib_clip_line
|
||||
(x1, y1, x2, y2, clip_xmin, clip_xmax, clip_ymin, clip_ymax, &cx0, &cy0,
|
||||
&cx1, &cy1))
|
||||
(x1, y1, x2, y2, clip_xmin, clip_xmax, clip_ymin, clip_ymax, &cx0,
|
||||
&cy0, &cx1, &cy1))
|
||||
{
|
||||
return __imlib_draw_line(im, cx0, cy0, cx1, cy1, r, g, b, a, op,
|
||||
make_updates);
|
||||
|
@ -1611,8 +1613,8 @@ imlib_clip_line(int x0, int y0, int x1, int y1, int xmin, int xmax, int ymin,
|
|||
}
|
||||
|
||||
ImlibOutCode
|
||||
__imlib_comp_outcode(double x, double y, double xmin, double xmax, double ymin,
|
||||
double ymax)
|
||||
__imlib_comp_outcode(double x, double y, double xmin, double xmax,
|
||||
double ymin, double ymax)
|
||||
{
|
||||
ImlibOutCode code = 0;
|
||||
|
||||
|
@ -1630,6 +1632,7 @@ __imlib_comp_outcode(double x, double y, double xmin, double xmax, double ymin,
|
|||
ImlibPoly __imlib_polygon_new(int type)
|
||||
{
|
||||
ImlibPoly poly;
|
||||
|
||||
poly = malloc(sizeof(_ImlibPoly));
|
||||
if (!poly)
|
||||
return NULL;
|
||||
|
@ -1650,18 +1653,21 @@ ImlibPoly __imlib_polygon_new(int type)
|
|||
return poly;
|
||||
}
|
||||
|
||||
void __imlib_polygon_add_point(ImlibPoly poly, int x, int y)
|
||||
void
|
||||
__imlib_polygon_add_point(ImlibPoly poly, int x, int y)
|
||||
{
|
||||
poly->pointcount++;
|
||||
if (!poly->points)
|
||||
poly->points = malloc(sizeof(ImlibPoint));
|
||||
else
|
||||
poly->points = realloc(poly->points, (poly->pointcount * sizeof(ImlibPoint)));
|
||||
poly->points =
|
||||
realloc(poly->points, (poly->pointcount * sizeof(ImlibPoint)));
|
||||
poly->points[poly->pointcount - 1].x = x;
|
||||
poly->points[poly->pointcount - 1].y = y;
|
||||
}
|
||||
|
||||
void __imlib_polygon_free(ImlibPoly poly)
|
||||
void
|
||||
__imlib_polygon_free(ImlibPoly poly)
|
||||
{
|
||||
free(poly->points);
|
||||
free(poly);
|
||||
|
@ -1673,42 +1679,60 @@ __imlib_draw_polygon(ImlibImage * im, ImlibPoly poly, DATA8 r, DATA8 g,
|
|||
DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!poly || !poly->points || (poly->pointcount < 2))
|
||||
return;
|
||||
|
||||
for (i = 0; i < poly->pointcount; i++)
|
||||
{
|
||||
if (i < poly->pointcount - 1)
|
||||
__imlib_draw_line(im, poly->points[i].x, poly->points[i].y, poly->points[i+1].x, poly->points[i+1].y, r, g, b, a, op, 0);
|
||||
__imlib_draw_line(im, poly->points[i].x, poly->points[i].y,
|
||||
poly->points[i + 1].x, poly->points[i + 1].y, r, g,
|
||||
b, a, op, 0);
|
||||
else if (poly->closed)
|
||||
__imlib_draw_line(im, poly->points[i].x, poly->points[i].y, poly->points[0].x, poly->points[0].y, r, g, b, a, op, 0);
|
||||
else break;
|
||||
__imlib_draw_line(im, poly->points[i].x, poly->points[i].y,
|
||||
poly->points[0].x, poly->points[0].y, r, g, b, a,
|
||||
op, 0);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_draw_polygon_clipped(ImlibImage * im, ImlibPoly poly, int clip_xmin,
|
||||
int clip_xmax, int clip_ymin, int clip_ymax, DATA8 r, DATA8 g, DATA8 b,
|
||||
DATA8 a, ImlibOp op)
|
||||
int clip_xmax, int clip_ymin, int clip_ymax,
|
||||
DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!poly || !poly->points || (poly->pointcount < 2))
|
||||
return;
|
||||
|
||||
for (i = 0; i < poly->pointcount; i++)
|
||||
{
|
||||
if (i < poly->pointcount - 1)
|
||||
__imlib_draw_line_clipped(im, poly->points[i].x, poly->points[i].y, poly->points[i+1].x, poly->points[i+1].y, clip_xmin, clip_xmax, clip_ymin, clip_ymax, r, g, b, a, op, 0);
|
||||
__imlib_draw_line_clipped(im, poly->points[i].x, poly->points[i].y,
|
||||
poly->points[i + 1].x,
|
||||
poly->points[i + 1].y, clip_xmin,
|
||||
clip_xmax, clip_ymin, clip_ymax, r, g, b,
|
||||
a, op, 0);
|
||||
else if (poly->closed)
|
||||
__imlib_draw_line_clipped(im, poly->points[i].x, poly->points[i].y, poly->points[0].x, poly->points[0].y, clip_xmin, clip_xmax, clip_ymin, clip_ymax, r, g, b, a, op, 0);
|
||||
else break;
|
||||
__imlib_draw_line_clipped(im, poly->points[i].x, poly->points[i].y,
|
||||
poly->points[0].x, poly->points[0].y,
|
||||
clip_xmin, clip_xmax, clip_ymin, clip_ymax,
|
||||
r, g, b, a, op, 0);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void __imlib_polygon_get_bounds(ImlibPoly poly, int *px1, int *py1, int *px2, int *py2)
|
||||
void
|
||||
__imlib_polygon_get_bounds(ImlibPoly poly, int *px1, int *py1, int *px2,
|
||||
int *py2)
|
||||
{
|
||||
int x1, y1, x2, y2;
|
||||
int i;
|
||||
|
||||
if (!poly || !poly->points || (poly->pointcount < 2))
|
||||
return;
|
||||
|
||||
|
@ -1720,3 +1744,151 @@ void __imlib_polygon_get_bounds(ImlibPoly poly, int *px1, int *py1, int *px2, in
|
|||
*px2 = x2;
|
||||
*py2 = y2;
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_draw_ellipse(ImlibImage * im, int xc, int yc, int aa, int bb, DATA8 r,
|
||||
DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
int a2 = aa * aa;
|
||||
int b2 = bb * bb;
|
||||
|
||||
int x, y, dec;
|
||||
|
||||
for (x = 0, y = bb, dec = 2 * b2 + a2 * (1 - 2 * bb); b2 * x <= a2 * y;
|
||||
x++)
|
||||
{
|
||||
__imlib_draw_set_point(im, xc + x, yc + y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc - x, yc + y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc + x, yc - y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc - x, yc - y, r, g, b, a, op);
|
||||
|
||||
if (dec >= 0)
|
||||
dec += 4 * a2 * (1 - (y--));
|
||||
dec += b2 * (4 * x + 6);
|
||||
}
|
||||
|
||||
for (x = aa, y = 0, dec = 2 * a2 + b2 * (1 - 2 * aa); a2 * y <= b2 * x;
|
||||
y++)
|
||||
{
|
||||
__imlib_draw_set_point(im, xc + x, yc + y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc - x, yc + y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc + x, yc - y, r, g, b, a, op);
|
||||
__imlib_draw_set_point(im, xc - x, yc - y, r, g, b, a, op);
|
||||
|
||||
if (dec >= 0)
|
||||
dec += 4 * b2 * (1 - (x--));
|
||||
dec += a2 * (4 * y + 6);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_draw_ellipse_clipped(ImlibImage * im, int xc, int yc, int aa, int bb,
|
||||
int clip_xmin, int clip_xmax, int clip_ymin,
|
||||
int clip_ymax, DATA8 r, DATA8 g, DATA8 b,
|
||||
DATA8 a, ImlibOp op)
|
||||
{
|
||||
int a2 = aa * aa;
|
||||
int b2 = bb * bb;
|
||||
|
||||
int x, y, dec;
|
||||
|
||||
for (x = 0, y = bb, dec = 2 * b2 + a2 * (1 - 2 * bb); b2 * x <= a2 * y;
|
||||
x++)
|
||||
{
|
||||
__imlib_draw_set_point_clipped(im, xc + x, yc + y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc - x, yc + y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc + x, yc - y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc - x, yc - y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
|
||||
if (dec >= 0)
|
||||
dec += 4 * a2 * (1 - (y--));
|
||||
dec += b2 * (4 * x + 6);
|
||||
}
|
||||
|
||||
for (x = aa, y = 0, dec = 2 * a2 + b2 * (1 - 2 * aa); a2 * y <= b2 * x;
|
||||
y++)
|
||||
{
|
||||
__imlib_draw_set_point_clipped(im, xc + x, yc + y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc - x, yc + y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc + x, yc - y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
__imlib_draw_set_point_clipped(im, xc - x, yc - y, clip_xmin, clip_xmax,
|
||||
clip_ymin, clip_ymax, r, g, b, a, op);
|
||||
|
||||
if (dec >= 0)
|
||||
dec += 4 * b2 * (1 - (x--));
|
||||
dec += a2 * (4 * y + 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
__imlib_draw_set_point(ImlibImage * im, int x, int y, DATA8 r, DATA8 g,
|
||||
DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
DATA32 *p;
|
||||
int tmp;
|
||||
|
||||
if ((x >= 0 && x < im->w) && (y >= 0 && y <= im->h))
|
||||
{
|
||||
p = &(im->data[(im->w * y) + x]);
|
||||
switch (op)
|
||||
{
|
||||
case OP_RESHADE:
|
||||
BLEND_RE(r, g, b, a, p);
|
||||
break;
|
||||
case OP_SUBTRACT:
|
||||
BLEND_SUB(r, g, b, a, p);
|
||||
break;
|
||||
case OP_ADD:
|
||||
BLEND_ADD(r, g, b, a, p);
|
||||
break;
|
||||
case OP_COPY:
|
||||
BLEND(r, g, b, a, p);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__imlib_draw_set_point_clipped(ImlibImage * im, int x, int y, int clip_xmin,
|
||||
int clip_xmax, int clip_ymin, int clip_ymax,
|
||||
DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op)
|
||||
{
|
||||
DATA32 *p;
|
||||
int tmp;
|
||||
|
||||
if ((x >= 0 && x < im->w) && (y >= 0 && y <= im->h))
|
||||
{
|
||||
if (XY_IN_RECT
|
||||
(x, y, clip_xmin, clip_ymin, clip_xmax - clip_xmin, clip_ymax - clip_ymin))
|
||||
{
|
||||
p = &(im->data[(im->w * y) + x]);
|
||||
switch (op)
|
||||
{
|
||||
case OP_RESHADE:
|
||||
BLEND_RE(r, g, b, a, p);
|
||||
break;
|
||||
case OP_SUBTRACT:
|
||||
BLEND_SUB(r, g, b, a, p);
|
||||
break;
|
||||
case OP_ADD:
|
||||
BLEND_ADD(r, g, b, a, p);
|
||||
break;
|
||||
case OP_COPY:
|
||||
BLEND(r, g, b, a, p);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,4 +93,19 @@ __imlib_draw_polygon_clipped(ImlibImage * im, ImlibPoly poly, int clip_xmin,
|
|||
int clip_xmax, int clip_ymin, int clip_ymax, DATA8 r, DATA8 g, DATA8 b,
|
||||
DATA8 a, ImlibOp op);
|
||||
void __imlib_polygon_get_bounds(ImlibPoly poly, int *px1, int *py1, int *px2, int *py2);
|
||||
void
|
||||
__imlib_draw_set_point(ImlibImage * im, int x, int y, DATA8 r, DATA8 g,
|
||||
DATA8 b, DATA8 a, ImlibOp op);
|
||||
void
|
||||
__imlib_draw_set_point_clipped(ImlibImage * im, int x, int y, int clip_xmin,
|
||||
int clip_xmax, int clip_ymin, int clip_ymax,
|
||||
DATA8 r, DATA8 g, DATA8 b, DATA8 a, ImlibOp op);
|
||||
void
|
||||
__imlib_draw_ellipse(ImlibImage * im, int xc, int yc, int aa, int bb, DATA8 r,
|
||||
DATA8 g, DATA8 b, DATA8 a, ImlibOp op);
|
||||
void
|
||||
__imlib_draw_ellipse_clipped(ImlibImage * im, int xc, int yc, int aa, int bb,
|
||||
int clip_xmin, int clip_xmax, int clip_ymin,
|
||||
int clip_ymax, DATA8 r, DATA8 g, DATA8 b,
|
||||
DATA8 a, ImlibOp op);
|
||||
#endif
|
||||
|
|
14
test/main.c
14
test/main.c
|
@ -778,6 +778,19 @@ int main (int argc, char **argv)
|
|||
uu = imlib_image_draw_line(200, 200, x, y, 1);
|
||||
up = imlib_updates_append_updates(up, uu);
|
||||
|
||||
/* test ellipses */
|
||||
imlib_context_set_cliprect(0,0,0,0);
|
||||
imlib_context_set_color(255, 255, 255, 255);
|
||||
imlib_image_draw_ellipse(50,280,30,40);
|
||||
|
||||
imlib_image_draw_rectangle(120,245,70,70);
|
||||
up = imlib_update_append_rect(up, 120,245,70,70);
|
||||
imlib_image_draw_ellipse(160,280,50,20);
|
||||
|
||||
imlib_context_set_cliprect(120,245,70,70);
|
||||
imlib_context_set_color(255, 55, 55, 255);
|
||||
imlib_image_draw_ellipse(160,280,50,20);
|
||||
|
||||
/* test line clipping */
|
||||
imlib_context_set_cliprect(0,0,0,0);
|
||||
imlib_image_draw_rectangle(50,50,100,100);
|
||||
|
@ -846,7 +859,6 @@ int main (int argc, char **argv)
|
|||
imlib_image_draw_polygon(poly3);
|
||||
imlib_context_set_cliprect(0,0,0,0);
|
||||
|
||||
|
||||
}
|
||||
{
|
||||
static Imlib_Color_Range rg = NULL;
|
||||
|
|
Loading…
Reference in New Issue