Changeset 26


Ignore:
Timestamp:
Dec 22, 2016, 5:07:02 PM (8 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
15 added
3 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r13 r26  
    55  Width = 920
    66  Caption = 'LibrePaint'
    7   ClientHeight = 614
     7  ClientHeight = 615
    88  ClientWidth = 920
    99  Menu = MainMenu1
     
    1212  OnDestroy = FormDestroy
    1313  OnShow = FormShow
    14   LCLVersion = '1.3'
     14  LCLVersion = '1.6.2.0'
    1515  object PaintBox1: TPaintBox
    1616    Left = 0
    17     Height = 588
     17    Height = 587
    1818    Top = 0
    1919    Width = 920
    2020    Align = alClient
    2121    OnMouseDown = PaintBox1MouseDown
     22    OnMouseLeave = PaintBox1MouseLeave
    2223    OnMouseMove = PaintBox1MouseMove
    2324    OnMouseUp = PaintBox1MouseUp
    24     OnMouseLeave = PaintBox1MouseLeave
    2525    OnMouseWheelDown = PaintBox1MouseWheelDown
    2626    OnMouseWheelUp = PaintBox1MouseWheelUp
     
    3030  object StatusBar1: TStatusBar
    3131    Left = 0
    32     Height = 26
    33     Top = 588
     32    Height = 28
     33    Top = 587
    3434    Width = 920
    3535    Panels = <   
  • trunk/Forms/UFormNew.lfm

    r2 r26  
    88  ClientWidth = 497
    99  OnShow = FormShow
    10   LCLVersion = '1.3'
     10  LCLVersion = '1.6.2.0'
    1111  object SpinEditWidth: TSpinEdit
    1212    Left = 168
    13     Height = 35
     13    Height = 28
    1414    Top = 24
    1515    Width = 122
     
    2020  object Label1: TLabel
    2121    Left = 15
    22     Height = 25
     22    Height = 20
    2323    Top = 26
    24     Width = 60
     24    Width = 43
    2525    Caption = 'Width:'
    2626    ParentColor = False
     
    2828  object Label2: TLabel
    2929    Left = 15
    30     Height = 25
     30    Height = 20
    3131    Top = 64
    32     Width = 67
     32    Width = 48
    3333    Caption = 'Height:'
    3434    ParentColor = False
     
    3636  object SpinEditHeight: TSpinEdit
    3737    Left = 168
    38     Height = 35
     38    Height = 28
    3939    Top = 64
    4040    Width = 122
     
    4545  object Label3: TLabel
    4646    Left = 15
    47     Height = 25
     47    Height = 20
    4848    Top = 104
    49     Width = 103
     49    Width = 73
    5050    Caption = 'Resolution:'
    5151    ParentColor = False
     
    5353  object SpinEditDPI: TSpinEdit
    5454    Left = 168
    55     Height = 35
     55    Height = 28
    5656    Top = 104
    5757    Width = 122
     
    6262  object Label4: TLabel
    6363    Left = 15
    64     Height = 25
     64    Height = 20
    6565    Top = 167
    66     Width = 115
     66    Width = 82
    6767    Caption = 'Color depth:'
    6868    ParentColor = False
     
    7070  object ComboBoxColorFormat: TComboBox
    7171    Left = 167
    72     Height = 35
     72    Height = 28
    7373    Top = 157
    7474    Width = 209
    75     ItemHeight = 0
     75    ItemHeight = 20
    7676    OnChange = SpinEditWidthChange
    7777    Style = csDropDownList
     
    9999  object Label5: TLabel
    100100    Left = 16
    101     Height = 25
     101    Height = 20
    102102    Top = 224
    103     Width = 168
     103    Width = 118
    104104    Caption = 'Memory required:'
    105105    ParentColor = False
     
    107107  object LabelMemRequire: TLabel
    108108    Left = 192
    109     Height = 25
     109    Height = 20
    110110    Top = 224
    111     Width = 15
     111    Width = 12
    112112    Caption = '   '
    113113    ParentColor = False
  • trunk/Forms/UFormNew.pas

    r14 r26  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin,
    9   StdCtrls, ActnList, UGraphic;
     9  StdCtrls, ActnList, UFGraphics;
    1010
    1111type
     
    4545procedure TFormNew.SpinEditWidthChange(Sender: TObject);
    4646var
    47   ColorFormat: TGColorFormat;
     47  ColorFormat: TColorFormat;
    4848begin
    49   ColorFormat := ColorManager.Formats[ComboBoxColorFormat.ItemIndex];
     49  ColorFormat := ColorFormatManager.Formats[ComboBoxColorFormat.ItemIndex];
    5050  LabelMemRequire.Caption := IntToStr(SpinEditWidth.Value * SpinEditHeight.Value *
    5151    ColorFormat.BitDepth div 8) + ' bytes';
     
    5454procedure TFormNew.FormShow(Sender: TObject);
    5555var
    56   ColorFormat: TGColorFormat;
     56  ColorFormat: TColorFormat;
    5757  I: Integer;
    5858begin
    5959  ComboBoxColorFormat.Clear;
    60   for I := 0 to ColorManager.FormatCount - 1 do begin
    61     ColorFormat := ColorManager.Formats[I];
     60  for I := 0 to ColorFormatManager.FormatCount - 1 do begin
     61    ColorFormat := ColorFormatManager.Formats[I];
    6262    ComboBoxColorFormat.AddItem(ColorFormat.Name, nil);
    6363  end;
  • trunk/LibrePaint.lpi

    r16 r26  
    2727          <SearchPaths>
    2828            <IncludeFiles Value="$(ProjOutDir)"/>
    29             <OtherUnitFiles Value="Forms;ColorFormats"/>
     29            <OtherUnitFiles Value="Forms"/>
    3030            <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    3131          </SearchPaths>
     
    6666      </local>
    6767    </RunParams>
    68     <RequiredPackages Count="1">
     68    <RequiredPackages Count="2">
    6969      <Item1>
     70        <PackageName Value="FastGraphics"/>
     71        <DefaultFilename Value="Packages/FastGraphics/FastGraphics.lpk" Prefer="True"/>
     72      </Item1>
     73      <Item2>
    7074        <PackageName Value="LCL"/>
    71       </Item1>
     75      </Item2>
    7276    </RequiredPackages>
    73     <Units Count="12">
     77    <Units Count="5">
    7478      <Unit0>
    7579        <Filename Value="LibrePaint.lpr"/>
     
    8286        <HasResources Value="True"/>
    8387        <ResourceBaseClass Value="DataModule"/>
    84         <UnitName Value="UCore"/>
    8588      </Unit1>
    8689      <Unit2>
    87         <Filename Value="UGraphic.pas"/>
     90        <Filename Value="UProject.pas"/>
    8891        <IsPartOfProject Value="True"/>
    89         <UnitName Value="UGraphic"/>
    9092      </Unit2>
    9193      <Unit3>
    92         <Filename Value="UProject.pas"/>
    93         <IsPartOfProject Value="True"/>
    94       </Unit3>
    95       <Unit4>
    9694        <Filename Value="Forms/UFormNew.pas"/>
    9795        <IsPartOfProject Value="True"/>
     
    9997        <HasResources Value="True"/>
    10098        <ResourceBaseClass Value="Form"/>
    101         <UnitName Value="UFormNew"/>
    102       </Unit4>
    103       <Unit5>
    104         <Filename Value="ColorFormats/UColorRGBA8.pas"/>
    105         <IsPartOfProject Value="True"/>
    106         <UnitName Value="UColorRGBA8"/>
    107       </Unit5>
    108       <Unit6>
     99      </Unit3>
     100      <Unit4>
    109101        <Filename Value="Forms/UFormMain.pas"/>
    110102        <IsPartOfProject Value="True"/>
     
    112104        <HasResources Value="True"/>
    113105        <ResourceBaseClass Value="Form"/>
    114         <UnitName Value="UFormMain"/>
    115       </Unit6>
    116       <Unit7>
    117         <Filename Value="ColorFormats/UColorGray8.pas"/>
    118         <IsPartOfProject Value="True"/>
    119         <UnitName Value="UColorGray8"/>
    120       </Unit7>
    121       <Unit8>
    122         <Filename Value="ColorFormats/UColorGray1.pas"/>
    123         <IsPartOfProject Value="True"/>
    124         <UnitName Value="UColorGray1"/>
    125       </Unit8>
    126       <Unit9>
    127         <Filename Value="UMemory.pas"/>
    128         <IsPartOfProject Value="True"/>
    129       </Unit9>
    130       <Unit10>
    131         <Filename Value="ColorFormats/UColorGray4.pas"/>
    132         <IsPartOfProject Value="True"/>
    133       </Unit10>
    134       <Unit11>
    135         <Filename Value="ColorFormats/UColorRGB565.pas"/>
    136         <IsPartOfProject Value="True"/>
    137       </Unit11>
     106      </Unit4>
    138107    </Units>
    139108  </ProjectOptions>
     
    145114    <SearchPaths>
    146115      <IncludeFiles Value="$(ProjOutDir)"/>
    147       <OtherUnitFiles Value="Forms;ColorFormats"/>
     116      <OtherUnitFiles Value="Forms"/>
    148117      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    149118    </SearchPaths>
     
    176145    </Linking>
    177146    <Other>
     147      <CompilerMessages>
     148        <IgnoredMessages idx5024="True"/>
     149      </CompilerMessages>
    178150      <CustomOptions Value="-dDEBUG"/>
    179151    </Other>
  • trunk/LibrePaint.lpr

    r15 r26  
    88  {$ENDIF}{$ENDIF}
    99  Interfaces, // this includes the LCL widgetset
    10   SysUtils, Forms, UCore, UGraphic, UProject, UMemory, UFormNew, UFormMain,
    11   UColorRGBA8, UColorGray8, UColorGray1, UColorGray4, UColorRGB565
    12   { you can add units after this };
     10  SysUtils, Forms, UCore, UProject, UFormNew, UFormMain;
    1311
    1412{$R *.res}
  • trunk/UCore.pas

    r15 r26  
    66
    77uses
    8   Classes, SysUtils, FileUtil, ActnList, UProject, UGraphic, Controls, Graphics,
     8  Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, Controls, Graphics,
    99  ExtDlgs, ExtCtrls;
    1010
     
    8787begin
    8888  Project := TProject.Create;
    89 
    90   ColorManager.RegisterFormat(TGColorFormatRGBA8);
    91   ColorManager.RegisterFormat(TGColorFormatRGB565);
    92   ColorManager.RegisterFormat(TGColorFormatGray8);
    93   ColorManager.RegisterFormat(TGColorFormatGray4);
    94   ColorManager.RegisterFormat(TGColorFormatGray1);
    9589end;
    9690
     
    10397begin
    10498  // Set default
    105   Project.Bitmap.ColorFormat := ColorManager.Formats[0];
     99  Project.Bitmap.ColorFormat := ColorFormatManager.Formats[0];
    106100  Project.Bitmap.Size := Point(200, 100);
    107   if ColorManager.FormatCount > 0 then
    108     Project.Bitmap.ColorFormat := ColorManager.Formats[0];
    109101  Project.View.DestRect := Bounds(0, 0, FormMain.PaintBox1.Width, FormMain.PaintBox1.Height);
    110102  Core.AZoomAll.Execute;
     
    114106begin
    115107  if FormNew.ShowModal = mrOk then begin
    116     Project.Bitmap.ColorFormat := TGColorFormat.Create;
     108    Project.Bitmap.ColorFormat := TColorFormat.Create;
    117109
    118110    Project.FileName := 'New image';
    119111    Project.Bitmap.Size := Point(FormNew.SpinEditWidth.Value, FormNew.SpinEditHeight.Value);
    120     Project.Bitmap.ColorFormat := ColorManager.Formats[FormNew.ComboBoxColorFormat.ItemIndex];
    121     Project.Bitmap.BackgroundColor.FromTColor(clBlack);
    122     Project.Bitmap.DPI := FormNew.SpinEditDPI.Value;
     112    Project.Bitmap.ColorFormat := ColorFormatManager.Formats[FormNew.ComboBoxColorFormat.ItemIndex];
     113//    Project.Bitmap.BackgroundColor.FromTColor(clBlack);
     114//    Project.Bitmap.DPI := FormNew.SpinEditDPI.Value;
    123115    AZoomAll.Execute;
    124116  end;
     
    177169    Image.Picture.LoadFromFile(OpenPictureDialog1.FileName);
    178170    Image.Picture.Bitmap.BeginUpdate(True);
    179     Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas,
    180       Point(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height));
     171    Project.Bitmap.Size := Point(Image.Picture.Bitmap.Width, Image.Picture.Bitmap.Height);
     172    Project.Bitmap.LoadFromCanvas(Image.Picture.Bitmap.Canvas);
    181173    Image.Picture.Bitmap.EndUpdate;
    182174    Image.Free;
     175    AZoomAll.Execute;
    183176    FormMain.Redraw;
    184177    Project.FileName := OpenPictureDialog1.FileName;
     
    214207begin
    215208  Project.Bitmap.Clear;
    216   Project.Bitmap.Canvas.Pen.Color.Format := Project.Bitmap.ColorFormat;
    217   Project.Bitmap.Canvas.Pen.Color.FromTColor(clWhite);
     209  TFColor(Project.Bitmap.Canvas.Pen.Color).ColorFormat := Project.Bitmap.ColorFormat;
     210  TFColor(Project.Bitmap.Canvas.Pen.Color).SetColorName(cnWhite);
    218211  Project.Bitmap.Canvas.Pen.MoveTo(Point(80, 80));
    219212  Project.Bitmap.Canvas.Pen.LineTo(Point(50, 20));
  • trunk/UProject.pas

    r13 r26  
    66
    77uses
    8   Classes, SysUtils, UGraphic;
     8  Classes, SysUtils, UFGraphics;
    99
    1010type
     
    3434  TProject = class
    3535    FileName: string;
    36     Bitmap: TGBitmap;
     36    Bitmap: TFPixmap;
    3737    View: TView;
    3838    Saved: Boolean;
     
    119119constructor TProject.Create;
    120120begin
    121   Bitmap := TGBitmap.Create;
     121  Bitmap := TFPixmap.Create(nil);
    122122  View := TView.Create;
    123123end;
Note: See TracChangeset for help on using the changeset viewer.