Example #1
0
RealSize Rotation::trSizeToBB(const RealSize& size) const {
    if (is_straight(angle)) {
        if (is_sideways(angle)) {
            return RealSize(size.height * zoomY, size.width * zoomX);
        } else {
            return RealSize(size.width * zoomX, size.height * zoomY);
        }
    } else {
        double s = sin(angle), c = cos(angle);
        double x = size.width * zoomX, y = size.height * zoomY;
        return RealSize(fabs(c * x) + fabs(s * y), fabs(s * x) + fabs(c * y));
    }
}
Example #2
0
void PageRenderer::GetSize(int pageNo, float *width, float *height, int32 zoom) {
	// determine width and height
	*width = ceil(RealSize (mDoc->getPageCropWidth (pageNo), zoom));
	*height = ceil(RealSize (mDoc->getPageCropHeight (pageNo), zoom));

	if ((mDoc->getPageRotate(pageNo) == 90) ||
		(mDoc->getPageRotate(pageNo) == 270)) {
		float h = *width; *width = *height; *height = h;
	}

	if ((mRotate == 90) || (mRotate == 270)) {
		float h = *width; *width = *height; *height = h;
	}
}
Example #3
0
RealSize RotatedDC::GetTextExtent(const String& text) const {
    int w, h;
    dc.GetTextExtent(text, &w, &h);
#ifdef __WXGTK__
    // HACK: Some fonts don't get the descender height set correctly.
    int charHeight = dc.GetCharHeight();
    if (charHeight != h)
        h += h - charHeight;
#endif
    if (quality == QUALITY_LOW) {
        return RealSize(w / zoomX, h / zoomY);
    } else {
        return RealSize(w / (zoomX * text_scaling), h / (zoomY * text_scaling));
    }
}
Example #4
0
void PackageList::drawItem(DC& dc, int x, int y, size_t item) {
	dc.SetClippingRegion(x+1, y+2, item_size.x-2, item_size.y-2);
	PackageData& d = packages.at(item);
	RealRect rect(RealPoint(x,y),item_size);
	RealPoint pos;
	int w, h;
	// draw image
	if (d.image.Ok()) {
		dc.DrawBitmap(d.image, x + int(align_delta_x(ALIGN_CENTER, item_size.x, d.image.GetWidth())), y + 3, true);
	}
	// draw short name
	dc.SetFont(wxFont(12,wxSWISS,wxNORMAL,wxBOLD,false,_("Arial")));
	dc.GetTextExtent(capitalize(d.package->short_name), &w, &h);
	pos = align_in_rect(ALIGN_CENTER, RealSize(w,h), rect);
	dc.DrawText(capitalize(d.package->short_name), max(x+1,(int)pos.x), (int)pos.y + 110);
	// draw name
	dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
	dc.GetTextExtent(d.package->full_name, &w, &h);
	RealPoint text_pos = align_in_rect(ALIGN_CENTER, RealSize(w,h), rect);
	dc.DrawText(d.package->full_name, max(x+1,(int)text_pos.x), (int)text_pos.y + 130);
	dc.DestroyClippingRegion();
}
Example #5
0
	inline operator RealRect () const { return RealRect(min, RealSize(max - min)); }
Example #6
0
	inline RealSize  getSize() const { return RealSize (           width, height); }
Example #7
0
void RotatedDC::DrawImage(const Image& image, const RealPoint& pos, ImageCombine combine) {
    Image rotated = rotate_image(image, angle);
    DrawPreRotatedImage(rotated, RealRect(pos,trInvS(RealSize(image))), combine);
}
Example #8
0
RealSize Rotation::trInv(const RealSize& x) const {
    double s = sin(angle), c = cos(angle);
    return RealSize((c * x.width - s * x.height) / zoomX,
                    (s * x.width + c * x.height) / zoomY);
}