Warning, /graphics/krita/libs/libkis/Mainpage.dox is written in an unsupported language. File is not indexed.

0001 /*
0002  *  Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program; if not, write to the Free Software
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 /**
0020   \mainpage libkis: Krita Scripting and Plugin Wrapper Library
0021 
0022   Libkis is a QObject-based wrapper around Krita's internal libraries.
0023   The wrapper can be used from C++ plugins that do not need the
0024   advanced and volatile internal libraries of Krita, or can be bound
0025   to scripting languages like Python or Javascript.
0026 
0027   All classes are based on QObject, so QMetaObject introspection can
0028   be used to discover properties, slots and signals and automatically
0029   expose all functionality to the client.
0030 
0031   Note that all objects that are created are wrapper objects that are
0032   owned by the scripting environment or the plugin.
0033 
0034 
0035   Using the functionality in this library, either through a scripting
0036   environment like Python or Javascript, or directly from C++, you can,
0037   among other things achieve the following functionality:
0038 
0039   <ul>
0040      <li>Open, save, export, rename files.
0041      <li>Access the layers and masks in a file
0042      <li>Read and write pixel data
0043      <li>Add menu items, toolbar items and docker palettes
0044   </ul>
0045 
0046   The reference implementation of scripting in Krita is implemented
0047   in Python 3. All examples in the documentation for scripting will be
0048   provided using Python, although the api documentation is generated
0049   from C++ header files and shows c++ syntax for arguments.
0050 
0051   Autostarting Scripts
0052   ====================
0053 
0054   Autostarting scripts or script-based plugins are scripts that Krita
0055   loads on startup. You can add autostarting scripts to Krita by placing
0056   them in the pykrita folder in the resources folder: go to settings/
0057   manage resources and press the Open Resources Folder to open your
0058   local resources folder.
0059 
0060   Scripts are identified by a file that ends in a `.desktop` extension
0061   that contain information about the script itself. For example:
0062 
0063 @code
0064     [Desktop Entry]
0065     Type=Service
0066     ServiceTypes=Krita/PythonPlugin
0067     X-KDE-Library=hello
0068     X-Python-2-Compatible=false
0069     Name=Hello World
0070     Comment=Basic plugin to test PyKrita
0071 @endcode
0072 
0073   The Python code itself should be placed in the pykrita/hello folder.
0074   Your Python plugin needs to be a module, so needs to have a `__init__.py`
0075   file:
0076 
0077 @code
0078     # let's make a module
0079     from .hello import *
0080 @endcode
0081 
0082 Krita is a Qt-based application. In principle, you can use any Python
0083 binding to Qt as long as it's using exactly the same version of Qt
0084 that Krita uses. In our examples we will be using [PyQt](https://www.riverbankcomputing.com/software/pyqt/intro).
0085 
0086 The easiest access to the Krita api is by simply importing the "krita"
0087 module. This automatically adds two built-ins: Scripter and Application.
0088 
0089 This is an alias for Krita.instance(), which is the first place from
0090 which to access the running Krita instance.
0091 
0092 @code
0093 from PyQt5.QtGui import *
0094 from PyQt5.QtWidgets import *
0095 from krita import *
0096 
0097 def hello():
0098     QMessageBox.information(QWidget(), "Test", "Hello World")
0099 
0100 class HelloExtension(Extension):
0101 
0102   def __init__(self, parent):
0103       super().__init__(parent)
0104 
0105   def setup(self):
0106       pass
0107 
0108   def createActions(self, window):
0109       action = window.createAction("Hello")
0110       action.triggered.connect(hello)
0111 
0112 Krita.instance().addExtension(HelloExtension(Krita.instance()))
0113 @endcode
0114 
0115 
0116 The Krita Object Model
0117 ======================
0118 
0119 The starting point is the @see Krita class, which provides a singleton
0120 object for easy reference. From the Krita class, a hierarchy is provided
0121 where you can access windows, lviews, documents, nodes and channels.
0122 
0123 You can access the Krita class as
0124 
0125  * Krita.instance()
0126  * Application
0127  * Scripter
0128 
0129 For ease of use.
0130 
0131 The Document class is provided to allow access to the images Krita has
0132 loaded. *Note*: internally, Krita distinguishes between images and documents.
0133 
0134 A document contains an image and knows the filename of the image, the image
0135 itself only knows about the layers and masks it contains. The generic
0136 name for layers and masks is *node*.
0137 
0138 A Node can be a group layer, a file layer, a vector layer, a filter layer,
0139 a generator layer, a clone layer, a paint layer or a transform mask, a selection
0140 mask, a transparency mask or a colorize mask. You can change some properties
0141 of Nodes, but not all of them.
0142 
0143 The Window class is provided to allow access to the windows and views Krita
0144 has open. A given Document can be shown in more than one View, and in more than
0145 one Window. You can open and close windows and views.
0146 
0147  */
0148 
0149 // DOXYGEN_SET_PROJECT_NAME = Krita
0150 // DOXYGEN_SET_IGNORE_PREFIX = Kis Ko K