Is it possible to add texture (image fill) to a line drawn with graphics.lineTo()?
I am trying to draw a line from x1, y1 to x2,y2 and i want it to be a line that repeats a pattern from an image. All I can see is that you can only draw lines and change their color or thickness but I would like it to repeat an image. Is that possible or do i have to use a really long and thin rectangle with a bitmap fill?
The problem is I am making a game where the user will be able to actually draw the line so i have to make it be created dynamically.
The game fantastic contraption (www.fantasticcontraption.com) has in the game a feature where you draw lines of any length and position that are filed with a picture.
Any help is appreciated. Thanks!!
I just threw together a quick proof of concept for the last technique I described...using some similar to the branch image from that earlier link. The swf is attached. Just click around the stage.
I didn't get too sophisticated here.... so no mouse dragging of the circles etc although that would be easy to add in.
Once its drawn via the drawing API its basically just the native renderer that get's sluggish with the animation updates if you add too much. All the bitmapdata transformations are being done at the native level for the updates, but it can get quite cumbersome/cpu intensive if you put too much on stage. I suspect it might be faster under these conditions if the drawn content was vector data, because you can loop through thousands of drawing commands very quickly.
BranchBitmap is a library bitmap set to export on frame 1 with BranchBitmap as the class name.
The code for this is :
var segments:Sprite=new Sprite()
addChild(segments)
var connectors:Sprite = new Sprite();
addChild(connectors);
var points:Array=[];
stage.addEventListener(MouseEvent.CLICK, clickhandler)
stage.addEventListener(Event.ENTER_FRAME,frameupdater);
function clickhandler(e:MouseEvent):void{
points.push(new Point(e.stageX,e.stageY));
connectors.graphics.beginFill(0xff0000,.8);
connectors.graphics.drawCircle(e.stageX,e.stageY,15);
drawNewSegment()
var lastPoint:Point;
var scrollwidth:uint=2;
var branchBitmapData:BitmapData = new BranchBitmap(247,52);
var scrollpixels:BitmapData = new BitmapData(scrollwidth,branchBitmapData.height)
function frameupdater(e:Event):void{
branchBitmapData.lock();
var rect:Rectangle = branchBitmapData.rect;
rect.x=branchBitmapData.width-scrollwidth;
rect.width=scrollwidth;
scrollpixels.copyPixels(branchBitmapData,rect,new Point(0,0))
branchBitmapData.scroll(1,0)
branchBitmapData.copyPixels(scrollpixels,scrollpixels.rect,new Point(0,0))
branchBitmapData.unlock();
function drawNewSegment():void{
if (points.length>1){
if (!lastPoint) lastPoint= points[0];
var latestPoint:Point = points[points.length-1];
var diff:Point = latestPoint.subtract(lastPoint);
var angle:Number = Math.atan2(diff.y,diff.x);
var baseRectangle:Rectangle = new Rectangle (lastPoint.x, lastPoint.y-branchBitmapData.height/2,Point.distance(lastPoint,latestPoint),branchBitmapData.height);
var drawingPoints:Array=[];
var drawingMatrix:Matrix = new Matrix();
var bitmapMatrix:Matrix=new Matrix();
bitmapMatrix.translate(0,-branchBitmapData.height/2)
drawingMatrix.translate(-lastPoint.x,-lastPoint.y);
drawingMatrix.rotate(angle);
bitmapMatrix.rotate(angle);
drawingMatrix.translate(lastPoint.x,lastPoint.y);
bitmapMatrix.translate(lastPoint.x,lastPoint.y);
//DEBUG: segments.graphics.lineStyle(0,0,1);
segments.graphics.beginBitmapFill(branchBitmapData,bitmapMatrix,true,true)
var p:Point = drawingMatrix.transformPoint(baseRectangle.topLeft);
var sp:Point =p;
segments.graphics.moveTo(p.x,p.y);
p=drawingMatrix.transformPoint(new Point(baseRectangle.bottomRight.x,baseRectangle.y));
segments.graphics.lineTo(p.x,p.y);
p=drawingMatrix.transformPoint(baseRectangle.bottomRight);
segments.graphics.lineTo(p.x,p.y);
p=drawingMatrix.transformPoint(new Point(baseRectangle.x,baseRectangle.bottomRight.y));
segments.graphics.lineTo(p.x,p.y);
segments.graphics.lineTo(sp.x,sp.y);
lastPoint= latestPoint
Similar Messages
-
Is that possible to add a listener to a class that bind with a image?
Hello, I am trying to add listener to a class that binds with image. For example, I want to add listener to customDividerSkin(see example below, i bold and underline the text), so when user click the customdividerSkin image haloGreen box will be hided. Thanks,
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/09/18/customizing-the-divider-skin-on-a-dividedbox-conta iner-in-flex/ -->
<mx:Application name="HDividedBox_dividerSkin_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();">
<mx:Script>
<![CDATA[
[Embed("arrowLeft.png")]
private const customDividerSkin:Class;
private function init():void
dividedBox.setStyle("dividerSkin", customDividerSkin);
]]>
</mx:Script>
<mx:HDividedBox id="dividedBox"
horizontalGap="24"
width="100%"
height="100%">
<mx:ViewStack id="AddFormViewStack"
width="100%"
height="100%">
<mx:Box id="box1"
backgroundColor="haloGreen"
width="100%"
height="100%"
minWidth="100"/>
<mx:Box id="box2"
backgroundColor="haloBlue"
width="100%"
height="100%"
minWidth="100"/>
</mx:ViewStack>
</mx:HDividedBox>
</mx:Application>Set the class as the source for an mx:Image and set the listener to the Image
-
Is possible to add a image in a button?
I know it can assign a icon for <mx:Button ...>
my button is created programly:
var but:Button = new Button();
but.width=20;
but.addEventListener("click",indent);
myRTE.toolbar.addChild(but);
I want to assign a image on this button. Who has idea how to
do it?try this:
[code]
<mx:Button styleName="myButton" label=""/>
<mx:Style>
.myButton
upSkin: Embed(source="../forum.gif");
overSkin: Embed(source="../forum.gif");
downSkin: Embed(source="../forum.gif");
disabledSkin: Embed(source="../forum.gif");
[/code] -
Hi
This question is related to table component implementation.
I want to display the column values inside the small round image with different colors and value should appear in the middle.Hi,
>>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
3.how to make my column headers in bold?<<
I’m sorry for the issue that you are hitting now.
This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
http://sourceforge.net/projects/itextsharp/
Thanks for your understanding.
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Enhanced Podcast- Can I fill the iphone-iTouch screen with graphic
I have successfully created enhanced podcasts with SoundTrack Pro, and I can pre format all the graphics for the graphic track to be 640x360 or 480x272.
But, is there anyway currently to have this enhanced podcast graphics track behave like the iPhone-iTouch treats a movie file, that is fill the screen in landscape mode?to make a protrait aspect project? There's this
http://www.fcpxbook.com/tips/customprojectsize.html -
How to add an image in a hub section header
Hi.
I want to add an Image in a hub section header. Is it possible to add an image with the section header so that like the section header when I click on the image it would also navigate me to that section page ?
samEESomething like this might work for you:
<HubSection IsHeaderInteractive="True"
DataContext="{Binding Section3Items}"
d:DataContext="{Binding Groups[3],
Source={d:DesignData Source=/DataModel/SampleData.json, Type=data:SampleDataSource}}"
Padding="40,40,40,32">
<HubSection.Header>
<Image Source="Assets/Logo.png"></Image>
</HubSection.Header>
http://peted.azurewebsites.net/ -
How do you add an image to the preview that doesn't show up in the live site?
Is it possible to add an image that would take the place of " <> " ?
No this is how it's done. This answer was provided by Nthsecret
1) I create an image of my widget preview (ex. with photoshop);
2) I add an image in a server or ftp;
3) I add the image into file .mucow in this mode:
<pageItemPosterHTML>
<![CDATA[
<div><img src="YOUR_IMAGE" style=" height: HEIGHT_IN_PX; width: WIDTH_IN_PX;"></div>
]]>
</pageItemPosterHTML>
<pageItemHTML>
<![CDATA[
<div></div>
]]>
</pageItemHTML> -
How to add some image in adobe muse
hi.. im just new in adobe muse .. im sorry for this very noob question.. i just want to ask how to add some image in adobe muse ?? with a link .. thanks
To add images press CTRL+D and then select the image and place it where you want.
To hyperlink it go to the top menu and there should be Hyperlink folowed by a box. Enter your URL to link in there.
You can also use the slideshow widget should you want to make a slideshow. -
Is it possible to add name to subject line when submitting a pdf form
Hi,
I have created a form with Live Cycle and added a button which submittingthe form as PDF. I was wondering is it possible to add staff name to the subject line just after Leave Request as seen in the picture below?
RegardsIt is pretty easy to accomplish your requirement using scripts on a regular button rather than email submit button.
Look at this amazing sample created by Paul which explains a number of ways to submit form data through email.
http://forums.adobe.com/message/2109208#2109208
Nith -
When mirroring, is it possible to get the image from the ipad to fill the screen on the TV instead of appearing as a screen within a screen?
Welcome to the Apple Community.
No, the iPad has an aspect ratio of 4:3, a TV has an aspect ratio of 16:9, to fit one into the other is impossible without distorting the picture. If your TV has a zoom feature, you may be able to use this to fill the screen a little more to your liking, but this will result in cropping top and bottom. -
We are trying to do a simple HEAR IT - SELECT IT type 'quiz' in Captivate 7 for an indigenous language project. Our target output is html 5 to web browser.
We have used the multiple choice question mode and have inserted IMAGES in place of text (although we left the question numbers visible)
The user should be able to click on a speaker icon to hear the audio file (as many times as they choose) and then select the correct image answer.
ALSO - Is it possible to add sound effects for a correct or incorrect quiz answer?
ThanksAttaching audio could be done to the Success/Failure captions, rather easily.You can put a shape button on a question slide, other interactive objects are not possible (Buttons on Question/Score Slides in Captivate 6? - Captivate blog). And have that shape button pause before the pause of the question slide. Use an advanced action with the Statement 'Play audio'. Don't use a simple action, because it will release the play head: Why choose Standard over Simple action? - Captivate blog
User will then be able to click that shape button as many times as he wants, because the play head will remain at the pausing point. When he Submits the question, the two step process will use the pausing point of the Question slide: Question Question Slides in Captivate - Captivate blog
Lilybiri -
Is it possible to add a barcode image generator API on HTMLDB that support
Hi All,
Currently we create Barcodes images using a Java solution - open source API called Barbeque.barcode.servlet. Is it possible to add a barcode image generator API on HTMLDB that support multiple formats?
Our current process:
All jobs created in our system require a barcode which is then printed onto a cover sheet for each job (refer example). We also currently have individual barcodes printed on a single feed barcode printer for attaching to jobs sheets. We also print A4 sheets of barcodes with the Field Technican id number on that we sent out to them.
Thanks in advacne
ManojIt certainly is possible to call Java from PL/SQL and so therefore from APEX.
The process is fairly well documented online and there's a well cited example of calling Apache FOP within these forums.
You may however need to do a little work to wrap your Java library using static methods in order to do this.
Regards
Ben -
Is it possible to add a text box to an image in Aperture?
is it possible to add a text box/caption to an image in Aperture? (I do NOT have photoshop)
Do you want to write it directly onto the image? Then install and use the free BorderFX plug-in for Aperture. It will let you write text annotations directly onto the image or onto a border.
Regards
Léonie
You can download BorderFX for Aperture from here: http://www.iborderfx.com/BorderFX -
I am building a mobile site that is pretty heavily dependant on lighbox displays for the scroll capability. The issue I have run into is that I need to be able to add alt and title tags to the images in the lightbox (slideshow) to maintain the seo of my site. I have only designed a few of the pages thus far, and the issue I am running across is that once an image is considered a "trigger" by muse I can no longer add the seo elements in the same way I can when it's an image.
A few ways around this I found are:
1) export the site to Dreamweaver and then I can go in to the code and add the seo for the images in the lighbox on the backend.
2) I can build the site image by image and then over lay each trigger for the lighbox slideshow.
The issue with #1 is that once I export my site to dreamweaver it is then no longer editable in muse. I see this presenting a huge problem as I move forward with new iterations of my website. Any changes made in dreamweaver are not transferable to muse and thus creating two seperate sites. That means I would need to recreate any and all seo built in every time I update the site. This is not really an option and is not efficien at all. Is there a way to jump back and forth between these two products that I am unaware of? That would be most helpful.
The issue with #2: I have built each project page on the site as mostly large background images with triggers over laid. I did this to try and lower the overall gerth of the site, but it is seeming I am not going to be able to get around this and maintain the seo i am looking for.
Has any one run into this problem and solved it?
Here is the site thus far:
ghatest.businesscatalyst.com
Thank you for your feedback!Placed images and slideshow images support tooltips (the "title" attribute) and alt text via the "Edit Image Properties..." content menu.
Strictly speaking, background images (fill images) in HTML do not support these tags. That said, in some contexts it may make sense for Muse to enable setting these attributes on an arbitrary object (which may, or may not, have a fill image). -
Is it possible to add or overlay text on an image to be used in a slideshow in Aperture?
Is it possible to add or overlay text on an image to be used in a slideshow in Aperture v3.2.2? If so how? Thanks.
RJTStart here.
Don't miss this:
Stage 7: Titling and Adding Text to the Slideshow
Add a title to your slideshow using the titling controls. Insert a blank slide at the beginning of the movie to display your title. You can also use blank slides to act as chapter dividers. Add text to individual slides where appropriate.
or this:
Adding Text to an Individual Slide
Message was edited by: Kirby Krieger -- added final link.
Maybe you are looking for
-
Bridge 5.0.2.4 with camera RAW 8.4.0.199 ON a MAC 10.10.1. Trying to update to camera RAW 8.7 to get my canon 7dMK2 raw files to work. But the updater say I have the latest update! Witch I clearly don't have . And my Photoshop have to different camer
-
I have quickbooks software. I am traveling. I tried to send an invoice out, using the mac email (version 5.3) I can't send the mail out. I get a pop up asking for my password, I put the password in and it does not accept it. This is the 1st time I've
-
Sharepoint 2013 Foundation three tier farm with two Webservers in NLB
Heloo, I have been strugling with a problem the last htree days. I have instelled and configured a sharepoint 2013 three tier farm with Sharepoint 2013 Foundation and MS SQL 2014 Express. This is a Test Farm and all the servers are Windows 2012 R2. I
-
Firefox does not open or takes 1/2 hour+ to open. Horrible!
My machine: Dell E1505 with, Vista (with latest updates as of 12DEC10) Firefox latest build of 3.6 Firefox has seemed to be going downhill, FAST! Over the last year or so I have noticed a huge increase of length to open firefox. I have had the, forme
-
If BP is created with sales area, it doesn't reach R/3
Hi, In our CRM 5.0 system, if we create a BP only with general information (name, address etc.), it reaches R/3 fine. But if I create a BP with general information & sales area info at the same time & then save it, problems... An entry is created in