Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
[SOLVED] Draw repeated
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
InstallAware Using Lazaru...
by
msintle
[
Today
at 05:03:08 pm]
Lazarus for Windows on aa...
by
msintle
[
Today
at 04:42:43 pm]
v3.99 code completion que...
by
440bx
[
Today
at 04:30:30 pm]
I just released a commerc...
by
Zoran
[
Today
at 04:23:11 pm]
Forum slow
by
VisualLab
[
Today
at 03:57:24 pm]
Generics - correct syntax
by
jamie
[
Today
at 03:51:21 pm]
FpDebug breakpoint on "be...
by
440bx
[
Today
at 02:59:22 pm]
Database standards OR Am ...
by
gidesa
[
Today
at 02:16:21 pm]
Registers dialog - regist...
by
ccrause
[
Today
at 02:10:31 pm]
HeapTrc not showing line ...
by
dbannon
[
Today
at 01:17:33 pm]
Converting a string/index...
by
wp
[
Today
at 01:14:55 pm]
AI, NLP and CAI: Text Gen...
by
Dzandaa
[
Today
at 12:51:20 pm]
Access violation when ope...
by
JuhaManninen
[
Today
at 12:31:34 pm]
[solved] how to get class...
by
Thaddy
[
Today
at 12:18:15 pm]
insert select from - with...
by
Nicole
[
Today
at 11:39:34 am]
How to: create DLL file f...
by
paule32
[
Today
at 11:17:12 am]
Offical launch of the 1 B...
by
Gustavo 'Gus' Carreno
[
Today
at 11:14:40 am]
Step-into the field sette...
by
ginoo
[
Today
at 07:50:24 am]
Does anyone know why thes...
by
TYDQ
[
Today
at 05:24:32 am]
Arabic text, problem on L...
by
Zaher
[
Today
at 03:29:16 am]
Demoscene The Champs Crac...
by
Gigatron
[
Today
at 01:05:16 am]
How to use the Event Log?
by
n7800
[
Today
at 12:47:25 am]
Access violation when re-...
by
TRon
[April 19, 2024, 11:44:51 pm]
Poll: Watches and Display...
by
440bx
[April 19, 2024, 07:13:51 pm]
Who is Indy mattias?
by
paweld
[April 19, 2024, 04:17:53 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Draw repeated (Read 4665 times)
Dibo
Hero Member
Posts: 1048
[SOLVED] Draw repeated
«
on:
September 26, 2012, 07:21:48 pm »
Hi,
I'm wondering. Exists any DrawRepeated method in bgrabitmap? I have small pattern and want fill it on whole canvas. I know how to do it manually but maybe BGRABitmap have this funcionality
Regards
«
Last Edit: October 02, 2012, 07:13:28 pm by Dibo
»
Logged
lainz
Guest
Re: Draw repeated
«
Reply #1 on:
September 26, 2012, 09:51:13 pm »
procedure Fill(texture: IBGRAScanner; mode: TDrawMode); override;
Logged
circular
Hero Member
Posts: 4220
Re: Draw repeated
«
Reply #2 on:
September 26, 2012, 10:33:25 pm »
Yes, and you can draw any shape (FillRect, FillPoly, etc.) with a texture as a parameter.
Logged
Conscience is the debugger of the mind
circular
Hero Member
Posts: 4220
Re: Draw repeated
«
Reply #3 on:
September 26, 2012, 10:43:31 pm »
And you can even use scanners to distort the result. See :
http://wiki.freepascal.org/BGRABitmap_tutorial_11
Logged
Conscience is the debugger of the mind
Dibo
Hero Member
Posts: 1048
Re: Draw repeated
«
Reply #4 on:
October 02, 2012, 07:13:16 pm »
Thanks!
BTW: What is in TBGRABitmap.Bitmap? I created small pattern and want use it as a brush in Canvas.Brush.Bitmap to speed up fill canvas. Look at
b
type:
This code work:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
FormPaint
(
Sender
:
TObject
)
;
var
b
:
TBitmap
;
x
,
y
,
t
:
Integer
;
begin
t
:
=
GetTickCount
;
b
:
=
TBitmap
.
Create
;
b
.
SetSize
(
5
,
5
)
;
for
x
:
=
0
to
b
.
Width
-
1
do
for
y
:
=
0
to
b
.
Height
-
1
do
if
(
(
x
+
y
)
mod
5
=
0
)
or
(
(
y
-
x
)
mod
5
=
0
)
then
b
.
Canvas
.
Pixels
[
x
,
y
]
:
=
RGBToColor
(
0
,
0
,
0
)
// Black
else
b
.
Canvas
.
Pixels
[
x
,
y
]
:
=
RGBToColor
(
40
,
40
,
40
)
;
// Some dark shade of gray
Canvas
.
Brush
.
Bitmap
:
=
b
;
Canvas
.
FillRect
(
ClientRect
)
;
Canvas
.
Brush
.
Bitmap
:
=
nil
;
b
.
Free
;
Self
.
Caption
:
=
IntToStr
(
GetTickCount
-
t
)
;
end
;
And this (with TBGRABitmap) doesn't:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
FormPaint
(
Sender
:
TObject
)
;
var
b
,
bmp
:
TBGRABitmap
;
x
,
y
,
t
:
Integer
;
begin
t
:
=
GetTickCount
;
b
:
=
TBGRABitmap
.
Create
(
5
,
5
)
;
for
x
:
=
0
to
b
.
Width
-
1
do
for
y
:
=
0
to
b
.
Height
-
1
do
if
(
(
x
+
y
)
mod
5
=
0
)
or
(
(
y
-
x
)
mod
5
=
0
)
then
b
.
CanvasBGRA
.
Pixels
[
x
,
y
]
:
=
RGBToColor
(
0
,
0
,
0
)
// Black
else
b
.
CanvasBGRA
.
Pixels
[
x
,
y
]
:
=
RGBToColor
(
40
,
40
,
40
)
;
// Some dark shade of gray
b
.
InvalidateBitmap
;
Canvas
.
Brush
.
Bitmap
:
=
b
.
Bitmap
;
Canvas
.
FillRect
(
ClientRect
)
;
Canvas
.
Brush
.
Bitmap
:
=
nil
;
b
.
Free
;
Self
.
Caption
:
=
IntToStr
(
GetTickCount
-
t
)
;
end
;
«
Last Edit: October 02, 2012, 07:50:54 pm by Dibo
»
Logged
circular
Hero Member
Posts: 4220
Re: Draw repeated
«
Reply #5 on:
October 02, 2012, 10:09:13 pm »
Quote from: Dibo on October 02, 2012, 07:13:16 pm
Thanks!
BTW: What is in TBGRABitmap.Bitmap?
It should be a TBitmap containing the current bitmap.
I dont know why it does not work. What if you use SetPixel instead ? And MakeBitmapCopy instead of Bitmap ?
Logged
Conscience is the debugger of the mind
Dibo
Hero Member
Posts: 1048
Re: [SOLVED] Draw repeated
«
Reply #6 on:
October 02, 2012, 10:38:05 pm »
MakeBitmapCopy solved problem. Thanks!
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
»
BGRABitmap and LazPaint
»
[SOLVED] Draw repeated
TinyPortal
© 2005-2018