Jump to content
Changes to the Jaspersoft community edition download ×

About zooming


Recommended Posts

By: Kees Kuip - keeskuip

About zooming

2003-07-19 13:03

 

Hello,

 

I'm currently looking through the sourcecode of

iReport and have a question on 'zooming'.

 

It seems that you calculate all the zooming

yourself. This can be very tricky.

 

Are you aware that you can 'scale' a Graphics2D ?

scale == zoom !

That way you can do :

public void paintReportPanel(Graphics g) {

Graphics2D g2 = (Graphics2D) g;

 

g.scale(2.0, 2.0);

redrawAll(g2, .., ..);

}

 

Now everything has a zoomfactor of 200 %.

 

Ofcourse you should adjust your selection-algoritm now. (other coordinates)

 

 

Is there a reason that you implemented the

zooming yourself instead of leaving it to Java2D ?

 

Kees.

 

 

 

 

 

 

By: Giulio Toffoli - gt78

RE: About zooming

2003-07-20 01:36

Hi Kees,

 

I alredy know the java2D scale feature. iReport

zooming is derived from the old code of iReport 0.1.0

(that don't use Graphics2D). Anyway, not all elements drawed are scaled. I.e. the border of a

selected element is not scaled. Some lines (in example

the bans lines, are not scaled), etc..

 

Second detail. Differently from a standard scrollpane

that use the concept of viewport to view only a

portion of a big image buffer, the iReport screen buffer is at max big as the screen. All is repainted when a scroll event happen. This is not efficent, and will be one of the first optimization to the render.

 

However thanks for your interest.

 

Giulio

 

 

 

 

By: Kees Kuip - keeskuip

RE: About zooming

2003-07-20 03:54

 

You can scale a shape without

scaling the line thickness by using

the following code:

 

shape = ...

s = g2.getTransform().getTransformedShape(shape);

g2.setScale(1.0, 1.0);

g2.draw(s);

g2.setScale(orgXscale, orgYscale);

 

 

By: Giulio Toffoli - gt78

RE: About zooming

2003-07-20 15:02

I'll take in great consideration your suggestions.

But for now was more simple reuse the existing code.

For new elements, could be more useful use this triks (i.e. to draw the future barcode element)

 

Giulio

 

 

By: Kees Kuip - keeskuip

RE: About zooming

2003-07-21 00:57

Funny, I have just been looking into barcode's.

 

I found out that the library itext has barcode

functionality. It can print them to an image

which then can be used in JasperReports.

 

Kees.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...