- move code from JPeg4Lazarus to graphics.pp

- move examples from JPeg4Lazarus to common examples dir
- remove JPeg4Lazarus package

git-svn-id: trunk@13192 -
This commit is contained in:
paul 2007-12-07 02:25:09 +00:00
parent 957d726614
commit 1c77fb1ce8
22 changed files with 186 additions and 2850 deletions

19
.gitattributes vendored
View File

@ -333,19 +333,6 @@ components/images/laztga.pas svneol=native#text/pascal
components/images/lazxpm.pas svneol=native#text/pascal
components/images/readme.txt svneol=native#text/plain
components/images/registerimg4laz.pas svneol=native#text/plain
components/jpeg/Makefile svneol=native#text/plain
components/jpeg/Makefile.fpc svneol=native#text/plain
components/jpeg/examples/README.txt svneol=native#text/plain
components/jpeg/examples/jpegexample.lpi svneol=native#text/plain
components/jpeg/examples/jpegexample.lpr svneol=native#text/pascal
components/jpeg/examples/lazarus.jpg -text svneol=unset#image/jpeg
components/jpeg/examples/mainform.lfm svneol=native#text/plain
components/jpeg/examples/mainform.lrs svneol=native#text/pascal
components/jpeg/examples/mainform.pas svneol=native#text/pascal
components/jpeg/jpegforlazarus.lpk svneol=native#text/pascal
components/jpeg/jpegforlazarus.pas svneol=native#text/pascal
components/jpeg/lazjpeg.pas svneol=native#text/pascal
components/jpeg/readme.txt svneol=native#text/plain
components/lazreport/doc/contributors.txt svneol=native#text/plain
components/lazreport/doc/cvs2cl.pl -text svneol=unset#application/x-perl
components/lazreport/doc/fr_eng.sxw -text
@ -1643,6 +1630,12 @@ examples/imgviewer/imgview.dpr svneol=native#text/pascal
examples/imgviewer/imgview.lpi svneol=native#text/plain
examples/imgviewer/imgview.lpr svneol=native#text/pascal
examples/imgviewer/imgview.res svneol=native#unset
examples/jpeg/jpegexample.lpi svneol=native#text/plain
examples/jpeg/jpegexample.lpr svneol=native#text/pascal
examples/jpeg/lazarus.jpg -text svneol=unset#image/jpeg
examples/jpeg/mainform.lfm svneol=native#text/plain
examples/jpeg/mainform.lrs svneol=native#text/pascal
examples/jpeg/mainform.pas svneol=native#text/pascal
examples/lazintfimage/fadein1.lpi svneol=native#text/plain
examples/lazintfimage/fadein1.lpr svneol=native#text/pascal
examples/lazintfimage/mainunit1.lfm svneol=native#text/plain

4
.gitignore vendored
View File

