コード例 #1
0
ファイル: api_masks.c プロジェクト: CSRedRat/mesa-1
void vegaMask(VGHandle mask, VGMaskOperation operation,
              VGint x, VGint y,
              VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();

   if (width <=0 || height <= 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   if (operation < VG_CLEAR_MASK || operation > VG_SUBTRACT_MASK) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }


   vg_validate_state(ctx);

   if (operation == VG_CLEAR_MASK) {
      mask_fill(x, y, width, height, 0.f);
   } else if (operation == VG_FILL_MASK) {
      mask_fill(x, y, width, height, 1.f);
   } else if (vg_object_is_valid(mask, VG_OBJECT_IMAGE)) {
      struct vg_image *image = handle_to_image(mask);
      mask_using_image(image, operation, x, y, width, height);
   } else if (vg_object_is_valid(mask, VG_OBJECT_MASK)) {
      struct vg_mask_layer *layer = handle_to_masklayer(mask);
      mask_using_layer(layer, operation, x, y, width, height);
   } else {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
   }
}
コード例 #2
0
void vegaPaintPattern(VGPaint paint, VGImage pattern)
{
   struct vg_context *ctx = vg_current_context();

   if (paint == VG_INVALID_HANDLE ||
       !vg_context_is_object_valid(ctx, VG_OBJECT_PAINT, (void *)paint)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   if (pattern == VG_INVALID_HANDLE) {
      paint_set_type((struct vg_paint*)paint, VG_PAINT_TYPE_COLOR);
      return;
   }

   if (!vg_context_is_object_valid(ctx, VG_OBJECT_IMAGE, (void *)pattern)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }


   if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT) ||
       !vg_object_is_valid((void*)pattern, VG_OBJECT_IMAGE)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   paint_set_pattern((struct vg_paint*)paint,
                     (struct vg_image*)pattern);
}
コード例 #3
0
ファイル: api_images.c プロジェクト: MttDs/new-rexeno-tindpe
VGImage vgChildImage(VGImage parent,
                     VGint x, VGint y,
                     VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct vg_image *p;

   if (parent == VG_INVALID_HANDLE ||
       !vg_context_is_object_valid(ctx, VG_OBJECT_IMAGE, (void*)parent) ||
       !vg_object_is_valid((void*)parent, VG_OBJECT_IMAGE)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return VG_INVALID_HANDLE;
   }
   if (width <= 0 || height <= 0 || x < 0 || y < 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return VG_INVALID_HANDLE;
   }
   p = (struct vg_image *)parent;
   if (x > p->width  || y > p->height) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return VG_INVALID_HANDLE;
   }
   if (x + width > p->width  || y + height > p->height) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return VG_INVALID_HANDLE;
   }

   return (VGImage)image_child_image(p, x, y, width, height);
}
コード例 #4
0
ファイル: api_masks.c プロジェクト: CSRedRat/mesa-1
void vegaCopyMask(VGMaskLayer maskLayer,
                  VGint sx, VGint sy,
                  VGint dx, VGint dy,
                  VGint width, VGint height)
{
   struct vg_context *ctx = vg_current_context();
   struct vg_mask_layer *mask = 0;

   if (maskLayer == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   if (width <= 0 || height <= 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }
   if (!vg_object_is_valid(maskLayer, VG_OBJECT_MASK)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   vg_validate_state(ctx);

   mask = handle_to_masklayer(maskLayer);
   mask_copy(mask, sx, sy, dx, dy, width, height);
}
コード例 #5
0
ファイル: api_masks.c プロジェクト: CSRedRat/mesa-1
void vegaRenderToMask(VGPath path,
                      VGbitfield paintModes,
                      VGMaskOperation operation)
{
   struct vg_context *ctx = vg_current_context();

   if (path == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   if (!paintModes || (paintModes&(~(VG_STROKE_PATH|VG_FILL_PATH)))) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }
   if (operation < VG_CLEAR_MASK ||
       operation > VG_SUBTRACT_MASK) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }
   if (!vg_object_is_valid(path, VG_OBJECT_PATH)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   vg_validate_state(ctx);

   mask_render_to(handle_to_path(path), paintModes, operation);
}
コード例 #6
0
ファイル: api_paint.c プロジェクト: venkatarajasekhar/Qt
void vegaSetPaint(VGPaint paint, VGbitfield paintModes)
{
   struct vg_context *ctx = vg_current_context();

   if (paint == VG_INVALID_HANDLE) {
      /* restore the default */
      paint = paint_to_handle(ctx->default_paint);
   } else if (!vg_object_is_valid(paint, VG_OBJECT_PAINT)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   if (!(paintModes & ((VG_FILL_PATH|VG_STROKE_PATH)))) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   if (paintModes & VG_FILL_PATH) {
      ctx->state.vg.fill_paint = handle_to_paint(paint);
   }
   if (paintModes & VG_STROKE_PATH) {
      ctx->state.vg.stroke_paint = handle_to_paint(paint);
   }

   ctx->state.dirty |= PAINT_DIRTY;
}
コード例 #7
0
ファイル: api_images.c プロジェクト: MttDs/new-rexeno-tindpe
void vgDestroyImage(VGImage image)
{
   struct vg_context *ctx = vg_current_context();
   struct vg_image *img = (struct vg_image *)image;

   if (image == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   if (!vg_object_is_valid((void*)image, VG_OBJECT_IMAGE)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   image_destroy(img);
}
コード例 #8
0
ファイル: api_text.c プロジェクト: GunioRobot/mesa-7.10.2-PS3
void vegaDestroyFont(VGFont f)
{
   struct vg_font *font = (struct vg_font *)f;
   struct vg_context *ctx = vg_current_context();

   if (f == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   if (!vg_object_is_valid((void *) font, VG_OBJECT_FONT)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   font_destroy(font);
}
コード例 #9
0
ファイル: api_masks.c プロジェクト: CSRedRat/mesa-1
void vegaDestroyMaskLayer(VGMaskLayer maskLayer)
{
   struct vg_mask_layer *mask = 0;
   struct vg_context *ctx = vg_current_context();

   if (maskLayer == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   if (!vg_object_is_valid(maskLayer, VG_OBJECT_MASK)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   mask = handle_to_masklayer(maskLayer);
   mask_layer_destroy(mask);
}
コード例 #10
0
void vegaSetColor(VGPaint paint, VGuint rgba)
{
   struct vg_context *ctx = vg_current_context();

   if (paint == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }
   {
      struct vg_paint *p = (struct vg_paint *)paint;
      paint_set_colori(p, rgba);
   }
}
コード例 #11
0
ファイル: api_masks.c プロジェクト: CSRedRat/mesa-1
void vegaFillMaskLayer(VGMaskLayer maskLayer,
                       VGint x, VGint y,
                       VGint width, VGint height,
                       VGfloat value)
{
   struct vg_mask_layer *mask = 0;
   struct vg_context *ctx = vg_current_context();

   if (maskLayer == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   if (value < 0 || value > 1) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   if (width <= 0 || height <= 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }
   if (x < 0 || y < 0 || (x + width) < 0 || (y + height) < 0) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   if (!vg_object_is_valid(maskLayer, VG_OBJECT_MASK)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   mask = handle_to_masklayer(maskLayer);

   if (x + width > mask_layer_width(mask) ||
       y + height > mask_layer_height(mask)) {
      vg_set_error(ctx, VG_ILLEGAL_ARGUMENT_ERROR);
      return;
   }

   vg_validate_state(ctx);

   mask_layer_fill(mask, x, y, width, height, value);
}
コード例 #12
0
VGuint vegaGetColor(VGPaint paint)
{
   struct vg_context *ctx = vg_current_context();
   struct vg_paint *p;
   VGuint rgba = 0;

   if (paint == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return rgba;
   }

   if (!vg_object_is_valid((void*)paint, VG_OBJECT_PAINT)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return rgba;
   }
   p = (struct vg_paint *)paint;

   return paint_colori(p);
}
コード例 #13
0
ファイル: api_paint.c プロジェクト: venkatarajasekhar/Qt
void vegaSetColor(VGPaint paint, VGuint rgba)
{
   struct vg_context *ctx = vg_current_context();
   struct vg_paint *p;

   if (paint == VG_INVALID_HANDLE) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   if (!vg_object_is_valid(paint, VG_OBJECT_PAINT)) {
      vg_set_error(ctx, VG_BAD_HANDLE_ERROR);
      return;
   }

   p = handle_to_paint(paint);
   paint_set_colori(p, rgba);

   if (ctx->state.vg.fill_paint == p ||
       ctx->state.vg.stroke_paint == p)
      ctx->state.dirty |= PAINT_DIRTY;
}