Giter VIP home page Giter VIP logo

pictureedit---add-custom-graphic-operation-watermark-to-the-image-editor-dialog's Introduction

How to add custom graphic operations (watermarks) to the built-in editor dialog for a PictureEdit control

The PictureEdit control provides a built-in editor that allows users to perform basic graphic operations on the displayed image.

  • Crop and straighten
  • Adjust brightness, contrast and saturation
  • Mirror
  • Rotate, etc.

This example shows how to extend the editor with custom graphic commands that add watermarks to the current image.

image

The steps to add a WatermarkCommand (and other commands) to the image editor are as follows.

  1. Create a new class (WatermarkGraphicOperation) that performs an operation on an image. The operation must be a BaseCachedGraphicOperation descendant. Users can undo and redo BaseCachedGraphicOperations while the image editor is active.

  2. You can allow users to specify the operation's settings in custom controls before the operation is applied. Create a panel with controls and implement the IToolSettingsControl interface for the panel. The IToolSettingsControl.GetOperation method must return the customized graphic operation (WatermarkGraphicOperation).

    This example creates a user control (WatermarkToolControl) with controls to enter the watermark-related settings:

    • a TextEditor to enter the watermark text
    • a ColorEditor to specify the font color
    • a SpinEditor to enter the font size
    • a CheckEditor to allow the watermark text to be repeated throughout the image.
  3. Handle the PictureEdit.ImageEditorDialogShowing event to add custom commands (buttons) to the editor's main toolbar.

    In the example two commands are added:

    • WatermarkPreset - Invokes the WatermarkGraphicOperation with predefined settings.
    • WatermarkCommand - Displays the WatermarkToolControl in which users can specify custom watermark settings and then apply the WatermarkGraphicOperation.

pictureedit---add-custom-graphic-operation-watermark-to-the-image-editor-dialog's People

Contributors

alexey-zolotarev avatar alexmedusa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.