@ -60,10 +60,6 @@ components/images/*.bak
components/images/examples/*.bak
components/images/examples/units
components/images/units
components/jpeg/*.bak
components/jpeg/examples/*.bak
components/jpeg/examples/units
components/jpeg/units
components/macfiles/*.bak
components/macfiles/examples/*.bak
components/macfiles/examples/units

View File

@ -1968,7 +1968,6 @@ bigidecomponents: all
$(MAKE) -C cgi
$(MAKE) -C cgi/ide
$(MAKE) -C turbopower_ipro
$(MAKE) -C jpeg
$(MAKE) -C fpcunit
$(MAKE) -C fpcunit/ide
$(MAKE) -C projecttemplates

View File

@ -27,7 +27,6 @@ bigidecomponents: all
$(MAKE) -C cgi
$(MAKE) -C cgi/ide
$(MAKE) -C turbopower_ipro
$(MAKE) -C jpeg
$(MAKE) -C fpcunit
$(MAKE) -C fpcunit/ide
$(MAKE) -C projecttemplates

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
# Makefile.fpc for JPEGForLazarus 1.0.1
[package]
name=jpegforlazarus
version=1.0.1
[compiler]
unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)
unitdir=../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
includedir=./
options=-dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
[target]
units=jpegforlazarus.pas
[clean]
files=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) \
$(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) \
$(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) \
$(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) \
$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
[prerules]
# LCL Platform
ifndef LCL_PLATFORM
ifeq ($(OS_TARGET),win32)
LCL_PLATFORM=win32
else
ifeq ($(OS_TARGET),win64)
LCL_PLATFORM=win32
else
LCL_PLATFORM=gtk
endif
endif
endif
export LCL_PLATFORM
[rules]
.PHONY: cleartarget all
cleartarget:
-$(DEL) $(COMPILER_UNITTARGETDIR)/jpegforlazarus$(PPUEXT)
all: cleartarget $(COMPILER_UNITTARGETDIR) jpegforlazarus$(PPUEXT)

View File

@ -1,27 +0,0 @@
Important:
This example uses the JPEGForLazarus package (see in the directory above).
You must first open once the package jpegforlazarus.lpk in the IDE, so that
the IDE knows, where to find the lpk file.
To use jpeg in your own applications:
- Add JPEGForLazarus to the dependencies of your project.
Project Menu -> Project Inspector -> Add -> New Requirement -> Package Name:
JPEGForLazarus
Click OK.
- Add "lazjpeg" to the uses section of any unit, where jpeg is needed.
Add this unit at least once, so that jpeg is registered and
Open/SavePictureDialogs and TPicture can open jpeg.
The code is under LGPL2. That means you can use it freely in your
applications, even commercial ones.
For further questions:
lazarus@miraclec.com

View File

@ -1,48 +0,0 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="2">
<Name Value="JPEGForLazarus"/>
<Author Value="Mattias Gaertner"/>
<CompilerOptions>
<Version Value="5"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
<CreateMakefileOnBuild Value="True"/>
</Other>
</CompilerOptions>
<Description Value="JPEG for Lazarus.
"/>
<License Value="LGPL"/>
<Version Major="1" Release="1"/>
<Files Count="2">
<Item1>
<Filename Value="lazjpeg.pas"/>
<UnitName Value="LazJPEG"/>
</Item1>
<Item2>
<Filename Value="readme.txt"/>
<Type Value="Text"/>
</Item2>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)/"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -1,20 +0,0 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit JPEGForLazarus;
interface
uses
LazJPEG, LazarusPackageIntf;
implementation
procedure Register;
begin
end;
initialization
RegisterPackage('JPEGForLazarus', @Register);
end.

View File

@ -1,130 +0,0 @@
{ Copyright (C) 2003 Mattias Gaertner
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
for more details.
You should have received a copy of the GNU Library General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
unit LazJPEG;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes, FPImage, IntfGraphics, Graphics, FPReadJPEG, FPWriteJPEG,
ClipBrd;
type
TJPEGQualityRange = TFPJPEGCompressionQuality;
TJPEGPerformance = TJPEGReadPerformance;
TJPEGImage = class(TFPImageBitmap)
private
FPerformance: TJPEGPerformance;
FProgressiveEncoding: boolean;
FQuality: TJPEGQualityRange;
protected
procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override;
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override;
public
constructor Create; override;
class function GetFileExtensions: string; override;
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
public
property CompressionQuality: TJPEGQualityRange read FQuality write FQuality;
property ProgressiveEncoding: boolean read FProgressiveEncoding;
property Performance: TJPEGPerformance read FPerformance write FPerformance;
end;
const
DefaultJPEGMimeType = 'image/jpeg';
implementation
{ TJPEGImage }
procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader);
var
JPEGReader: TFPReaderJPEG;
begin
if ImgReader is TFPReaderJPEG then begin
JPEGReader:=TFPReaderJPEG(ImgReader);
JPEGReader.Performance:=Performance;
JPEGReader.OnProgress:=@Progress;
end;
inherited InitFPImageReader(IntfImg, ImgReader);
end;
procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
var
JPEGReader: TFPReaderJPEG;
begin
if ImgReader is TFPReaderJPEG then begin
JPEGReader:=TFPReaderJPEG(ImgReader);
FProgressiveEncoding:=JPEGReader.ProgressiveEncoding;
end;
inherited FinalizeFPImageReader(ImgReader);
end;
procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter);
var
JPEGWriter: TFPWriterJPEG;
begin
if ImgWriter is TFPWriterJPEG then begin
JPEGWriter:=TFPWriterJPEG(ImgWriter);
if JPEGWriter<>nil then ;
JPEGWriter.ProgressiveEncoding:=ProgressiveEncoding;
JPEGWriter.CompressionQuality:=CompressionQuality;
JPEGWriter.OnProgress:=@Progress;
end;
inherited InitFPImageWriter(IntfImg, ImgWriter);
end;
class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass;
begin
Result:=TFPReaderJPEG;
end;
class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
begin
Result:=TFPWriterJPEG;
end;
constructor TJPEGImage.Create;
begin
inherited Create;
FPerformance:=jpBestQuality;
FProgressiveEncoding:=false;
FQuality:=75;
end;
class function TJPEGImage.GetFileExtensions: string;
begin
Result:='jpg;jpeg';
end;
initialization
TPicture.RegisterFileFormat('jpg', 'JPEG Image File', TJPEGImage);
TPicture.RegisterFileFormat('jpeg', 'JPEG Image File', TJPEGImage);
TPicture.RegisterClipboardFormat(RegisterClipboardFormat(DefaultJPEGMimeType),
TJPEGImage);
finalization
TPicture.UnregisterGraphicClass(TJPEGImage);
end.

View File

@ -1,18 +0,0 @@
The lazarus TJPEGImage is in lazjpeg.pas
It uses the pasjpeg and fpimage libs provided by FreePascal. See there for in
more detailed jpeg handling.
JPEG (pronounced "jay-peg") is a standardized familly of algorithms for
compression of continous tone still images. Most JPEG processes are lossy,
the output image is not exactly identical to the input image. However, on
typical photographic images, very good compression levels can be obtained
with no visible change, and remarkably high compression levels are possible
if you can tolerate a low-quality image. The Independent JPEG Group (IJG) has
created a free, portable C library for JPEG compression and decompression of
JPEG images which has been ported to FreePascal.

View File

@ -1,8 +1,8 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/08/16]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/05/11]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-embedded
BSDs = freebsd netbsd openbsd darwin
UNIXs = linux $(BSDs) solaris qnx
LIMIT83fs = go32v2 os2 emx watcom
@ -393,9 +393,6 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override TARGET_UNITS+=printer4lazarus.pas
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override TARGET_UNITS+=printer4lazarus.pas
endif
@ -549,167 +546,161 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override CLEAN_FILES+=$(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*.compiled) $(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
endif
ifeq ($(FULL_TARGET),i386-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-go32v2)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-win32)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-os2)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-freebsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-beos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-netbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-solaris)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-qnx)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-netware)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-openbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-wdosx)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-darwin)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-emx)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-watcom)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-netwlibc)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-wince)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-symbian)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-freebsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-netbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-amiga)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-atari)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-openbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-palmos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),m68k-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-netbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-amiga)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-macos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-darwin)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-morphos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),sparc-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),sparc-netbsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),sparc-solaris)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),sparc-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),x86_64-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),x86_64-freebsd)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),x86_64-win64)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),x86_64-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-palmos)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-wince)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-gba)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-nds)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),arm-symbian)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override COMPILER_OPTIONS+=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
override COMPILER_OPTIONS+=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
endif
ifeq ($(FULL_TARGET),i386-linux)
override COMPILER_INCLUDEDIR+=unix/ win32/ carbon/ ./
@ -861,9 +852,6 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_INCLUDEDIR+=unix/ win32/ carbon/ ./
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override COMPILER_INCLUDEDIR+=unix/ win32/ carbon/ ./
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override COMPILER_INCLUDEDIR+=unix/ win32/ carbon/ ./
endif
@ -1017,9 +1005,6 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_UNITDIR+=unix/ win32/ carbon/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override COMPILER_UNITDIR+=unix/ win32/ carbon/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override COMPILER_UNITDIR+=unix/ win32/ carbon/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
endif
@ -1173,9 +1158,6 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
override COMPILER_UNITTARGETDIR+=lib/$(CPU_TARGET)-$(OS_TARGET)
endif
@ -2077,9 +2059,6 @@ endif
ifeq ($(FULL_TARGET),powerpc64-linux)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),powerpc64-darwin)
REQUIRE_PACKAGES_RTL=1
endif
ifeq ($(FULL_TARGET),powerpc64-embedded)
REQUIRE_PACKAGES_RTL=1
endif
@ -2310,7 +2289,6 @@ vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
vpath %.inc $(COMPILER_INCLUDEDIR)
vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
.PHONY: fpc_shared

View File

@ -8,7 +8,7 @@ version=0.5
unittargetdir=lib/$(CPU_TARGET)-$(OS_TARGET)
unitdir=unix/ win32/ carbon/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/ ../../lcl/units/$(CPU_TARGET)-$(OS_TARGET)/$(LCL_PLATFORM)/ ../../packager/units/$(CPU_TARGET)-$(OS_TARGET)/ ./
includedir=unix/ win32/ carbon/ ./
options=-dUseCache -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
options=-dUseCache -dNativePrint -dLCL -dLCL$(LCL_PLATFORM) -S2 -gl
[target]
units=printer4lazarus.pas

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -62,7 +62,7 @@ uses
{$IFDEF BigIDE}
RunTimeTypeInfoControls, Printer4Lazarus, Printers4LazIDE,
CGILaz, CGILazIDE,
MemDSLaz, SDFLaz, TurboPowerIPro, JPEGForLazarus,
MemDSLaz, SDFLaz, TurboPowerIPro,
FPCUnitTestRunner, FPCUnitIDE, ProjTemplates, TAChartLazarusPkg,
{$IFDEF windows}
SQLDBLaz, DBFLaz,

View File

@ -35,7 +35,10 @@ interface
uses
SysUtils, Math, Types, Classes, Contnrs, FPCAdds,
FPImgCmn, FPImage, FPCanvas,
FPReadPNG, FPWritePNG, FPReadBMP, FPWriteBMP, FPReadPNM, FPWritePNM,
FPReadPNG, FPWritePNG, // png support
FPReadBMP, FPWriteBMP, // bmp support
FPReadPNM, FPWritePNM, // png support
FPReadJpeg, FPWriteJpeg, // jpg support
IntfGraphics,
AvgLvlTree,
LCLStrConsts, LCLType, LCLProc, LMessages, LCLIntf, LResources, LCLResCache,
@ -394,11 +397,7 @@ type
TIcon = class; // ico
TPortableNetworkGraphic = class; // png
TPortableAnyMapGraphic = class; // pnm formats: pbm, pgm and ppm
{$IFDEF UseSimpleJpeg}
{$error will be added to the LCL, when fpc 2.0 is released. Use the jpeg package in the components/jpeg directory instead. }
// MG: will be added to the LCL, when fpc 2.0 is released
// but then with the advanced features of the existing package
{$ENDIF}
TJpegImage = class; // jpg
{ TGraphicsObject
In Delphi VCL this is the ancestor of TFont, TPen and TBrush.
@ -783,6 +782,9 @@ type
PNM - Returns a pnm. If the contents is not already a pnm, the
contents are thrown away and a blank pnm (TPortableAnyMapGraphic) is
returned.
Jpeg - Returns a jpeg. If the contents is not already a jpeg, the
contents are thrown away and a blank jpeg (TJPegImage) is
returned.
}
TPicture = class(TPersistent)
@ -793,18 +795,20 @@ type
FOnProgress: TProgressEvent;
procedure ForceType(GraphicType: TGraphicClass);
function GetBitmap: TBitmap;
function GetIcon: TIcon;
function GetJpeg: TJpegImage;
function GetPNG: TPortableNetworkGraphic;
function GetPNM: TPortableAnyMapGraphic;
function GetPixmap: TPixmap;
function GetIcon: TIcon;
function GetHeight: Integer;
function GetWidth: Integer;
procedure ReadData(Stream: TStream);
procedure SetBitmap(Value: TBitmap);
procedure SetIcon(Value: TIcon);
procedure SetJpeg(Value: TJpegImage);
procedure SetPNG(const AValue: TPortableNetworkGraphic);
procedure SetPNM(const AValue: TPortableAnyMapGraphic);
procedure SetPixmap(Value: TPixmap);
procedure SetIcon(Value: TIcon);
procedure SetGraphic(Value: TGraphic);
procedure WriteData(Stream: TStream);
protected
@ -833,10 +837,11 @@ type
procedure Clear; virtual;
public
property Bitmap: TBitmap read GetBitmap write SetBitmap;
property Icon: TIcon read GetIcon write SetIcon;
property Jpeg: TJpegImage read GetJpeg write SetJpeg;
property Pixmap: TPixmap read GetPixmap write SetPixmap;
property PNG: TPortableNetworkGraphic read GetPNG write SetPNG;
property PNM: TPortableAnyMapGraphic read GetPNM write SetPNM;
property Icon: TIcon read GetIcon write SetIcon;
property Graphic: TGraphic read FGraphic write SetGraphic;
//property PictureAdapter: IChangeNotifier read FNotify write FNotify;
property Height: Integer read GetHeight;
@ -1192,7 +1197,7 @@ type
procedure SaveToStream(Stream: TStream); override;
procedure ReadStream(Stream: TStream; UseSize: boolean; Size: Longint); virtual;
procedure WriteStream(Stream: TStream; WriteSize: Boolean); virtual;
Function ReleaseHandle: HBITMAP;
function ReleaseHandle: HBITMAP;
function ReleasePalette: HPALETTE;
class function GetFPReaderForFileExt(
const FileExtension: string): TFPCustomImageReaderClass; override;
@ -1320,6 +1325,33 @@ type
property CursorHandle: hCursor read GetCursorHandle;
property OwnHandle: Boolean read FOwnHandle write FOwnHandle;
end;
{ TJpegImage }
TJPEGQualityRange = TFPJPEGCompressionQuality;
TJPEGPerformance = TJPEGReadPerformance;
TJPEGImage = class(TFPImageBitmap)
private
FGrayScale: Boolean;
FPerformance: TJPEGPerformance;
FProgressiveEncoding: boolean;
FQuality: TJPEGQualityRange;
protected
procedure InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader); override;
procedure FinalizeFPImageReader(ImgReader: TFPCustomImageReader); override;
procedure InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter); override;
public
constructor Create; override;
class function GetFileExtensions: string; override;
class function GetDefaultFPReader: TFPCustomImageReaderClass; override;
class function GetDefaultFPWriter: TFPCustomImageWriterClass; override;
public
property CompressionQuality: TJPEGQualityRange read FQuality write FQuality;
property GrayScale: Boolean read FGrayScale;
property ProgressiveEncoding: boolean read FProgressiveEncoding;
property Performance: TJPEGPerformance read FPerformance write FPerformance;
end;
function GraphicFilter(GraphicClass: TGraphicClass): string;
function GraphicExtension(GraphicClass: TGraphicClass): string;
@ -2094,6 +2126,77 @@ begin
FreeAndNil(BrushResourceCache);
end;
{ TJpegImage }
{ TJPEGImage }
procedure TJPEGImage.InitFPImageReader(IntfImg: TLazIntfImage; ImgReader: TFPCustomImageReader);
var
JPEGReader: TFPReaderJPEG;
begin
if ImgReader is TFPReaderJPEG then
begin
JPEGReader := TFPReaderJPEG(ImgReader);
JPEGReader.Performance := Performance;
JPEGReader.OnProgress := @Progress;
end;
inherited InitFPImageReader(IntfImg, ImgReader);
end;
procedure TJPEGImage.FinalizeFPImageReader(ImgReader: TFPCustomImageReader);
var
JPEGReader: TFPReaderJPEG;
begin
if ImgReader is TFPReaderJPEG then
begin
JPEGReader := TFPReaderJPEG(ImgReader);
FProgressiveEncoding := JPEGReader.ProgressiveEncoding;
FGrayScale := JPEGReader.GrayScale;
end;
inherited FinalizeFPImageReader(ImgReader);
end;
procedure TJPEGImage.InitFPImageWriter(IntfImg: TLazIntfImage; ImgWriter: TFPCustomImageWriter);
var
JPEGWriter: TFPWriterJPEG;
begin
if ImgWriter is TFPWriterJPEG then
begin
JPEGWriter := TFPWriterJPEG(ImgWriter);
if JPEGWriter <> nil then
begin
JPEGWriter.ProgressiveEncoding := ProgressiveEncoding;
JPEGWriter.CompressionQuality := CompressionQuality;
JPEGWriter.OnProgress := @Progress;
end;
end;
inherited InitFPImageWriter(IntfImg, ImgWriter);
end;
class function TJPEGImage.GetDefaultFPReader: TFPCustomImageReaderClass;
begin
Result := TFPReaderJPEG;
end;
class function TJPEGImage.GetDefaultFPWriter: TFPCustomImageWriterClass;
begin
Result := TFPWriterJPEG;
end;
constructor TJPEGImage.Create;
begin
inherited Create;
FPerformance := jpBestQuality;
FProgressiveEncoding := False;
FGrayScale := False;
FQuality := 75;
end;
class function TJPEGImage.GetFileExtensions: string;
begin
Result := 'jpg;jpeg';
end;
initialization
RegisterIntegerConsts(TypeInfo(TColor), @IdentToColor, @ColorToIdent);
RegisterIntegerConsts(TypeInfo(TFontCharset), @IdentToCharset, @CharsetToIdent);

View File

@ -52,9 +52,7 @@ begin
Add('pgm', 'Portable GrayMap', TPortableAnyMapGraphic);
Add('ppm', 'Portable PixMap', TPortableAnyMapGraphic);
Add('ico', rsIcon, TIcon);
{$IFDEF UseSimpleJpeg}
Add('jpg', 'Joint Picture Expert Group',TJpegImage);
{$ENDIF}
end;
procedure TPicFileFormatsList.Clear;
@ -206,6 +204,7 @@ begin
Add(PredefinedClipboardFormat(pcfPixmap), TPixmap);
//Add(PredefinedClipboardFormat(pcfIcon), TIcon);
Add(ClipboardRegisterFormat('image/png'), TPortableNetworkGraphic);
Add(ClipboardRegisterFormat('image/jpeg'), TJPegImage);
end;
procedure TPicClipboardFormats.Clear;
@ -411,6 +410,12 @@ begin
Result := TIcon(Graphic);
end;
function TPicture.GetJpeg: TJpegImage;
begin
ForceType(TJpegImage);
Result := TJpegImage(Graphic);
end;
procedure TPicture.SetBitmap(Value: TBitmap);
begin
SetGraphic(Value);
@ -436,6 +441,11 @@ begin
SetGraphic(Value);
end;
procedure TPicture.SetJpeg(Value: TJpegImage);
begin
SetGraphic(Value);
end;
procedure TPicture.SetGraphic(Value: TGraphic);
var
NewGraphic: TGraphic;