- // number of small images:
- nx = image.width()/100;
- ny = image.height()/100;
-
- // create small images:
- img = new QImage*[nx];
- RS_Pixmap pm;
- int w,h;
- for (int x = 0; x<nx; ++x) {
- img[x] = new QImage[ny];
- for (int y = 0; y<ny; ++y) {
- if (x<nx-1) {
- w = 100;
- }
- else {
- w = image.width()%100;
- }
-
- if (y<ny-1) {
- h = 100;
- }
- else {
- h = image.height()%100;
- }
-
- pm = RS_Pixmap(w, h);
- RS_PainterQt painter(&pm);
- painter.drawImage(-x*100, -y*100, image);
- img[x][y] = pm.convertToImage();
- }
- }
- */
+ // number of small images:
+ nx = image.width()/100;
+ ny = image.height()/100;
+
+ // create small images:
+ img = new QImage*[nx];
+ RS_Pixmap pm;
+ int w,h;
+ for (int x = 0; x<nx; ++x) {
+ img[x] = new QImage[ny];
+ for (int y = 0; y<ny; ++y) {
+ if (x<nx-1) {
+ w = 100;
+ }
+ else {
+ w = image.width()%100;
+ }
+
+ if (y<ny-1) {
+ h = 100;
+ }
+ else {
+ h = image.height()%100;
+ }
+
+ pm = RS_Pixmap(w, h);
+ RS_PainterQt painter(&pm);
+ painter.drawImage(-x*100, -y*100, image);
+ img[x][y] = pm.convertToImage();
+ }
+ }
+ */
+}
+
+/** @return Copy of data that defines the image. */
+RS_ImageData RS_Image::getData() const
+{
+ return data;
+}
+
+/** @return Insertion point of the entity */
+/*virtual*/ Vector RS_Image::getInsertionPoint() const
+{
+ return data.insertionPoint;
+}
+
+/** Sets the insertion point for the image. */
+void RS_Image::setInsertionPoint(Vector ip)
+{
+ data.insertionPoint = ip;
+ calculateBorders();
+}
+
+/** @return File name of the image. */
+QString RS_Image::getFile() const
+{
+ return data.file;
+}
+
+/** Sets the file name of the image. */
+void RS_Image::setFile(const QString & file)
+{
+ data.file = file;
+}
+
+/** @return u Vector. Points along bottom, 1 pixel long. */
+Vector RS_Image::getUVector() const
+{
+ return data.uVector;
+}
+
+/** @return v Vector. Points along left, 1 pixel long. */
+Vector RS_Image::getVVector() const
+{
+ return data.vVector;
+}
+
+/** @return Width of image in pixels. */
+int RS_Image::getWidth() const
+{
+ return (int)data.size.x;
+}
+
+/** @return Height of image in pixels. */
+int RS_Image::getHeight() const
+{
+ return (int)data.size.y;
+}
+
+/** @return Brightness. */
+int RS_Image::getBrightness() const
+{
+ return data.brightness;
+}
+
+/** @return Contrast. */
+int RS_Image::getContrast() const
+{
+ return data.contrast;
+}
+
+/** @return Fade. */
+int RS_Image::getFade() const
+{
+ return data.fade;
+}
+
+/** @return Image definition handle. */
+int RS_Image::getHandle() const
+{
+ return data.handle;
+}
+
+/** Sets the image definition handle. */
+void RS_Image::setHandle(int h)
+{
+ data.handle = h;
+}
+
+/** @return The four corners. **/
+VectorSolutions RS_Image::getCorners()
+{
+ VectorSolutions sol(4);
+
+ sol.set(0, data.insertionPoint);
+ sol.set(1,
+ data.insertionPoint + data.uVector * RS_Math::round(data.size.x));
+ sol.set(3,
+ data.insertionPoint + data.vVector * RS_Math::round(data.size.y));
+ sol.set(2, sol.get(3) + data.uVector * RS_Math::round(data.size.x));
+
+ return sol;
+}
+
+/**
+ * @return image with in graphic units.
+ */
+double RS_Image::getImageWidth()
+{
+ return data.size.x * data.uVector.magnitude();
+}
+
+/**
+ * @return image height in graphic units.
+ */
+double RS_Image::getImageHeight()
+{
+ return data.size.y * data.vVector.magnitude();