Changeset 26 for trunk/UCore.pas


Ignore:
Timestamp:
Dec 22, 2016, 5:07:02 PM (8 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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));
Note: See TracChangeset for help on using the changeset viewer.