Warning, /graphics/krita/libs/brush/Mainpage.dox is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright (C) 2006 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 LibBrush 0021 0022 March 2008 0023 0024 <h1>About libbrush</h1> 0025 0026 libbrush is a library for handling brush resources. Brush resources 0027 should not be confused with brush engines (or paintops). Brush engines 0028 may or may not use a brush resource. Basically, brush resources provide 0029 an image to make "footprints" with on the canvas, like with a potato 0030 stamp. 0031 0032 A brush's task is to basically return an image or a mask (depending on 0033 the type) when the brush engine asks for it. The KisBrush class can 0034 also keep a set of prescaled brush images or masks, which is handy 0035 when using the pressure-size curve option for tablets. 0036 0037 There are several kinds of brush types: 0038 0039 <ul> 0040 <li> gbr: Gimp one-image brushes, either a grayscale mask or a colored image. 0041 There are also 16-bit .gbr brushes, created and used by CinePaint. 0042 Krita is compatible with those, too. 0043 <li> gih: Gimp image hose brushes. Image hoses contain a set of images and 0044 some instructions to determine which image comes next 0045 <li> custom: this brush is generator from the image or a selection of the image 0046 and can be saved as an ordinary gbr or gih brush. 0047 <li> text: a basic brush created from some text and a font 0048 <li> auto: a brush defined from a shape and some parameters. 0049 </ul> 0050 0051 Other applications support other types of brushes: 0052 0053 <ul> 0054 <li> png: krita used to use png images in stead of gbr brushes, and there 0055 are (march 2009) some noises that GIMP might want to use png 0056 brushes again. 0057 <li> svg: defining brushes in svg format has the advantage that scaling is 0058 lot nicer. 0059 <li> abr: photoshop's brush format. Early versions are open, later versions 0060 are closed 0061 <li> painter: Corel Painter has its own closed brush format that would be 0062 interesting to support 0063 <li> myb: mypaint brushes. Open source and we really should try to support 0064 them, though it may only be useful for a special-built paintop. 0065 </ul> 0066 0067 Right now there is no way to categorize brushes into sets: there is some 0068 GIMP code that allows users to tag resources, but it is not easy to use 0069 that to deliver brush sets that are pre-tagged. 0070 0071 <h2>Architecture</h2> 0072 0073 The original brush resource architecture used a resource server, 0074 resource mediator and resource chooser. It was impossible to retrieve 0075 a specific brush by name or to serialize and deserialize brushes. 0076 We are transitioning to the ordinary Krita 0077 registry/factory/instance/settings/settings widget pattern, where 0078 the registry loads plugins, the plugins add a factory to the registry 0079 and provides instances to the application. For now, it's still a 0080 bit mixed. 0081 0082 Brush plugins cannot yet provide a gui for editing or choosing a brush; 0083 all brush plugins must add the brushes they load to the brush resource 0084 server. The interaction is as follows: 0085 0086 <ul> 0087 <li> KisBrushRegistry is instantiated 0088 <li> KBR loads all plugins 0089 <li> Plugins instantiate a factory and add it to the KBR 0090 <li> The KBR asks the factories to load existing resources 0091 <li> The factories add the existing resources to the KisBrushServer 0092 </ul> 0093 0094 <h2>Serializing and deserializing, and creating brushes</h2> 0095 0096 Brushes have a toXML function that can be used to store a brush with 0097 settings in an xml file, for instance for action recording or paintop 0098 presets. The xml _must_ contain a brush_type_id. 0099 0100 The KisBrushRegistry has a getOrCreate method that takes this xml and 0101 determines which bruhs factory to use: the brush factory then analyzes 0102 the xml and determines whether to create a new brush or retrieve an 0103 instance of a loaded brush. 0104 0105 The KisBrush::fromXML method hides all this complexity from the user. 0106 0107 <h2>Widgets</h2> 0108 0109 Currently, all brush settings widgets are in libpaintop. If we want completely 0110 independent brush plugins or use libbrush from other places, like some filters, 0111 we need to move the widgets in here. 0112 0113 */ 0114 // DOXYGEN_SET_IGNORE_PREFIX = Kis Ko K