OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 29-01-2004, 11:35
VMC
Guest
 
Posts: n/a
Default How to modify the "displaycurve" of a bitmap with

I have to change the "view" of a bitmap insert in coreldraw11, and i thought this code will work:

Dim sh As Shape

Dim Nodo As Node
Dim cv As New Curve

Dim x As Double, y As Double
Set sh = ActiveShape
For Each Nodo In sh.DisplayCurve.Nodes
Nodo.GetPosition x, y
Nodo.SetPosition x + 0.1, y + 0.1
' then blows the error:
' Shape is nos the correct type for this property or method
' Err -2147467262
Next

What i'm doing wrong?
Thanks in advance!
Reply With Quote
  #2  
Old 29-01-2004, 19:18
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Try This

Try This:

Code:
Sub MoveNodes()

Dim n As Node
Dim x As Double, y As Double

For Each n In ActiveShape.Curve.Nodes

n.GetPosition x, y
n.SetPosition x + 0.1, y + 0.1

Next n

End Sub
Reply With Quote
  #3  
Old 29-01-2004, 19:29
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: How to modify the "displaycurve" of a bitmap w

It is not possible to edit the display curve of any object. It is read-only. Unfortunately there is no support for editing bitmap clipping paths from VBA yet.
Reply With Quote
  #4  
Old 30-01-2004, 02:23
VMC
Guest
 
Posts: n/a
Default

Thanks for the answer, but i'm sure there must exist a method to change the display curve, or at least, to make a copy of the current bitmap (maybe a clone) and then change the display curve.

In this web, the JigsawPuzzle is doing something similar. But, how?

Maybe with corelscript tools?
Reply With Quote
  #5  
Old 30-01-2004, 08:18
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

You need to look at the PowerClip feature instead. Create a regular curve shape and then put the bitmap inside it as a PowerClip. Your bitmap will still remain rectangular but clipped to the boundary of the curve.
Reply With Quote
  #6  
Old 30-01-2004, 13:25
VMC
Guest
 
Posts: n/a
Default

Thanks for your fast and (so helpfully) reply.

I think i've got it, or at least i've got something that works:

Code:
Sub Example()
    Dim shBM As Shape   'bitmap
    Dim shBMclone As Shape   'bitmap
    Dim shRC As Shape   'clipping rectangle
    Dim shPW As Shape   'bitmap inside the rectangle (by powerclipping)
    
    Dim x1 As Double, y1 As Double
    Dim x2 As Double, y2 As Double
    Dim w1 As Double, w2 As Double
    Dim h1 As Double, h2 As Double
    
    'Suppose you've got selected one bitmap
    Set shBM = ActiveShape: If shBM Is Nothing Then Exit Sub
    'Bitmap size and position
    shBM.GetSize w1, h1:    shBM.GetPosition x1, y1
    
    'Create one clipping rectangle
    Set shRC = ActiveLayer.CreateRectangle(4, 4, 12, 12)
    'Rectangle size and position
    shRC.GetSize w2, h2:    shRC.GetPosition x2, y2 'a bit stupid, i knew but maybe useful for somebody
    
    
    'We make a clon
    Set shBMclone = shBM.Clone  
    'Comment '.Clone' if you want to delete the original bitmap
    
    'Insert the bitmap inside the rectangle
    shBMclone.AddToPowerClip shRC
    'Get the bitmap (shape) that is inside the rectangle
    Set shPW = shRC.PowerClip.Shapes.Item(1)
    
    shPW.Move ((w1 - w2) / 2) + (x1 - x2), ((h1 - h2) / 2) + ((y1 - h1) - (y2 - h2))
    
    'PD: If you want clone the bitmap,  all the "clones" will be deleted
    '    by deleting the original bitmap. Be careful!
End Sub
VMC for ApiaXXI SA
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap names in Corel 12... meandirtyjoe CorelDRAW/Corel DESIGNER VBA 1 17-05-2005 10:14
Work with BITMAP in Corel drg CorelDRAW/Corel DESIGNER VBA 3 16-01-2005 10:29
replacing duotone bitmap please_reboot CorelDRAW/Corel DESIGNER VBA 4 18-04-2004 23:30
Determining whether a bitmap has a color mask applied to it pmeier CorelDRAW/Corel DESIGNER VBA 3 14-07-2003 00:46
How do you switch Bitmap modes in CorelDraw 10 VBA? Rick Randall CorelDRAW/Corel DESIGNER VBA 1 14-05-2003 10:06


All times are GMT -5. The time now is 05:52.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com