BGRAControls/zh CN: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: BGRAControls/zh CN
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # Install | |
| 2 | + | ||
| 3 | + | ### Download BGRABitmap | |
| 4 | + | ||
| 5 | + | Install BGRABitmap with the file bgrabitmappack.lpk. | |
| 6 | + | ||
| 7 | + | GitHub: <https://github.com/bgrabitmap/lazpaint/> | |
| 8 | + | ||
| 9 | + | ### Download BGRAControls | |
| 10 | + | ||
| 11 | + | Install BGRAControls with the file bgracontrols.lpk. | |
| 12 | + | ||
| 13 | + | GitHub: <https://github.com/bgrabitmap/bgracontrols/> | |
| 14 | + | ||
| 15 | + | ## 概述 | |
| 16 | + | ||
| 17 | + | 许可: Modified LGPL 版本 2.0. | |
| 18 | + | ||
| 19 | + | 像许多人了解的那样, Lazarus GTK 没有完整的支持Alpha通道. 我创建了一套组件,使用 TBGRABitmap 绘制图标,因此它可以部分解决 GTK 中的Alpha通道问题。 无论如何, 这套组件并不仅仅是GTK的补丁,而是建立在强大的BGRABitmap组件包上,提供了更多的有趣的组件. | |
| 20 | + | ||
| 21 | + | ### 作者: Dibo. | |
| 22 | + | ||
| 23 | + | 组件包创建者和维护者. | |
| 24 | + | ||
| 25 | + | BC Controls - TBCButton - TBCLabel - TBCPanel | |
| 26 | + | ||
| 27 | + | BGRA Controls - TBGRAImageList - TBGRASpeedButton | |
| 28 | + | ||
| 29 | + | ### 作者: Circular. | |
| 30 | + | ||
| 31 | + | BGRABitmap 创建者, 贡献者和组件包维护者. | |
| 32 | + | ||
| 33 | + | \- TBGRAFlashProgressBar - TBGRAGraphicControl - TBGRAKnob - TBGRAShape - TBGRAVirtualScreen | |
| 34 | + | ||
| 35 | + | ### 作者: Lainz. | |
| 36 | + | ||
| 37 | + | 贡献者和组件包维护者. | |
| 38 | + | ||
| 39 | + | BC Controls - TBCImageButton - TBCXButton - TBCGameGrid | |
| 40 | + | ||
| 41 | + | BGRA Controls - TBGRASpriteAnimation | |
| 42 | + | ||
| 43 | + | ### 作者: Emerson Cavalcanti. | |
| 44 | + | ||
| 45 | + | \- TBGRAImageManipulation | |
| 46 | + | ||
| 47 | + | ### 作者: mora. | |
| 48 | + | ||
| 49 | + | \- BCButton功能性贡献者. | |
| 50 | + | ||
| 51 | + | ### 作者: helix2001 | |
| 52 | + | ||
| 53 | + | \- TBGRAResizeSpeedButton. | |
| 54 | + | ||
| 55 | + | ## 相关文章 | |
| 56 | + | ||
| 57 | + | [[BGRASpriteAnimation]] - 精灵动画组件的用法. | |
| 58 | + | ||
| 59 | + | [[uE Controls]] - 用 BGRABitmap 开发其他控件. | |
| 60 | + | ||
| 61 | + | [[BGRABitmap]] - 创建本组件使用的控件库. | |
| 62 | + | ||
| 63 | + | [[LazPaint]] - 使用Lazarus 和 BGRABitmap开发的一个绘画程序. | |
| 64 | + | ||
| 65 | + | ## BC | |
| 66 | + | ||
| 67 | + | ### BCButton | |
| 68 | + | ||
| 69 | + | <figure> | |
| 70 | + | <img src="bcbutton.png" title="bcbutton.png" /> | |
| 71 | + | <figcaption>bcbutton.png</figcaption> | |
| 72 | + | </figure> | |
| 73 | + | ||
| 74 | + | ### BCGameGrid | |
| 75 | + | ||
| 76 | + | <figure> | |
| 77 | + | <img src="bcgamegrid.png" title="bcgamegrid.png" /> | |
| 78 | + | <figcaption>bcgamegrid.png</figcaption> | |
| 79 | + | </figure> | |
| 80 | + | ||
| 81 | + | ### BCImageButton | |
| 82 | + | ||
| 83 | + | bitmap(位图)必须包含4种状态(自顶到底, 具有同样的Height(高度)) 按照下列顺序: normal(常规、弹起状态), hover(指针滑过), active(活动的、选中), disabled(已禁用). | |
| 84 | + | ||
| 85 | + | *示例按钮:* | |
| 86 | + | ||
| 87 | + | <figure> | |
| 88 | + | <img src="samplebgraimagebutton.png" title="samplebgraimagebutton.png" /> | |
| 89 | + | <figcaption>samplebgraimagebutton.png</figcaption> | |
| 90 | + | </figure> | |
| 91 | + | ||
| 92 | + | *示例按钮(带Alpha通道):* | |
| 93 | + | ||
| 94 | + | <figure> | |
| 95 | + | <img src="samplebgraimagebuttonalpha.png" title="samplebgraimagebuttonalpha.png" /> | |
| 96 | + | <figcaption>samplebgraimagebuttonalpha.png</figcaption> | |
| 97 | + | </figure> | |
| 98 | + | ||
| 99 | + | ### BCXButton | |
| 100 | + | ||
| 101 | + | 高度可定制按钮,具有'OnRenderControl' 事件. 此控件没有默认属性,它假定你将重写此控件并添加你希望具有的一切特性。 | |
| 102 | + | ||
| 103 | + | \- 像 TCDButton (自定义绘制的按钮). | |
| 104 | + | ||
| 105 | + | \- 为每一个按钮调用一个(或者为所有按钮调用一个) 'OnRenderControl' 事件 (like a Drawer in CD) . | |
| 106 | + | ||
| 107 | + | \- 创建高度可定制的按钮, 类似BGRAVirtualScreen 或者 BCGraphicControl的用法. | |
| 108 | + | ||
| 109 | + | <figure> | |
| 110 | + | <img src="bcxbutton.png" title="bcxbutton.png" /> | |
| 111 | + | <figcaption>bcxbutton.png</figcaption> | |
| 112 | + | </figure> | |
| 113 | + | ||
| 114 | + | ### BCLabel | |
| 115 | + | ||
| 116 | + | <figure> | |
| 117 | + | <img src="bclabel.png" title="bclabel.png" /> | |
| 118 | + | <figcaption>bclabel.png</figcaption> | |
| 119 | + | </figure> | |
| 120 | + | ||
| 121 | + | ### BCPanel | |
| 122 | + | ||
| 123 | + | <figure> | |
| 124 | + | <img src="bcpanel.png" title="bcpanel.png" /> | |
| 125 | + | <figcaption>bcpanel.png</figcaption> | |
| 126 | + | </figure> | |
| 127 | + | ||
| 128 | + | ## BGRA | |
| 129 | + | ||
| 130 | + | ### BGRAProgressBar | |
| 131 | + | ||
| 132 | + | **用来替代:** TProgressBar | |
| 133 | + | ||
| 134 | + | <figure> | |
| 135 | + | <img src="BC-Bgraflashprogressbar.png" title="BC-Bgraflashprogressbar.png" /> | |
| 136 | + | <figcaption>BC-Bgraflashprogressbar.png</figcaption> | |
| 137 | + | </figure> | |
| 138 | + | ||
| 139 | + | Flash progressbar 由circular创建. | |
| 140 | + | ||
| 141 | + | ### BGRAGraphicControl | |
| 142 | + | ||
| 143 | + | **用来替代:** TPaintBox | |
| 144 | + | ||
| 145 | + | TBGRAGraphicControl, 允许你绘制带有Alpha通道混合特性的组件. | |
| 146 | + | ||
| 147 | + | ### BGRAImageList | |
| 148 | + | ||
| 149 | + | **用来替代:** TImageList | |
| 150 | + | ||
| 151 | + | **之前:** | |
| 152 | + | ||
| 153 | + | <figure> | |
| 154 | + | <img src="before-TImageList.png" title="before-TImageList.png" /> | |
| 155 | + | <figcaption>before-TImageList.png</figcaption> | |
| 156 | + | </figure> | |
| 157 | + | ||
| 158 | + | **之后:** | |
| 159 | + | ||
| 160 | + | <figure> | |
| 161 | + | <img src="after-TBGRAImageList.png" title="after-TBGRAImageList.png" /> | |
| 162 | + | <figcaption>after-TBGRAImageList.png</figcaption> | |
| 163 | + | </figure> | |
| 164 | + | ||
| 165 | + | 该组件继承自TImageList. 因此每个组件(测试过TToolBar 和 TTreeView) 使用TImageList.Draw方法来绘制图标, 并自动带alpha通道支持. 只需要用该组件替代TImageList. 该组件只是启动了 GTK 的alpha通道, 因此在Windows (或其他界面)中它的表现和原来的TImageList一样 (它没有使用BGRABitmap来进行绘制). | |
| 166 | + | ||
| 167 | + | ### BGRAImageManipulation | |
| 168 | + | ||
| 169 | + | **用来替代:** TImage | |
| 170 | + | ||
| 171 | + | 便于在应用程序中导入图像的组件. | |
| 172 | + | ||
| 173 | + | 在当前版本中可以导入图像,并按照保持纵横比(或不保持)进行剪裁。例如,如果您想要导入的相片使用 3x4 的比例,只需要调整'ratio'属性设置为 3: 4。如果导入的图像具有不同的大小,该组件将确保图像符合所需尺寸的比例。 | |
| 174 | + | ||
| 175 | + | 你可以通过调整属性'MinWidth' 和 'MinHeight'来确定图像的最小尺寸. | |
| 176 | + | ||
| 177 | + | 你可以使用内建的功能来旋转图像. | |
| 178 | + | ||
| 179 | + | 参见组件的演示: | |
| 180 | + | ||
| 181 | + | <figure> | |
| 182 | + | <img src="bgraimagemanipulation.jpg" title="bgraimagemanipulation.jpg" /> | |
| 183 | + | <figcaption>bgraimagemanipulation.jpg</figcaption> | |
| 184 | + | </figure> | |
| 185 | + | ||
| 186 | + | 当组件将图像更改后, 只需要使用stretch(缩放)将其放入目标组件即可. 很显然目标必须具有同样的纵横比以保证最终的结果不会变形. | |
| 187 | + | ||
| 188 | + | ### BGRAKnob | |
| 189 | + | ||
| 190 | + | <figure> | |
| 191 | + | <img src="BC-Bgraknob.png" title="BC-Bgraknob.png" /> | |
| 192 | + | <figcaption>BC-Bgraknob.png</figcaption> | |
| 193 | + | </figure> | |
| 194 | + | ||
| 195 | + | 图形化的旋钮组件, 由circular创建. | |
| 196 | + | ||
| 197 | + | ### BGRAShape | |
| 198 | + | ||
| 199 | + | **用来替代:** TShape | |
| 200 | + | ||
| 201 | + | <figure> | |
| 202 | + | <img src="samplebgrashape.png" title="samplebgrashape.png" /> | |
| 203 | + | <figcaption>samplebgrashape.png</figcaption> | |
| 204 | + | </figure> | |
| 205 | + | ||
| 206 | + | 该组件具有完整的Alpha通道支持并且可以放置你希望的任意多边形,同时具有圆角边框和渐变特性(线性, 放射, 菱形, 反射). | |
| 207 | + | ||
| 208 | + | ### BGRASpeedButton | |
| 209 | + | ||
| 210 | + | **用来替代:** TSpeedButton | |
| 211 | + | ||
| 212 | + | <figure> | |
| 213 | + | <img src="BGRASpeedButton.png" title="BGRASpeedButton.png" /> | |
| 214 | + | <figcaption>BGRASpeedButton.png</figcaption> | |
| 215 | + | </figure> | |
| 216 | + | ||
| 217 | + | 该组件继承自TSpeedButton并使用TBGRABitmap来绘制图形. 该组件只是启动了 GTK 的alpha通道, 因此在Windows (或其他界面)中它的表现和原来的TImageList一样 (它没有使用BGRABitmap来进行绘制). | |
| 218 | + | ||
| 219 | + | ### BGRASpriteAnimation | |
| 220 | + | ||
| 221 | + | **用来替代:** TImage | |
| 222 | + | ||
| 223 | + | 更多信息请阅读文章 [[BGRASpriteAnimation]]. | |
| 224 | + | ||
| 225 | + | <figure> | |
| 226 | + | <img src="bgraspriteanimation.png" title="bgraspriteanimation.png" /> | |
| 227 | + | <figcaption>bgraspriteanimation.png</figcaption> | |
| 228 | + | </figure> | |
| 229 | + | ||
| 230 | + | 使用该组件你可以进行位图动画. 你需要一个包含所有动画帧图像并按水平排列的位图. | |
| 231 | + | ||
| 232 | + | 它可以指定动画将要播放的次数 (0 为一直播放, 1, 2, 等等) 并可以停止播放, 同时它可以指定播放速度和方向并支持透明. | |
| 233 | + | ||
| 234 | + | 特性: | |
| 235 | + | ||
| 236 | + | - 动画: invert, 位置, lap, 速度, 静态, 重复. | |
| 237 | + | - 精灵: 不透明填充 (全局透明), 翻转模式(水平, 垂直, 双向), 关键颜色 (透明色), 重新采样 (常规 或 高质量重采样). 自动尺寸. | |
| 238 | + | - AnimatedGifToSprite: 将gif动画转换为BGRABitmap精灵. | |
| 239 | + | ||
| 240 | + | ### BGRAVirtualScreen | |
| 241 | + | ||
| 242 | + | **用来替代:** TPanel, TPaintBox | |
| 243 | + | ||
| 244 | + | 原理是在内存位图上绘制. | |
| 245 | + | ||
| 246 | + | 本组件有一个特定的事件, OnRedraw, 当整个位图需要被重绘时调用. 它将在最开始和组件改变大小时发生. 你也可以通过调用Redraw和DiscardBitmap来请求重绘位图. 后者仅仅使内容无效, 其重绘将等到处理消息循环时才进行. | |
| 247 | + | ||
| 248 | + | 其他情况, 有可能更改位图的属性并调用Invalidate 或 Repaint, 以避免擦除掉整个位图内容. | |
| 249 | + | ||
| 250 | + | ## 测试 | |
| 251 | + | ||
| 252 | + | ### 游戏 - Maze | |
| 253 | + | ||
| 254 | + | <figure> | |
| 255 | + | <img src="game_maze.png" title="game_maze.png" /> | |
| 256 | + | <figcaption>game_maze.png</figcaption> | |
| 257 | + | </figure> | |
| 258 | + | ||
| 259 | + | ### 游戏 - Puzzle | |
| 260 | + | ||
| 261 | + | <figure> | |
| 262 | + | <img src="game_puzzle.png" title="game_puzzle.png" /> | |
| 263 | + | <figcaption>game_puzzle.png</figcaption> | |
| 264 | + | </figure> | |
| 265 | + | ||
| 266 | + | ### SliceScaling - CustomDrawn Windows 7 | |
| 267 | + | ||
| 268 | + | <figure> | |
| 269 | + | <img src="customdrawnwindows7.png" title="customdrawnwindows7.png" /> | |
| 270 | + | <figcaption>customdrawnwindows7.png</figcaption> | |
| 271 | + | </figure> | |
| 272 | + | ||
| 273 | + | 这是一个[[Lazarus Custom Drawn Controls]]的演示, 你需要安装该组件的Lazarus最终修订版才可以工作. | |
| 274 | + | ||
| 275 | + | 该演示中的组件: button, statictext, checkbox, radiobutton 和 progressbar. | |
| 276 | + | ||
| 277 | + | 还有一些额外的图片,用于 'Luna' (Windows XP 主题) 'Aero Lite' (Windows 8 主题) 和 其他的按钮 (箭头). | |
| 278 | + | ||
| 279 | + | ### SliceScaling - TAChart | |
| 280 | + | ||
| 281 | + | 9-slice scaling 对于创建可变尺寸的UI元素非常有帮助(比如在上述的Custom Drawn Windows 7 演示中). | |
| 282 | + | ||
| 283 | + | 这里是一个 [[TAChart]] 例子,使用了slice scaled bars. | |
| 284 | + | ||
| 285 | + | <figure> | |
| 286 | + | <img src="slicescaledtachart.png" title="slicescaledtachart.png" /> | |
| 287 | + | <figcaption>slicescaledtachart.png</figcaption> | |
| 288 | + | </figure> | |
| 289 | + | ||
| 290 | + | --- | |
| 291 | + | *From the Free Pascal wiki, page "BGRAControls/zh CN", as it stood on 2016-10-07 after a change by 007, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 292 | + | Category: BGRAControls/zh CN | |
| 293 | + | Category: Components/zh CN | |
| 294 | + | Category: Graphics/zh CN |
