View Issue Details

IDProjectCategoryView StatusLast Update
0010587LazarusLCLpublic2017-01-11 14:33
ReportermspillerAssigned ToBart Broersma 
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target Version1.8Fixed in Version1.7 (SVN) 
Summary0010587: D7 compatibility: AllocPatternBitmap not defined in Graphics
DescriptionAllocPatternBitmap (colorBg, colorFg: TColor):TBitmap is not defined in Graphics.
It should create bitmap sized 8x8 with iterating pixel color.
Something like:
[.X.X.X.X]
[X.X.X.X.]
[.X.X.X.X]
[X.X.X.X.]
[.X.X.X.X]
[X.X.X.X.]
[.X.X.X.X]
[X.X.X.X.]

Delphi also caches that bitmap and their colors into TPatternManager.
record = TPattern
  colorBg, colorFg: TColor;
  pattern: TBitmap;
  next: PPattern;
end;

Since it is global list it should use critical section.
TagsNo tags attached.
Fixed in Revisionr53926
LazTarget1.8
WidgetsetGTK
Attached Files

Relationships

has duplicate 0010583 closedMarc Weustink D7 compatibility: AllocPatternBitmap not defined in Graphics 

Activities

Bart Broersma

2017-01-07 15:40

developer   ~0097354

Creating the bitmap is simple enough.

function AllocPatternBitmap (colorBg, colorFg: TColor): TBitmap;
var
  x,y: Integer;
begin
  Result := TBitmap.Create;
  Result.Width := 8;
  Result.Height := 8;
  Result.Canvas.Brush.Style := bsSolid;
  Result.Canvas.Brush.Color := colorBg;
  Result.Canvas.Rectangle(0,0,7,7);
  for x := 0 to 7 do for y := 0 to 7 do
  begin
    if ((not Odd(x)) and (not Odd(y))) xor ((Odd(x)) and (Odd(y))) then
      Result.Canvas.Pixels[x,y] := colorFg;
  end;
end;


What is the use of TPatternManager then?
Can you retrieve a reference to an already created pattern from it?

I cannot find a reference to it on Embarcadero's docwiki.

Bart Broersma

2017-01-08 16:41

developer   ~0097367

The idea would be that the bitmap is first search in a cache (like TLCLResCache), and if it does not exist in the cache, a bitmap is created and added to the cache (like with brushes)?
The cache will be emptied upon program termination.

Bitmaps ceated with AllcoPatternBitmap should not bee freed by the programmer then.

The cache should not be visible (unlike PenResourceCache etc)?
(AFACS Delphi does not expose it's TPatternManager variable/instance, at least D7 does not)

Bart Broersma

2017-01-11 14:33

developer   ~0097414

Please test and close if OK.

Issue History

Date Modified Username Field Change
2008-01-07 06:54 mspiller New Issue
2008-01-07 10:28 Marco van de Voort Relationship added related to 0007481
2008-01-07 10:34 Marco van de Voort Relationship deleted related to 0007481
2008-01-07 10:35 Marco van de Voort Project FPC => Lazarus
2008-01-07 13:34 Paul Ishenin Relationship added has duplicate 0010583
2008-01-08 00:21 Marc Weustink LazTarget => 1.0
2008-01-08 00:21 Marc Weustink Status new => acknowledged
2008-01-08 00:21 Marc Weustink Widgetset => GTK
2008-01-08 00:21 Marc Weustink Category FCL => LCL
2008-01-08 00:21 Marc Weustink Product Version 2.3.1 =>
2008-04-24 09:57 Vincent Snijders Target Version => 1.0.0
2011-10-07 16:41 Vincent Snijders LazTarget 1.0 => -
2011-10-07 16:41 Vincent Snijders Severity minor => feature
2011-10-07 16:41 Vincent Snijders Target Version 1.0.0 =>
2012-02-04 12:15 Zeljan Rikalo LazTarget - => 1.2
2014-01-14 15:16 Martin Friebe LazTarget 1.2 => 1.4
2014-09-10 00:55 Juha Manninen LazTarget 1.4 => -
2017-01-07 15:40 Bart Broersma Note Added: 0097354
2017-01-07 15:40 Bart Broersma Status acknowledged => feedback
2017-01-08 16:41 Bart Broersma Note Added: 0097367
2017-01-11 13:54 Bart Broersma Assigned To => Bart Broersma
2017-01-11 13:54 Bart Broersma Status feedback => assigned
2017-01-11 14:33 Bart Broersma Fixed in Revision => r53926
2017-01-11 14:33 Bart Broersma LazTarget - => 1.8
2017-01-11 14:33 Bart Broersma Note Added: 0097414
2017-01-11 14:33 Bart Broersma Status assigned => resolved
2017-01-11 14:33 Bart Broersma Fixed in Version => 1.7 (SVN)
2017-01-11 14:33 Bart Broersma Resolution open => fixed
2017-01-11 14:33 Bart Broersma Target Version => 1.8